[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9775 - in gnuradio/trunk/grc: . src/platforms/python
From: |
jblum |
Subject: |
[Commit-gnuradio] r9775 - in gnuradio/trunk/grc: . src/platforms/python |
Date: |
Fri, 10 Oct 2008 21:45:10 -0600 (MDT) |
Author: jblum
Date: 2008-10-10 21:45:09 -0600 (Fri, 10 Oct 2008)
New Revision: 9775
Modified:
gnuradio/trunk/grc/src/platforms/python/Param.py
gnuradio/trunk/grc/todo.txt
Log:
support numpy types
Modified: gnuradio/trunk/grc/src/platforms/python/Param.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Param.py 2008-10-11 02:55:43 UTC
(rev 9774)
+++ gnuradio/trunk/grc/src/platforms/python/Param.py 2008-10-11 03:45:09 UTC
(rev 9775)
@@ -20,8 +20,20 @@
from utils import expr_utils
from .. base.Param import Param as _Param
import Constants
+import numpy
import os
+#define types, native python + numpy
+VECTOR_TYPES = (tuple, list, set, numpy.ndarray)
+COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128]
+REAL_TYPES = [float, numpy.float, numpy.float32, numpy.float64]
+INT_TYPES = [int, long, numpy.int, numpy.int8, numpy.int16, numpy.int32,
numpy.uint64,
+ numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64]
+#cast to tuple for isinstance, concat subtypes
+COMPLEX_TYPES = tuple(COMPLEX_TYPES + REAL_TYPES + INT_TYPES)
+REAL_TYPES = tuple(REAL_TYPES + INT_TYPES)
+INT_TYPES = tuple(INT_TYPES)
+
class Param(_Param):
_init = False
@@ -114,52 +126,55 @@
#raise an exception if the data is invalid
if t == 'raw': return e
elif t == 'complex':
- try: assert(isinstance(e, (complex, float, int,
long)))
+ try: assert(isinstance(e, COMPLEX_TYPES))
except AssertionError:
self._add_error_message('Expression
"%s" is invalid for type complex.'%str(e))
raise Exception
return e
elif t == 'real':
- try: assert(isinstance(e, (float, int, long)))
+ try: assert(isinstance(e, REAL_TYPES))
except AssertionError:
self._add_error_message('Expression
"%s" is invalid for type real.'%str(e))
raise Exception
return e
elif t == 'int':
- try: assert(isinstance(e, (int, long)))
+ try: assert(isinstance(e, INT_TYPES))
except AssertionError:
self._add_error_message('Expression
"%s" is invalid for type integer.'%str(e))
raise Exception
return e
+ #########################
+ # Numeric Vector Types
+ #########################
elif t == 'complex_vector':
- if not isinstance(e, (tuple, list, set)):
+ if not isinstance(e, VECTOR_TYPES):
self._lisitify_flag = True
e = [e]
try:
for ei in e:
- assert(isinstance(ei, (complex,
float, int, long)))
+ assert(isinstance(ei,
COMPLEX_TYPES))
except AssertionError:
self._add_error_message('Expression
"%s" is invalid for type complex vector.'%str(e))
raise Exception
return e
elif t == 'real_vector':
- if not isinstance(e, (tuple, list, set)):
+ if not isinstance(e, VECTOR_TYPES):
self._lisitify_flag = True
e = [e]
try:
for ei in e:
- assert(isinstance(ei, (float,
int, long)))
+ assert(isinstance(ei,
REAL_TYPES))
except AssertionError:
self._add_error_message('Expression
"%s" is invalid for type real vector.'%str(e))
raise Exception
return e
elif t == 'int_vector':
- if not isinstance(e, (tuple, list, set)):
+ if not isinstance(e, VECTOR_TYPES):
self._lisitify_flag = True
e = [e]
try:
for ei in e:
- assert(isinstance(ei, (int,
long)))
+ assert(isinstance(ei,
INT_TYPES))
except AssertionError:
self._add_error_message('Expression
"%s" is invalid for type integer vector.'%str(e))
raise Exception
Modified: gnuradio/trunk/grc/todo.txt
===================================================================
--- gnuradio/trunk/grc/todo.txt 2008-10-11 02:55:43 UTC (rev 9774)
+++ gnuradio/trunk/grc/todo.txt 2008-10-11 03:45:09 UTC (rev 9775)
@@ -4,9 +4,7 @@
-optparse block
-ofdm wrappers
-controlled step block
--throttle with sink only (source is nulled)
-simplify simple usrp
--numbersink: update wrapper for newer api
-probe: also non-float outputs
##################################################
@@ -22,6 +20,7 @@
-search for blocks
-click and drag on whitespace to scroll
-expand preferences, allow for custom prefs, prefs dialog should infer
structure
+-drag connection to delete it
##################################################
# Problems
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9775 - in gnuradio/trunk/grc: . src/platforms/python,
jblum <=