diff options
Diffstat (limited to 'gnuradio-core/src/python/gnuradio/gruimpl')
11 files changed, 92 insertions, 92 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py b/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py index 4fa972ad21..e04702152d 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/daemon.py @@ -1,23 +1,23 @@ # # Copyright 2008 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# import os, sys, signal # Turn application into a background daemon process. @@ -62,7 +62,7 @@ def daemonize(pidfile=None, logfile=None): if pid == 0: # First child of first fork() # Become session leader of new session os.setsid() - + # fork() into background again try: pid = os.fork() @@ -74,14 +74,14 @@ def daemonize(pidfile=None, logfile=None): else: # Second child of first fork() os._exit(0) - + os.umask(0111) # Write pid pid = os.getpid() if pidfile is not None: open(pidfile, 'w').write('%d\n'%pid) - + # Redirect streams if logfile is not None: lf = open(logfile, 'a+') diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py b/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py index 46696a50e8..60dca64a58 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/freqz.py @@ -1,34 +1,34 @@ #!/usr/bin/env python # # Copyright 2005,2007 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# # This code lifted from various parts of www.scipy.org -eb 2005-01-24 # Copyright (c) 2001, 2002 Enthought, Inc. -# +# # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: -# +# # a. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # b. Redistributions in binary form must reproduce the above copyright @@ -37,8 +37,8 @@ # c. Neither the name of the Enthought nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. -# -# +# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -50,7 +50,7 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. -# +# __all__ = ['freqz'] @@ -62,7 +62,7 @@ def atleast_1d(*arys): """ Force a sequence of arrays to each be at least 1D. Description: - Force an array to be at least 1D. If an array is 0D, the + Force an array to be at least 1D. If an array is 0D, the array is converted to a single row of values. Otherwise, the array is unaltered. Arguments: @@ -73,7 +73,7 @@ def atleast_1d(*arys): res = [] for ary in arys: ary = asarray(ary) - if len(ary.shape) == 0: + if len(ary.shape) == 0: result = numpy.array([ary[0]]) else: result = ary @@ -147,7 +147,7 @@ class poly1d: def __coerce__(self,other): return None - + def __repr__(self): vals = repr(self.coeffs) vals = vals[6:-1] @@ -177,14 +177,14 @@ class poly1d: newstr = '' elif coefstr == '1': newstr = 'x' - else: + else: newstr = '%s x' % (coefstr,) else: if coefstr == '0': newstr = '' elif coefstr == '1': newstr = 'x**%d' % (power,) - else: + else: newstr = '%s x**%d' % (coefstr, power) if k > 0: @@ -198,7 +198,7 @@ class poly1d: else: thestr = newstr return _raise_power(thestr) - + def __call__(self, val): return polyval(self.coeffs, val) @@ -215,12 +215,12 @@ class poly1d: return poly1d(other * self.coeffs) else: other = poly1d(other) - return poly1d(polymul(self.coeffs, other.coeffs)) - + return poly1d(polymul(self.coeffs, other.coeffs)) + def __add__(self, other): other = poly1d(other) - return poly1d(polyadd(self.coeffs, other.coeffs)) - + return poly1d(polyadd(self.coeffs, other.coeffs)) + def __radd__(self, other): other = poly1d(other) return poly1d(polyadd(self.coeffs, other.coeffs)) @@ -267,7 +267,7 @@ class poly1d: return self.order else: return self.__dict__[key] - + def __getitem__(self, val): ind = self.order - val if val > self.order: @@ -306,7 +306,7 @@ def freqz(b, a, worN=None, whole=0, plot=None): jw B(e) b[0] + b[1]e + .... + b[m]e H(e) = ---- = ------------------------------------ jw -jw -jnw - A(e) a[0] + a[2]e + .... + a[n]e + A(e) a[0] + a[2]e + .... + a[n]e Inputs: diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py b/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py index 2c2a06847b..defc47b59f 100755 --- a/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/gnuplot_freqz.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2005,2007 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# __all__ = ['gnuplot_freqz'] @@ -40,14 +40,14 @@ def gnuplot_freqz (hw, Fs=None, logfreq=False): Returns a handle to the gnuplot graph. When the handle is reclaimed the graph is torn down.""" - + data_file = tempfile.NamedTemporaryFile () cmd_file = os.popen ('gnuplot', 'w') h, w = hw ampl = 20 * numpy.log10 (numpy.absolute (h) + 1e-9) phase = map (lambda x: math.atan2 (x.imag, x.real), h) - + if Fs: w *= (Fs/(2*math.pi)) @@ -63,7 +63,7 @@ def gnuplot_freqz (hw, Fs=None, logfreq=False): cmd_file.write ("unset logscale x\n") cmd_file.write ("plot '%s' using 1:2 with lines\n" % (data_file.name,)) cmd_file.flush () - + return (cmd_file, data_file) diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py b/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py index f2808c4489..0fb5ecde04 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/hexint.py @@ -1,23 +1,23 @@ # # Copyright 2005 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# def hexint(mask): """ diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py b/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py index 953bf90b14..9e70eb863c 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/listmisc.py @@ -1,23 +1,23 @@ # # Copyright 2005 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# def list_reverse(x): """ diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py b/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py index 1a7741814f..aa4efc3e9c 100755 --- a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2004 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# '''Control National LMX2306 based frequency synthesizer''' @@ -78,7 +78,7 @@ class lmx2306 (object): self._set_fosc (fosc) self._set_step (step_size) - + def program (self, r, a, b): if self.verbose: print "lmx2306: r = %d a = %d b = %d" % (r, a, b) @@ -102,10 +102,10 @@ class lmx2306 (object): return actual # ---------------------------------------------------------------- - + def _set_fosc (self, ref_oscillator_freq): self.fosc = ref_oscillator_freq - + def _set_step (self, step_size): r = int (self.fosc / step_size) if r * step_size != self.fosc: @@ -114,7 +114,7 @@ class lmx2306 (object): raise ValueError, "r is out of range" self.r = r self.step_size = step_size - + def _compute_ab (self, divisor): b = divisor / 8 a = divisor - (b * 8) @@ -174,7 +174,7 @@ if __name__ == '__main__': eng_notation.num_to_str (options.fosc), eng_notation.num_to_str (options.step_size), eng_notation.num_to_str (options.freq)) - + lmx = lmx2306 (options.fosc, options.step_size) lmx.verbose = options.verbose diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py b/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py index 77f2e03b53..7e6f23a346 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/mathmisc.py @@ -1,23 +1,23 @@ # # Copyright 2005 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# import math diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py b/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py index 0d999dd020..40b053770e 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/os_read_exactly.py @@ -1,23 +1,23 @@ # # Copyright 2005 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# import os diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py b/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py index 8296831b1e..5192a71554 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py @@ -1,23 +1,23 @@ # # Copyright 2003,2004 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# from gnuradio import gr @@ -33,7 +33,7 @@ class sdr_1000 (gr.sdr_1000_base): self.write_latch (2, data, 0xff) self.write_latch (3, 0x40, 0x40) self.write_latch (3, 0x00, 0x40) - + def set_freq(self, freq): self.set_band (freq) ftw = freq / 200e6; @@ -56,23 +56,23 @@ class sdr_1000 (gr.sdr_1000_base): band = 4 else: band = 5 - + self.write_latch (1, 1 << band, 0x3f) def set_bit (self, reg, bit, state): val = 0x00 if state: val = 1<<bit self.write_latch (reg, val, 1<<bit) - + def set_tx (self, on = 1): self.set_bit(1, 6, on) def set_rx (self): self.set_bit(1, 6, 0) - + def set_gain (self, high): self.set_bit(0, 7, high) - + def set_mute (self, mute = 1): self.set_bit(1, 7, mute) diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py b/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py index 7416423bf4..def3299b69 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/seq_with_cursor.py @@ -1,23 +1,23 @@ # # Copyright 2003,2004 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# # misc utilities @@ -41,7 +41,7 @@ class seq_with_cursor (object): self.index = initial_index else: raise exceptions.ValueError - + def set_index_by_value(self, v): """ Set index to the smallest value such that items[index] >= v. @@ -52,7 +52,7 @@ class seq_with_cursor (object): more = True while cv < v and more: cv, more = self.next() # side effect! - + def next (self): new_index = self.index + 1 if new_index < len (self.items): @@ -74,4 +74,4 @@ class seq_with_cursor (object): def get_seq (self): return self.items[:] # copy of items - + diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py index cc2381d2e1..329fd2ed3d 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py @@ -1,23 +1,23 @@ # # Copyright 2005 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# # random socket related stuff |