[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5553 - in gnuradio/trunk: . gnuradio-core/src/python/
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r5553 - in gnuradio/trunk: . gnuradio-core/src/python/gnuradio gnuradio-core/src/python/gnuradio/blksimpl gnuradio-core/src/python/gnuradio/blksimpl2 gnuradio-core/src/python/gnuradio/gruimpl gnuradio-examples/python/hier/dect gnuradio-examples/python/usrp gr-wxgui/src/python |
Date: |
Mon, 28 May 2007 11:04:10 -0600 (MDT) |
Author: jcorgan
Date: 2007-05-28 11:04:09 -0600 (Mon, 28 May 2007)
New Revision: 5553
Modified:
gnuradio/trunk/README
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/cpm.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/d8psk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam16.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam256.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam64.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam8.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/d8psk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dbpsk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dqpsk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/gmsk.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/pkt.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/ofdm_packet_utils.py
gnuradio/trunk/gnuradio-core/src/python/gnuradio/packet_utils.py
gnuradio/trunk/gnuradio-examples/python/hier/dect/gmsk2.py
gnuradio/trunk/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
gnuradio/trunk/gr-wxgui/src/python/fftsink.py
gnuradio/trunk/gr-wxgui/src/python/fftsink2.py
gnuradio/trunk/gr-wxgui/src/python/numbersink.py
gnuradio/trunk/gr-wxgui/src/python/plot.py
gnuradio/trunk/gr-wxgui/src/python/scopesink.py
gnuradio/trunk/gr-wxgui/src/python/scopesink2.py
gnuradio/trunk/gr-wxgui/src/python/waterfallsink.py
gnuradio/trunk/gr-wxgui/src/python/waterfallsink2.py
Log:
Merged r5547:5542 from jcorgan/num into trunk. Converts from using Python
Numeric to numpy. Trunk passes distcheck. gr-radio-astronomy still needs
conversion.
Modified: gnuradio/trunk/README
===================================================================
--- gnuradio/trunk/README 2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/README 2007-05-28 17:04:09 UTC (rev 5553)
@@ -173,12 +173,11 @@
libpython you'll most likely need those too.
-(5) Numeric python library http://numeric.scipy.org
+(5) Numpy python library http://numeric.scipy.org
Provides a high performance array type for Python.
-http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=1351
+http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103
-
(6) The Boost C++ Libraries http://www.boost.org
We use the Smart Pointer library. Most systems already have the boost
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/cpm.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/cpm.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/cpm.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -2,7 +2,7 @@
# CPM modulation and demodulation.
#
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -27,7 +27,7 @@
from gnuradio import gr
from gnuradio import modulation_utils
from math import pi
-import Numeric
+import numpy
from pprint import pprint
import inspect
@@ -39,7 +39,7 @@
_def_cpm_type = 0 # 0=CPFSK, 1=GMSK, 2=RC, 3=GENERAL
_def_bt = 0.35
_def_symbols_per_pulse = 1
-_def_generic_taps = Numeric.empty(1)
+_def_generic_taps = numpy.empty(1)
_def_verbose = False
_def_log = False
@@ -113,13 +113,13 @@
else:
raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is
%r" % (cpm_type,))
- self._generic_taps=Numeric.array(generic_taps)
+ self._generic_taps=numpy.array(generic_taps)
if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
raise TypeError, ("samples_per_symbol must be an integer >= 2, is
%r" % (samples_per_symbol,))
self.nsymbols = 2**bits_per_symbol
-
self.sym_alphabet=Numeric.arrayrange(-(self.nsymbols-1),self.nsymbols,2)
+ self.sym_alphabet=numpy.arange(-(self.nsymbols-1),self.nsymbols,2)
self.ntaps = self._symbols_per_pulse * samples_per_symbol
@@ -143,10 +143,10 @@
self.ntaps # number of taps
)
sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps =
Numeric.convolve(Numeric.array(gaussian_taps),Numeric.array(sqwave))
+ self.taps =
numpy.convolve(numpy.array(gaussian_taps),numpy.array(sqwave))
elif cpm_type == 2: # Raised Cosine
# generalize it for arbitrary roll-off factor
- self.taps =
(1-Numeric.cos(2*pi*Numeric.arrayrange(0,self.ntaps)/samples_per_symbol/self._symbols_per_pulse))/(2*self._symbols_per_pulse)
+ self.taps =
(1-numpy.cos(2*pi*numpy.arange(0,self.ntaps)/samples_per_symbol/self._symbols_per_pulse))/(2*self._symbols_per_pulse)
elif cpm_type == 3: # Generic CPM
self.taps = generic_taps
else:
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/d8psk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/d8psk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/d8psk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,7 +29,6 @@
from math import pi, sqrt
import psk
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import psk
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import psk
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/gmsk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -27,7 +27,7 @@
from gnuradio import gr
from gnuradio import modulation_utils
from math import pi
-import Numeric
+import numpy
from pprint import pprint
import inspect
@@ -96,7 +96,7 @@
)
self.sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps =
Numeric.convolve(Numeric.array(self.gaussian_taps),Numeric.array(self.sqwave))
+ self.taps =
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol,
self.taps)
# FM modulation
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,8 +20,6 @@
#
from math import pi
-import Numeric
-
from gnuradio import gr, ofdm_packet_utils
import gnuradio.gr.gr_threading as _threading
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/pkt.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -20,8 +20,6 @@
#
from math import pi
-import Numeric
-
from gnuradio import gr, packet_utils
import gnuradio.gr.gr_threading as _threading
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam16.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam16.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam16.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import qam
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam256.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam256.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam256.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import qam
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam64.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam64.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam64.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import qam
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam8.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam8.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl/qam8.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import qam
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/d8psk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/d8psk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/d8psk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import psk
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dbpsk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dbpsk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dbpsk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import psk
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dqpsk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dqpsk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/dqpsk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -29,7 +29,6 @@
from math import pi, sqrt
import psk
import cmath
-import Numeric
from pprint import pprint
# default values (used in __init__ and add_options)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/gmsk.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/gmsk.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/gmsk.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -27,7 +27,7 @@
from gnuradio import gr
from gnuradio import modulation_utils
from math import pi
-import Numeric
+import numpy
from pprint import pprint
import inspect
@@ -97,7 +97,7 @@
)
self.sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps =
Numeric.convolve(Numeric.array(self.gaussian_taps),Numeric.array(self.sqwave))
+ self.taps =
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol,
self.taps)
# FM modulation
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/pkt.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/pkt.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/blksimpl2/pkt.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -20,8 +20,6 @@
#
from math import pi
-import Numeric
-
from gnuradio import gr, packet_utils
import gnuradio.gr.gr_threading as _threading
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -54,9 +54,9 @@
__all__ = ['freqz']
-import Numeric
-from Numeric import *
-Num=Numeric
+import numpy
+from numpy import *
+Num=numpy
def atleast_1d(*arys):
""" Force a sequence of arrays to each be at least 1D.
@@ -74,7 +74,7 @@
for ary in arys:
ary = asarray(ary)
if len(ary.shape) == 0:
- result = Numeric.array([ary[0]])
+ result = numpy.array([ary[0]])
else:
result = ary
res.append(result)
@@ -101,7 +101,7 @@
y = 0
else:
x = asarray(x)
- y = Numeric.zeros(x.shape,x.typecode())
+ y = numpy.zeros(x.shape,x.typecode())
for i in range(len(p)):
y = x * y + p[i]
return y
@@ -135,7 +135,7 @@
raise ValueError, "Polynomial must be 1d only."
c_or_r = trim_zeros(c_or_r, trim='f')
if len(c_or_r) == 0:
- c_or_r = Numeric.array([0])
+ c_or_r = numpy.array([0])
self.__dict__['coeffs'] = c_or_r
self.__dict__['order'] = len(c_or_r) - 1
@@ -281,8 +281,8 @@
if key < 0:
raise ValueError, "Does not support negative powers."
if key > self.order:
- zr = Numeric.zeros(key-self.order,self.coeffs.typecode())
- self.__dict__['coeffs'] = Numeric.concatenate((zr,self.coeffs))
+ zr = numpy.zeros(key-self.order,self.coeffs.typecode())
+ self.__dict__['coeffs'] = numpy.concatenate((zr,self.coeffs))
self.__dict__['order'] = key
ind = 0
self.__dict__['coeffs'][ind] = val
Modified:
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,7 +25,7 @@
import tempfile
import os
import math
-import Numeric
+import numpy
from gnuradio import gr
from gnuradio.gruimpl.freqz import freqz
@@ -45,7 +45,7 @@
cmd_file = os.popen ('gnuplot', 'w')
h, w = hw
- ampl = 20 * Numeric.log10 (Numeric.absolute (h) + 1e-9)
+ ampl = 20 * numpy.log10 (numpy.absolute (h) + 1e-9)
phase = map (lambda x: math.atan2 (x.imag, x.real), h)
if Fs:
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/ofdm_packet_utils.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/ofdm_packet_utils.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/ofdm_packet_utils.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -20,7 +20,7 @@
#
import struct
-import Numeric
+import numpy
from gnuradio import gru
def conv_packed_binary_string_to_1_0_string(s):
@@ -84,7 +84,7 @@
def whiten(s, o):
- sa = Numeric.fromstring(s, Numeric.UnsignedInt8)
+ sa = numpy.fromstring(s, numpy.uint8)
z = sa ^ random_mask_vec8[o:len(sa)+o]
return z.tostring()
@@ -444,5 +444,5 @@
199, 113, 146, 164, 109, 187, 109, 179, 109, 181, 237, 183, 13, 182, 133,
182,
227, 54, 201, 214, 214, 222, 222, 216, 88, 90, 186, 187, 51, 51, 255,
63 )
-random_mask_vec8 = Numeric.array(random_mask_tuple, Numeric.UnsignedInt8)
+random_mask_vec8 = numpy.array(random_mask_tuple, numpy.uint8)
Modified: gnuradio/trunk/gnuradio-core/src/python/gnuradio/packet_utils.py
===================================================================
--- gnuradio/trunk/gnuradio-core/src/python/gnuradio/packet_utils.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-core/src/python/gnuradio/packet_utils.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -1,5 +1,5 @@
#
-# Copyright 2005,2006 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,7 +20,7 @@
#
import struct
-import Numeric
+import numpy
from gnuradio import gru
@@ -87,7 +87,7 @@
def whiten(s, o):
- sa = Numeric.fromstring(s, Numeric.UnsignedInt8)
+ sa = numpy.fromstring(s, numpy.uint8)
z = sa ^ random_mask_vec8[o:len(sa)+o]
return z.tostring()
@@ -451,5 +451,5 @@
199, 113, 146, 164, 109, 187, 109, 179, 109, 181, 237, 183, 13, 182, 133,
182,
227, 54, 201, 214, 214, 222, 222, 216, 88, 90, 186, 187, 51, 51, 255,
63 )
-random_mask_vec8 = Numeric.array(random_mask_tuple, Numeric.UnsignedInt8)
+random_mask_vec8 = numpy.array(random_mask_tuple, numpy.uint8)
Modified: gnuradio/trunk/gnuradio-examples/python/hier/dect/gmsk2.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/hier/dect/gmsk2.py 2007-05-28
16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-examples/python/hier/dect/gmsk2.py 2007-05-28
17:04:09 UTC (rev 5553)
@@ -27,7 +27,7 @@
from gnuradio import gr
from gnuradio import modulation_utils
from math import pi
-import Numeric
+import numpy
from pprint import pprint
import inspect
@@ -97,7 +97,7 @@
)
self.sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps =
Numeric.convolve(Numeric.array(self.gaussian_taps),Numeric.array(self.sqwave))
+ self.taps =
numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
self.gaussian_filter = gr.interp_fir_filter_fff(samples_per_symbol,
self.taps)
# FM modulation
Modified: gnuradio/trunk/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
2007-05-28 16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gnuradio-examples/python/usrp/usrp_nbfm_ptt.py
2007-05-28 17:04:09 UTC (rev 5553)
@@ -33,7 +33,7 @@
from gnuradio.wxgui import stdgui, fftsink, scopesink, slider, form
from usrpm import usrp_dbid
-from Numeric import convolve, array
+from numpy import convolve, array
#import os
#print "pid =", os.getpid()
Modified: gnuradio/trunk/gr-wxgui/src/python/fftsink.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/fftsink.py 2007-05-28 16:46:12 UTC
(rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/fftsink.py 2007-05-28 17:04:09 UTC
(rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@
from gnuradio.wxgui import stdgui
import wx
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import threading
import math
@@ -202,7 +202,7 @@
start = itemsize * (nitems - 1)
s = s[start:start+itemsize]
- complex_data = Numeric.fromstring (s, Numeric.Float32)
+ complex_data = numpy.fromstring (s, numpy.float32)
de = DataEvent (complex_data)
wx.PostEvent (self.event_receiver, de)
del de
@@ -245,7 +245,7 @@
if self.peak_vals is None:
self.peak_vals = dB
else:
- self.peak_vals = Numeric.maximum(dB, self.peak_vals)
+ self.peak_vals = numpy.maximum(dB, self.peak_vals)
dB = self.peak_vals
x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
@@ -260,20 +260,20 @@
units = "kHz"
if self.fftsink.input_is_real: # only plot 1/2 the points
- x_vals = ((Numeric.arrayrange (L/2)
+ x_vals = ((numpy.arange (L/2)
* (self.fftsink.sample_rate * sf / L))
+ self.fftsink.baseband_freq * sf)
- points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points = numpy.zeros((len(x_vals), 2), numpy.float64)
points[:,0] = x_vals
points[:,1] = dB[0:L/2]
else:
# the "negative freqs" are in the second half of the array
- x_vals = ((Numeric.arrayrange (-L/2, L/2)
+ x_vals = ((numpy.arange (-L/2, L/2)
* (self.fftsink.sample_rate * sf / L))
+ self.fftsink.baseband_freq * sf)
- points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points = numpy.zeros((len(x_vals), 2), numpy.float64)
points[:,0] = x_vals
- points[:,1] = Numeric.concatenate ((dB[L/2:], dB[0:L/2]))
+ points[:,1] = numpy.concatenate ((dB[L/2:], dB[0:L/2]))
lines = plot.PolyLine (points, colour='BLUE')
Modified: gnuradio/trunk/gr-wxgui/src/python/fftsink2.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/fftsink2.py 2007-05-28 16:46:12 UTC
(rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/fftsink2.py 2007-05-28 17:04:09 UTC
(rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@
from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import threading
import math
@@ -209,7 +209,7 @@
start = itemsize * (nitems - 1)
s = s[start:start+itemsize]
- complex_data = Numeric.fromstring (s, Numeric.Float32)
+ complex_data = numpy.fromstring (s, numpy.float32)
de = DataEvent (complex_data)
wx.PostEvent (self.event_receiver, de)
del de
@@ -252,7 +252,7 @@
if self.peak_vals is None:
self.peak_vals = dB
else:
- self.peak_vals = Numeric.maximum(dB, self.peak_vals)
+ self.peak_vals = numpy.maximum(dB, self.peak_vals)
dB = self.peak_vals
x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
@@ -267,20 +267,20 @@
units = "kHz"
if self.fftsink.input_is_real: # only plot 1/2 the points
- x_vals = ((Numeric.arrayrange (L/2)
+ x_vals = ((numpy.arange (L/2)
* (self.fftsink.sample_rate * sf / L))
+ self.fftsink.baseband_freq * sf)
- points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points = numpy.zeros((len(x_vals), 2), numpy.float64)
points[:,0] = x_vals
points[:,1] = dB[0:L/2]
else:
# the "negative freqs" are in the second half of the array
- x_vals = ((Numeric.arrayrange (-L/2, L/2)
+ x_vals = ((numpy.arange (-L/2, L/2)
* (self.fftsink.sample_rate * sf / L))
+ self.fftsink.baseband_freq * sf)
- points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points = numpy.zeros((len(x_vals), 2), numpy.float64)
points[:,0] = x_vals
- points[:,1] = Numeric.concatenate ((dB[L/2:], dB[0:L/2]))
+ points[:,1] = numpy.concatenate ((dB[L/2:], dB[0:L/2]))
lines = plot.PolyLine (points, colour='BLUE')
Modified: gnuradio/trunk/gr-wxgui/src/python/numbersink.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/numbersink.py 2007-05-28 16:46:12 UTC
(rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/numbersink.py 2007-05-28 17:04:09 UTC
(rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,7 +25,7 @@
import wx
#from wx import StaticText
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import threading
import math
@@ -204,7 +204,7 @@
start = itemsize * (nitems - 1)
s = s[start:start+itemsize]
- complex_data = Numeric.fromstring (s, Numeric.Float32)
+ complex_data = numpy.fromstring (s, numpy.float32)
de = DataEvent (complex_data)
wx.PostEvent (self.event_receiver, de)
del de
@@ -478,7 +478,7 @@
if self.peak_vals is None:
self.peak_vals = numbers
else:
- self.peak_vals = Numeric.maximum(numbers, self.peak_vals)
+ self.peak_vals = numpy.maximum(numbers, self.peak_vals)
numbers = self.peak_vals
if self.numbersink.input_is_real:
Modified: gnuradio/trunk/gr-wxgui/src/python/plot.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/plot.py 2007-05-28 16:46:12 UTC (rev
5552)
+++ gnuradio/trunk/gr-wxgui/src/python/plot.py 2007-05-28 17:04:09 UTC (rev
5553)
@@ -6,7 +6,7 @@
#
# Created: 2003/11/03
# RCS-ID: $Id$
-# Copyright: (c) 2002
+# Copyright: (c) 2002,2007
# Licence: Use as you wish.
#-----------------------------------------------------------------------------
# 12/15/2003 - Jeff Grimmett (address@hidden)
@@ -34,7 +34,8 @@
# - Added functions GetClosestPoints (all curves) and GetClosestPoint (only
closest curve)
# can be in either user coords or screen coords.
#
-#
+# May 27, 2007 Johnathan Corgan (address@hidden)
+# - Converted from numarray to numpy
"""
This is a simple light weight plotting module that can be used with
@@ -92,20 +93,20 @@
import time as _time
import wx
-# Needs Numeric or numarray
+# Needs numpy or numarray
try:
- import Numeric as _Numeric
+ import numpy as _numpy
except:
try:
- import numarray as _Numeric #if numarray is used it is renamed Numeric
+ import numarray as _numpy #if numarray is used it is renamed numpy
except:
msg= """
- This module requires the Numeric or numarray module,
+ This module requires the numpy or numarray module,
which could not be imported. It probably is not installed
(it's not part of the standard Python distribution). See the
Python site (http://www.python.org) for information on
downloading source or binaries."""
- raise ImportError, "Numeric or numarray not found. \n" + msg
+ raise ImportError, "numpy or numarray not found. \n" + msg
@@ -118,7 +119,7 @@
"""
def __init__(self, points, attr):
- self.points = _Numeric.array(points)
+ self.points = _numpy.array(points)
self.currentScale= (1,1)
self.currentShift= (0,0)
self.scaled = self.points
@@ -133,11 +134,11 @@
if len(self.points) == 0:
# no curves to draw
# defaults to (-1,-1) and (1,1) but axis can be set in Draw
- minXY= _Numeric.array([-1,-1])
- maxXY= _Numeric.array([ 1, 1])
+ minXY= _numpy.array([-1,-1])
+ maxXY= _numpy.array([ 1, 1])
else:
- minXY= _Numeric.minimum.reduce(self.points)
- maxXY= _Numeric.maximum.reduce(self.points)
+ minXY= _numpy.minimum.reduce(self.points)
+ maxXY= _numpy.maximum.reduce(self.points)
return minXY, maxXY
def scaleAndShift(self, scale=(1,1), shift=(0,0)):
@@ -163,14 +164,14 @@
if pointScaled == True:
#Using screen coords
p = self.scaled
- pxy = self.currentScale * _Numeric.array(pntXY)+ self.currentShift
+ pxy = self.currentScale * _numpy.array(pntXY)+ self.currentShift
else:
#Using user coords
p = self.points
- pxy = _Numeric.array(pntXY)
+ pxy = _numpy.array(pntXY)
#determine distance for each point
- d= _Numeric.sqrt(_Numeric.add.reduce((p-pxy)**2,1)) #sqrt(dx^2+dy^2)
- pntIndex = _Numeric.argmin(d)
+ d= _numpy.sqrt(_numpy.add.reduce((p-pxy)**2,1)) #sqrt(dx^2+dy^2)
+ pntIndex = _numpy.argmin(d)
dist = d[pntIndex]
return [pntIndex, self.points[pntIndex], self.scaled[pntIndex], dist]
@@ -284,9 +285,9 @@
def _circle(self, dc, coords, size=1):
fact= 2.5*size
wh= 5.0*size
- rect= _Numeric.zeros((len(coords),4),_Numeric.Float)+[0.0,0.0,wh,wh]
+ rect= _numpy.zeros((len(coords),4),_numpy.float)+[0.0,0.0,wh,wh]
rect[:,0:2]= coords-[fact,fact]
- dc.DrawEllipseList(rect.astype(_Numeric.Int32))
+ dc.DrawEllipseList(rect.astype(_numpy.int32))
def _dot(self, dc, coords, size=1):
dc.DrawPointList(coords)
@@ -294,35 +295,35 @@
def _square(self, dc, coords, size=1):
fact= 2.5*size
wh= 5.0*size
- rect= _Numeric.zeros((len(coords),4),_Numeric.Float)+[0.0,0.0,wh,wh]
+ rect= _numpy.zeros((len(coords),4),_numpy.float)+[0.0,0.0,wh,wh]
rect[:,0:2]= coords-[fact,fact]
- dc.DrawRectangleList(rect.astype(_Numeric.Int32))
+ dc.DrawRectangleList(rect.astype(_numpy.int32))
def _triangle(self, dc, coords, size=1):
shape= [(-2.5*size,1.44*size), (2.5*size,1.44*size), (0.0,-2.88*size)]
- poly= _Numeric.repeat(coords,3)
+ poly= _numpy.repeat(coords,3)
poly.shape= (len(coords),3,2)
poly += shape
- dc.DrawPolygonList(poly.astype(_Numeric.Int32))
+ dc.DrawPolygonList(poly.astype(_numpy.int32))
def _triangle_down(self, dc, coords, size=1):
shape= [(-2.5*size,-1.44*size), (2.5*size,-1.44*size), (0.0,2.88*size)]
- poly= _Numeric.repeat(coords,3)
+ poly= _numpy.repeat(coords,3)
poly.shape= (len(coords),3,2)
poly += shape
- dc.DrawPolygonList(poly.astype(_Numeric.Int32))
+ dc.DrawPolygonList(poly.astype(_numpy.int32))
def _cross(self, dc, coords, size=1):
fact= 2.5*size
for f in [[-fact,-fact,fact,fact],[-fact,fact,fact,-fact]]:
- lines= _Numeric.concatenate((coords,coords),axis=1)+f
- dc.DrawLineList(lines.astype(_Numeric.Int32))
+ lines= _numpy.concatenate((coords,coords),axis=1)+f
+ dc.DrawLineList(lines.astype(_numpy.int32))
def _plus(self, dc, coords, size=1):
fact= 2.5*size
for f in [[-fact,0,fact,0],[0,-fact,0,fact]]:
- lines= _Numeric.concatenate((coords,coords),axis=1)+f
- dc.DrawLineList(lines.astype(_Numeric.Int32))
+ lines= _numpy.concatenate((coords,coords),axis=1)+f
+ dc.DrawLineList(lines.astype(_numpy.int32))
class PlotGraphics:
"""Container to hold PolyXXX objects and graph labels
@@ -347,8 +348,8 @@
p1, p2 = self.objects[0].boundingBox()
for o in self.objects[1:]:
p1o, p2o = o.boundingBox()
- p1 = _Numeric.minimum(p1, p1o)
- p2 = _Numeric.maximum(p2, p2o)
+ p1 = _numpy.minimum(p1, p1o)
+ p2 = _numpy.maximum(p2, p2o)
return p1, p2
def scaleAndShift(self, scale=(1,1), shift=(0,0)):
@@ -395,7 +396,7 @@
symExt = self.objects[0].getSymExtent(printerScale)
for o in self.objects[1:]:
oSymExt = o.getSymExtent(printerScale)
- symExt = _Numeric.maximum(symExt, oSymExt)
+ symExt = _numpy.maximum(symExt, oSymExt)
return symExt
def getLegendNames(self):
@@ -453,8 +454,8 @@
# Zooming variables
self._zoomInFactor = 0.5
self._zoomOutFactor = 2
- self._zoomCorner1= _Numeric.array([0.0, 0.0]) # left mouse down corner
- self._zoomCorner2= _Numeric.array([0.0, 0.0]) # left mouse up corner
+ self._zoomCorner1= _numpy.array([0.0, 0.0]) # left mouse down corner
+ self._zoomCorner2= _numpy.array([0.0, 0.0]) # left mouse up corner
self._zoomEnabled= False
self._hasDragged= False
@@ -701,13 +702,13 @@
def PositionUserToScreen(self, pntXY):
"""Converts User position to Screen Coordinates"""
- userPos= _Numeric.array(pntXY)
+ userPos= _numpy.array(pntXY)
x,y= userPos * self._pointScale + self._pointShift
return x,y
def PositionScreenToUser(self, pntXY):
"""Converts Screen position to User Coordinates"""
- screenPos= _Numeric.array(pntXY)
+ screenPos= _numpy.array(pntXY)
x,y= (screenPos-self._pointShift)/self._pointScale
return x,y
@@ -812,8 +813,8 @@
p2[0],p2[1] = xAxis[1], yAxis[1] # upper right corner user
scale (xmax,ymax)
else:
# Both axis specified in Draw
- p1= _Numeric.array([xAxis[0], yAxis[0]]) # lower left corner
user scale (xmin,ymin)
- p2= _Numeric.array([xAxis[1], yAxis[1]]) # upper right corner
user scale (xmax,ymax)
+ p1= _numpy.array([xAxis[0], yAxis[0]]) # lower left corner user
scale (xmin,ymin)
+ p2= _numpy.array([xAxis[1], yAxis[1]]) # upper right corner
user scale (xmax,ymax)
self.last_draw = (graphics, xAxis, yAxis) # saves most recient
values
@@ -848,8 +849,8 @@
lhsW= yTextExtent[0]+ yLabelWH[1]
bottomH= max(xTextExtent[1], yTextExtent[1]/2.)+ xLabelWH[1]
topH= yTextExtent[1]/2. + titleWH[1]
- textSize_scale= _Numeric.array([rhsW+lhsW,bottomH+topH]) # make plot
area smaller by text size
- textSize_shift= _Numeric.array([lhsW, bottomH]) # shift plot
area by this amount
+ textSize_scale= _numpy.array([rhsW+lhsW,bottomH+topH]) # make plot
area smaller by text size
+ textSize_shift= _numpy.array([lhsW, bottomH]) # shift plot
area by this amount
# drawing title and labels text
dc.SetFont(self._getFont(self._fontSizeTitle))
@@ -870,8 +871,8 @@
self._drawLegend(dc,graphics,rhsW,topH,legendBoxWH, legendSymExt,
legendTextExt)
# allow for scaling and shifting plotted points
- scale = (self.plotbox_size-textSize_scale) / (p2-p1)*
_Numeric.array((1,-1))
- shift = -p1*scale + self.plotbox_origin + textSize_shift *
_Numeric.array((1,-1))
+ scale = (self.plotbox_size-textSize_scale) / (p2-p1)*
_numpy.array((1,-1))
+ shift = -p1*scale + self.plotbox_origin + textSize_shift *
_numpy.array((1,-1))
self._pointScale= scale # make available for mouse events
self._pointShift= shift
self._drawAxes(dc, p1, p2, scale, shift, xticks, yticks)
@@ -1006,8 +1007,8 @@
self._drawRubberBand(self._zoomCorner1, self._zoomCorner2) #
remove old
self._zoomCorner2[0], self._zoomCorner2[1]= self.GetXY(event)
self._hasDragged = False # reset flag
- minX, minY= _Numeric.minimum( self._zoomCorner1,
self._zoomCorner2)
- maxX, maxY= _Numeric.maximum( self._zoomCorner1,
self._zoomCorner2)
+ minX, minY= _numpy.minimum( self._zoomCorner1,
self._zoomCorner2)
+ maxX, maxY= _numpy.maximum( self._zoomCorner1,
self._zoomCorner2)
self.last_PointLabel = None #reset pointLabel
if self.last_draw != None:
self.Draw(self.last_draw[0], xAxis = (minX,maxX), yAxis =
(minY,maxY), dc = None)
@@ -1065,10 +1066,10 @@
(self.width,self.height) = self.GetClientSize()
else:
self.width, self.height= width,height
- self.plotbox_size = 0.97*_Numeric.array([self.width, self.height])
+ self.plotbox_size = 0.97*_numpy.array([self.width, self.height])
xo = 0.5*(self.width-self.plotbox_size[0])
yo = self.height-0.5*(self.height-self.plotbox_size[1])
- self.plotbox_origin = _Numeric.array([xo, yo])
+ self.plotbox_origin = _numpy.array([xo, yo])
def _setPrinterScale(self, scale):
"""Used to thicken lines and increase marker size for print out."""
@@ -1111,12 +1112,12 @@
if isinstance(o,PolyMarker):
# draw marker with legend
pnt= (trhc[0]+legendLHS+legendSymExt[0]/2.,
trhc[1]+s+lineHeight/2.)
- o.draw(dc, self.printerScale, coord= _Numeric.array([pnt]))
+ o.draw(dc, self.printerScale, coord= _numpy.array([pnt]))
elif isinstance(o,PolyLine):
# draw line with legend
pnt1= (trhc[0]+legendLHS, trhc[1]+s+lineHeight/2.)
pnt2= (trhc[0]+legendLHS+legendSymExt[0],
trhc[1]+s+lineHeight/2.)
- o.draw(dc, self.printerScale, coord=
_Numeric.array([pnt1,pnt2]))
+ o.draw(dc, self.printerScale, coord= _numpy.array([pnt1,pnt2]))
else:
raise TypeError, "object is neither PolyMarker or PolyLine
instance"
# draw legend txt
@@ -1148,7 +1149,7 @@
txtList= graphics.getLegendNames()
txtExt= dc.GetTextExtent(txtList[0])
for txt in graphics.getLegendNames()[1:]:
- txtExt= _Numeric.maximum(txtExt,dc.GetTextExtent(txt))
+ txtExt= _numpy.maximum(txtExt,dc.GetTextExtent(txt))
maxW= symExt[0]+txtExt[0]
maxH= max(symExt[1],txtExt[1])
# padding .1 for lhs of legend box and space between lines
@@ -1188,14 +1189,14 @@
def _point2ClientCoord(self, corner1, corner2):
"""Converts user point coords to client screen int coords
x,y,width,height"""
- c1= _Numeric.array(corner1)
- c2= _Numeric.array(corner2)
+ c1= _numpy.array(corner1)
+ c2= _numpy.array(corner2)
# convert to screen coords
pt1= c1*self._pointScale+self._pointShift
pt2= c2*self._pointScale+self._pointShift
# make height and width positive
- pul= _Numeric.minimum(pt1,pt2) # Upper left corner
- plr= _Numeric.maximum(pt1,pt2) # Lower right corner
+ pul= _numpy.minimum(pt1,pt2) # Upper left corner
+ plr= _numpy.maximum(pt1,pt2) # Lower right corner
rectWidth, rectHeight= plr-pul
ptx,pty= pul
return ptx, pty, rectWidth, rectHeight
@@ -1212,8 +1213,8 @@
# if range == 0.:
if abs(range) < 1e-36:
return lower-0.5, upper+0.5
- log = _Numeric.log10(range)
- power = _Numeric.floor(log)
+ log = _numpy.log10(range)
+ power = _numpy.floor(log)
fraction = log-power
if fraction <= 0.05:
power = power-1
@@ -1250,11 +1251,11 @@
lower, upper = p1[0],p2[0]
text = 1
for y, d in [(p1[1], -xTickLength), (p2[1], xTickLength)]: #
miny, maxy and tick lengths
- a1 = scale*_Numeric.array([lower, y])+shift
- a2 = scale*_Numeric.array([upper, y])+shift
+ a1 = scale*_numpy.array([lower, y])+shift
+ a2 = scale*_numpy.array([upper, y])+shift
dc.DrawLine(a1[0],a1[1],a2[0],a2[1]) # draws upper and lower
axis line
for x, label in xticks:
- pt = scale*_Numeric.array([x, y])+shift
+ pt = scale*_numpy.array([x, y])+shift
dc.DrawLine(pt[0],pt[1],pt[0],pt[1] + d) # draws tick mark
d units
if text:
dc.DrawText(label,pt[0],pt[1])
@@ -1265,11 +1266,11 @@
text = 1
h = dc.GetCharHeight()
for x, d in [(p1[0], -yTickLength), (p2[0], yTickLength)]:
- a1 = scale*_Numeric.array([x, lower])+shift
- a2 = scale*_Numeric.array([x, upper])+shift
+ a1 = scale*_numpy.array([x, lower])+shift
+ a2 = scale*_numpy.array([x, upper])+shift
dc.DrawLine(a1[0],a1[1],a2[0],a2[1])
for y, label in yticks:
- pt = scale*_Numeric.array([x, y])+shift
+ pt = scale*_numpy.array([x, y])+shift
dc.DrawLine(pt[0],pt[1],pt[0]-d,pt[1])
if text:
dc.DrawText(label,pt[0]-dc.GetTextExtent(label)[0],
@@ -1278,13 +1279,13 @@
def _ticks(self, lower, upper):
ideal = (upper-lower)/7.
- log = _Numeric.log10(ideal)
- power = _Numeric.floor(log)
+ log = _numpy.log10(ideal)
+ power = _numpy.floor(log)
fraction = log-power
factor = 1.
error = fraction
for f, lf in self._multiples:
- e = _Numeric.fabs(fraction-lf)
+ e = _numpy.fabs(fraction-lf)
if e < error:
error = e
factor = f
@@ -1298,7 +1299,7 @@
digits = -int(power)
format = '%'+`digits+2`+'.'+`digits`+'f'
ticks = []
- t = -grid*_Numeric.floor(-lower/grid)
+ t = -grid*_numpy.floor(-lower/grid)
while t <= upper:
ticks.append( (t, format % (t,)) )
t = t + grid
@@ -1314,7 +1315,7 @@
t = t + grid
return ticks
- _multiples = [(2., _Numeric.log10(2.)), (5., _Numeric.log10(5.))]
+ _multiples = [(2., _numpy.log10(2.)), (5., _numpy.log10(5.))]
#-------------------------------------------------------------------------------
@@ -1405,19 +1406,19 @@
def _draw1Objects():
# 100 points sin function, plotted as green circles
- data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
+ data1 = 2.*_numpy.pi*_numpy.arange(200)/200.
data1.shape = (100, 2)
- data1[:,1] = _Numeric.sin(data1[:,0])
+ data1[:,1] = _numpy.sin(data1[:,0])
markers1 = PolyMarker(data1, legend='Green Markers', colour='green',
marker='circle',size=1)
# 50 points cos function, plotted as red line
- data1 = 2.*_Numeric.pi*_Numeric.arange(100)/100.
+ data1 = 2.*_numpy.pi*_numpy.arange(100)/100.
data1.shape = (50,2)
- data1[:,1] = _Numeric.cos(data1[:,0])
+ data1[:,1] = _numpy.cos(data1[:,0])
lines = PolyLine(data1, legend= 'Red Line', colour='red')
# A few more points...
- pi = _Numeric.pi
+ pi = _numpy.pi
markers2 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
(3.*pi/4., -1)], legend='Cross Legend',
colour='blue',
marker='cross')
@@ -1426,19 +1427,19 @@
def _draw2Objects():
# 100 points sin function, plotted as green dots
- data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
+ data1 = 2.*_numpy.pi*_numpy.arange(200)/200.
data1.shape = (100, 2)
- data1[:,1] = _Numeric.sin(data1[:,0])
+ data1[:,1] = _numpy.sin(data1[:,0])
line1 = PolyLine(data1, legend='Green Line', colour='green', width=6,
style=wx.DOT)
# 50 points cos function, plotted as red dot-dash
- data1 = 2.*_Numeric.pi*_Numeric.arange(100)/100.
+ data1 = 2.*_numpy.pi*_numpy.arange(100)/100.
data1.shape = (50,2)
- data1[:,1] = _Numeric.cos(data1[:,0])
+ data1[:,1] = _numpy.cos(data1[:,0])
line2 = PolyLine(data1, legend='Red Line', colour='red', width=3, style=
wx.DOT_DASH)
# A few more points...
- pi = _Numeric.pi
+ pi = _numpy.pi
markers1 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
(3.*pi/4., -1)], legend='Cross Hatch Square',
colour='blue', width= 3, size= 6,
fillcolour= 'red', fillstyle= wx.CROSSDIAG_HATCH,
@@ -1457,7 +1458,7 @@
def _draw4Objects():
# 25,000 point line
- data1 = _Numeric.arange(5e5,1e6,10)
+ data1 = _numpy.arange(5e5,1e6,10)
data1.shape = (25000, 2)
line1 = PolyLine(data1, legend='Wide Line', colour='green', width=5)
Modified: gnuradio/trunk/gr-wxgui/src/python/scopesink.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/scopesink.py 2007-05-28 16:46:12 UTC
(rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/scopesink.py 2007-05-28 17:04:09 UTC
(rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2006 Free Software Foundation, Inc.
+# Copyright 2003,2004,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@
from gnuradio.wxgui import stdgui
import wx
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import threading
import struct
@@ -215,7 +215,7 @@
start = ch * bytes_per_chan
chan_data = s[start:start+bytes_per_chan]
- rec = Numeric.fromstring (chan_data, Numeric.Float32)
+ rec = numpy.fromstring (chan_data, numpy.float32)
records.append (rec)
# print "nrecords = %d, reclen = %d" % (len (records),nsamples)
@@ -485,7 +485,7 @@
objects = []
Ts = 1.0 / (info.get_sample_rate () / info.get_decimation_rate ())
- x_vals = Ts * Numeric.arrayrange (-npoints/2, npoints/2)
+ x_vals = Ts * numpy.arange (-npoints/2, npoints/2)
# preliminary clipping based on time axis here, instead of in graphics
code
time_per_window = self.info.get_time_per_div () * 10
@@ -503,7 +503,7 @@
lb = npoints/2 - n/2
ub = npoints/2 + n/2
# points = zip (x_vals[lb:ub], r[lb:ub])
- points = Numeric.zeros ((ub-lb, 2), Numeric.Float64)
+ points = numpy.zeros ((ub-lb, 2), numpy.float64)
points[:,0] = x_vals[lb:ub]
points[:,1] = r[lb:ub]
@@ -542,7 +542,7 @@
objects = []
# points = zip (records[0], records[1])
- points = Numeric.zeros ((len(records[0]), 2), Numeric.Float32)
+ points = numpy.zeros ((len(records[0]), 2), numpy.float32)
points[:,0] = records[0]
points[:,1] = records[1]
Modified: gnuradio/trunk/gr-wxgui/src/python/scopesink2.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/scopesink2.py 2007-05-28 16:46:12 UTC
(rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/scopesink2.py 2007-05-28 17:04:09 UTC
(rev 5553)
@@ -24,7 +24,7 @@
from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import threading
import struct
@@ -216,7 +216,7 @@
start = ch * bytes_per_chan
chan_data = s[start:start+bytes_per_chan]
- rec = Numeric.fromstring (chan_data, Numeric.Float32)
+ rec = numpy.fromstring (chan_data, numpy.float32)
records.append (rec)
# print "nrecords = %d, reclen = %d" % (len (records),nsamples)
@@ -486,7 +486,7 @@
objects = []
Ts = 1.0 / (info.get_sample_rate () / info.get_decimation_rate ())
- x_vals = Ts * Numeric.arrayrange (-npoints/2, npoints/2)
+ x_vals = Ts * numpy.arange (-npoints/2, npoints/2)
# preliminary clipping based on time axis here, instead of in graphics
code
time_per_window = self.info.get_time_per_div () * 10
@@ -504,7 +504,7 @@
lb = npoints/2 - n/2
ub = npoints/2 + n/2
# points = zip (x_vals[lb:ub], r[lb:ub])
- points = Numeric.zeros ((ub-lb, 2), Numeric.Float64)
+ points = numpy.zeros ((ub-lb, 2), numpy.float64)
points[:,0] = x_vals[lb:ub]
points[:,1] = r[lb:ub]
@@ -543,7 +543,7 @@
objects = []
# points = zip (records[0], records[1])
- points = Numeric.zeros ((len(records[0]), 2), Numeric.Float32)
+ points = numpy.zeros ((len(records[0]), 2), numpy.float32)
points[:,0] = records[0]
points[:,1] = records[1]
Modified: gnuradio/trunk/gr-wxgui/src/python/waterfallsink.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/waterfallsink.py 2007-05-28 16:46:12 UTC
(rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/waterfallsink.py 2007-05-28 17:04:09 UTC
(rev 5553)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@
from gnuradio.wxgui import stdgui
import wx
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import os
import threading
import math
@@ -169,7 +169,7 @@
start = itemsize * (nitems - 1)
s = s[start:start+itemsize]
- complex_data = Numeric.fromstring (s, Numeric.Float32)
+ complex_data = numpy.fromstring (s, numpy.float32)
de = DataEvent (complex_data)
wx.PostEvent (self.event_receiver, de)
del de
Modified: gnuradio/trunk/gr-wxgui/src/python/waterfallsink2.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/waterfallsink2.py 2007-05-28
16:46:12 UTC (rev 5552)
+++ gnuradio/trunk/gr-wxgui/src/python/waterfallsink2.py 2007-05-28
17:04:09 UTC (rev 5553)
@@ -24,7 +24,7 @@
from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
-import Numeric
+import numpy
import os
import threading
import math
@@ -174,7 +174,7 @@
start = itemsize * (nitems - 1)
s = s[start:start+itemsize]
- complex_data = Numeric.fromstring (s, Numeric.Float32)
+ complex_data = numpy.fromstring (s, numpy.float32)
de = DataEvent (complex_data)
wx.PostEvent (self.event_receiver, de)
del de
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5553 - in gnuradio/trunk: . gnuradio-core/src/python/gnuradio gnuradio-core/src/python/gnuradio/blksimpl gnuradio-core/src/python/gnuradio/blksimpl2 gnuradio-core/src/python/gnuradio/gruimpl gnuradio-examples/python/hier/dect gnuradio-examples/python/usrp gr-wxgui/src/python,
jcorgan <=