diff options
author | Johnathan Corgan <jcorgan@corganenterprises.com> | 2012-08-28 12:52:09 -0700 |
---|---|---|
committer | Johnathan Corgan <jcorgan@corganenterprises.com> | 2012-08-28 12:52:09 -0700 |
commit | 5892c29ee0509ff8aa226f14da524f7ec30f9654 (patch) | |
tree | 759624a4c9f9b5d6c2e2da13906be99aebf25152 /gnuradio-core/src/python | |
parent | 7adff515181de5cfbd7392d934cac9083a8a6a58 (diff) | |
parent | fc4d37062c46886d3bc1fb0b6c3626d779be4ecd (diff) |
Merge remote branch 'reynwar/comments_next' into next
Conflicts:
gr-digital/include/digital_constellation.h
gr-digital/python/bpsk.py
gr-digital/python/qpsk.py
Diffstat (limited to 'gnuradio-core/src/python')
22 files changed, 202 insertions, 163 deletions
diff --git a/gnuradio-core/src/python/gnuradio/__init__.py b/gnuradio-core/src/python/gnuradio/__init__.py index a4917cf64c..d55dac79db 100644 --- a/gnuradio-core/src/python/gnuradio/__init__.py +++ b/gnuradio-core/src/python/gnuradio/__init__.py @@ -1 +1,12 @@ -# make this a package +""" +GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used with readily-available low-cost external RF hardware to create software-defined radios, or without hardware in a simulation-like environment. It is widely used in hobbyist, academic and commercial environments to support both wireless communications research and real-world radio systems. + +GNU Radio applications are primarily written using the Python programming language, while the supplied performance-critical signal-processing path is implemented in C++ using processor floating-point extensions, where available. Thus, the developer is able to implement real-time, high-throughput radio systems in a simple-to-use, rapid-application-development environment. + +While not primarily a simulation tool, GNU Radio does support development of signal processing algorithms using pre-recorded or generated data, avoiding the need for actual RF hardware. + +GNU Radio is licensed under the GNU General Public License (GPL) version 3. All of the code is copyright of the Free Software Foundation. +""" + +# This file makes gnuradio a package +# The docstring will be associated with the top level of the package. diff --git a/gnuradio-core/src/python/gnuradio/blks2/__init__.py b/gnuradio-core/src/python/gnuradio/blks2/__init__.py index 2dfdc77f46..1d3203ec79 100644 --- a/gnuradio-core/src/python/gnuradio/blks2/__init__.py +++ b/gnuradio-core/src/python/gnuradio/blks2/__init__.py @@ -18,6 +18,9 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # +""" +Miscellaneous contents implemented in python. +""" import glob import os.path diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py index 68d024565a..6420348be3 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py @@ -30,14 +30,11 @@ class am_demod_cf(gr.hier_block2): filtering to the audio output. It produces a float stream in the range [-1.0, +1.0]. - @param channel_rate: incoming sample rate of the AM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer - @param audio_pass: audio low pass filter passband frequency - @type audio_pass: float - @param audio_stop: audio low pass filter stop frequency - @type audio_stop: float + Args: + channel_rate: incoming sample rate of the AM baseband (integer) + audio_decim: input to output decimation rate (integer) + audio_pass: audio low pass filter passband frequency (float) + audio_stop: audio low pass filter stop frequency (float) """ def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop): gr.hier_block2.__init__(self, "am_demod_cf", @@ -64,10 +61,9 @@ class demod_10k0a3e_cf(am_demod_cf): This block demodulates an AM channel conformant to 10K0A3E emission standards, such as broadcast band AM transmissions. - @param channel_rate: incoming sample rate of the AM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer + Args: + channel_rate: incoming sample rate of the AM baseband (integer) + audio_decim: input to output decimation rate (integer) """ def __init__(self, channel_rate, audio_decim): am_demod_cf.__init__(self, channel_rate, audio_decim, diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py b/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py index 08f1d450ba..29e50bc2a3 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py @@ -45,8 +45,9 @@ class synthesis_filterbank(gr.hier_block2): Takes M complex streams in, produces single complex stream out that runs at M times the input sample rate - @param mpoints: number of freq bins/interpolation factor/subbands - @param taps: filter taps for subband filter + Args: + mpoints: number of freq bins/interpolation factor/subbands + taps: filter taps for subband filter The channel spacing is equal to the input sample rate. The total bandwidth and output sample rate are equal the input @@ -128,8 +129,9 @@ class analysis_filterbank(gr.hier_block2): Takes 1 complex stream in, produces M complex streams out that runs at 1/M times the input sample rate - @param mpoints: number of freq bins/interpolation factor/subbands - @param taps: filter taps for subband filter + Args: + mpoints: number of freq bins/interpolation factor/subbands + taps: filter taps for subband filter Same channel to frequency mapping as described above. """ diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py b/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py index 6bc0d7ed0d..cc93d5b45c 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py @@ -33,20 +33,14 @@ class fm_demod_cf(gr.hier_block2): deemphasis. Low pass filtering is done on the resultant signal. It produces an output float strem in the range of [-1.0, +1.0]. - @param channel_rate: incoming sample rate of the FM baseband - @type sample_rate: integer - @param deviation: maximum FM deviation (default = 5000) - @type deviation: float - @param audio_decim: input to output decimation rate - @type audio_decim: integer - @param audio_pass: audio low pass filter passband frequency - @type audio_pass: float - @param audio_stop: audio low pass filter stop frequency - @type audio_stop: float - @param gain: gain applied to audio output (default = 1.0) - @type gain: float - @param tau: deemphasis time constant (default = 75e-6), specify 'None' - to prevent deemphasis + Args: + channel_rate: incoming sample rate of the FM baseband (integer) + deviation: maximum FM deviation (default = 5000) (float) + audio_decim: input to output decimation rate (integer) + audio_pass: audio low pass filter passband frequency (float) + audio_stop: audio low pass filter stop frequency (float) + gain: gain applied to audio output (default = 1.0) (float) + tau: deemphasis time constant (default = 75e-6), specify 'None' to prevent deemphasis """ def __init__(self, channel_rate, audio_decim, deviation, audio_pass, audio_stop, gain=1.0, tau=75e-6): @@ -79,10 +73,9 @@ class demod_20k0f3e_cf(fm_demod_cf): channel conforming to 20K0F3E emission standards, outputting floats in the range [-1.0, +1.0]. - @param sample_rate: incoming sample rate of the FM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer + Args: + sample_rate: incoming sample rate of the FM baseband (integer) + audio_decim: input to output decimation rate (integer) """ def __init__(self, channel_rate, audio_decim): fm_demod_cf.__init__(self, channel_rate, audio_decim, @@ -98,10 +91,9 @@ class demod_200kf3e_cf(fm_demod_cf): channel conforming to 200KF3E emission standards, outputting floats in the range [-1.0, +1.0]. - @param sample_rate: incoming sample rate of the FM baseband - @type sample_rate: integer - @param audio_decim: input to output decimation rate - @type audio_decim: integer + Args: + sample_rate: incoming sample rate of the FM baseband (integer) + audio_decim: input to output decimation rate (integer) """ def __init__(self, channel_rate, audio_decim): fm_demod_cf.__init__(self, channel_rate, audio_decim, diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py b/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py index fc3f2d60d2..29e052f6f5 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py @@ -43,10 +43,10 @@ class fm_deemph(gr.hier_block2): def __init__(self, fs, tau=75e-6): """ - @param fs: sampling frequency in Hz - @type fs: float - @param tau: Time constant in seconds (75us in US, 50us in EUR) - @type tau: float + + Args: + fs: sampling frequency in Hz (float) + tau: Time constant in seconds (75us in US, 50us in EUR) (float) """ gr.hier_block2.__init__(self, "fm_deemph", gr.io_signature(1, 1, gr.sizeof_float), # Input signature @@ -126,10 +126,10 @@ class fm_preemph(gr.hier_block2): """ def __init__(self, fs, tau=75e-6): """ - @param fs: sampling frequency in Hz - @type fs: float - @param tau: Time constant in seconds (75us in US, 50us in EUR) - @type tau: float + + Args: + fs: sampling frequency in Hz (float) + tau: Time constant in seconds (75us in US, 50us in EUR) (float) """ gr.hier_block2.__init__(self, "fm_deemph", diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py index 8bcb47ae19..40eb255e1e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py @@ -32,14 +32,11 @@ class nbfm_rx(gr.hier_block2): Takes a single complex baseband input stream and produces a single float output stream of audio sample in the range [-1, +1]. - @param audio_rate: sample rate of audio stream, >= 16k - @type audio_rate: integer - @param quad_rate: sample rate of output stream - @type quad_rate: integer - @param tau: preemphasis time constant (default 75e-6) - @type tau: float - @param max_dev: maximum deviation in Hz (default 5e3) - @type max_dev: float + Args: + audio_rate: sample rate of audio stream, >= 16k (integer) + quad_rate: sample rate of output stream (integer) + tau: preemphasis time constant (default 75e-6) (float) + max_dev: maximum deviation in Hz (default 5e3) (float) quad_rate must be an integer multiple of audio_rate. diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py index 839cf6784a..a2c4310467 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py @@ -33,14 +33,11 @@ class nbfm_tx(gr.hier_block2): Takes a single float input stream of audio samples in the range [-1,+1] and produces a single FM modulated complex baseband output. - @param audio_rate: sample rate of audio stream, >= 16k - @type audio_rate: integer - @param quad_rate: sample rate of output stream - @type quad_rate: integer - @param tau: preemphasis time constant (default 75e-6) - @type tau: float - @param max_dev: maximum deviation in Hz (default 5e3) - @type max_dev: float + Args: + audio_rate: sample rate of audio stream, >= 16k (integer) + quad_rate: sample rate of output stream (integer) + tau: preemphasis time constant (default 75e-6) (float) + max_dev: maximum deviation in Hz (default 5e3) (float) quad_rate must be an integer multiple of audio_rate. """ diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py index eea12af958..02c8421d9e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/rational_resampler.py @@ -28,13 +28,12 @@ def design_filter(interpolation, decimation, fractional_bw): Given the interpolation rate, decimation rate and a fractional bandwidth, design a set of taps. - @param interpolation: interpolation factor - @type interpolation: integer > 0 - @param decimation: decimation factor - @type decimation: integer > 0 - @param fractional_bw: fractional bandwidth in (0, 0.5) 0.4 works well. - @type fractional_bw: float - @returns: sequence of numbers + Args: + interpolation: interpolation factor (integer > 0) + decimation: decimation factor (integer > 0) + fractional_bw: fractional bandwidth in (0, 0.5) 0.4 works well. (float) + Returns: + : sequence of numbers """ if fractional_bw >= 0.5 or fractional_bw <= 0: @@ -69,14 +68,11 @@ class _rational_resampler_base(gr.hier_block2): If neither is specified, a reasonable default, 0.4, is used as the fractional_bw. - @param interpolation: interpolation factor - @type interpolation: integer > 0 - @param decimation: decimation factor - @type decimation: integer > 0 - @param taps: optional filter coefficients - @type taps: sequence - @param fractional_bw: fractional bandwidth in (0, 0.5), measured at final freq (use 0.4) - @type fractional_bw: float + Args: + interpolation: interpolation factor (integer > 0) + decimation: decimation factor (integer > 0) + taps: optional filter coefficients (sequence) + fractional_bw: fractional bandwidth in (0, 0.5), measured at final freq (use 0.4) (float) """ if not isinstance(interpolation, int) or interpolation < 1: diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py index 8f75729c91..d6808b722f 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/stream_to_vector_decimator.py @@ -29,10 +29,12 @@ class stream_to_vector_decimator(gr.hier_block2): def __init__(self, item_size, sample_rate, vec_rate, vec_len): """ Create the block chain. - @param item_size the number of bytes per sample - @param sample_rate the rate of incoming samples - @param vec_rate the rate of outgoing vectors (same units as sample_rate) - @param vec_len the length of the outgoing vectors in items + + Args: + item_size: the number of bytes per sample + sample_rate: the rate of incoming samples + vec_rate: the rate of outgoing vectors (same units as sample_rate) + vec_len: the length of the outgoing vectors in items """ self._vec_rate = vec_rate self._vec_len = vec_len @@ -50,7 +52,9 @@ class stream_to_vector_decimator(gr.hier_block2): def set_sample_rate(self, sample_rate): """ Set the new sampling rate and update the decimator. - @param sample_rate the new rate + + Args: + sample_rate: the new rate """ self._sample_rate = sample_rate self._update_decimator() @@ -58,7 +62,9 @@ class stream_to_vector_decimator(gr.hier_block2): def set_vec_rate(self, vec_rate): """ Set the new vector rate and update the decimator. - @param vec_rate the new rate + + Args: + vec_rate: the new rate """ self._vec_rate = vec_rate self._update_decimator() @@ -66,7 +72,9 @@ class stream_to_vector_decimator(gr.hier_block2): def set_decimation(self, decim): """ Set the decimation parameter directly. - @param decim the new decimation + + Args: + decim: the new decimation """ self._decim = max(1, int(round(decim))) self.one_in_n.set_n(self._decim) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py index d1cbcf9127..fe4fdd1a6a 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py @@ -31,10 +31,9 @@ class wfm_rcv(gr.hier_block2): The input is the downconverted complex baseband signal (gr_complex). The output is the demodulated audio (float). - @param quad_rate: input sample rate of complex baseband input. - @type quad_rate: float - @param audio_decimation: how much to decimate quad_rate to get to audio. - @type audio_decimation: integer + Args: + quad_rate: input sample rate of complex baseband input. (float) + audio_decimation: how much to decimate quad_rate to get to audio. (integer) """ gr.hier_block2.__init__(self, "wfm_rcv", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py index e229bcc2e6..24c710a494 100755 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py @@ -32,10 +32,9 @@ class wfm_rcv_fmdet(gr.hier_block2): (gr_complex). The output is two streams of the demodulated audio (float) 0=Left, 1=Right. - @param demod_rate: input sample rate of complex baseband input. - @type demod_rate: float - @param audio_decimation: how much to decimate demod_rate to get to audio. - @type audio_decimation: integer + Args: + demod_rate: input sample rate of complex baseband input. (float) + audio_decimation: how much to decimate demod_rate to get to audio. (integer) """ gr.hier_block2.__init__(self, "wfm_rcv_fmdet", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py index d4ce6d2231..0b8706bf27 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py @@ -31,10 +31,9 @@ class wfm_rcv_pll(gr.hier_block2): The input is the downconverted complex baseband signal (gr_complex). The output is two streams of the demodulated audio (float) 0=Left, 1=Right. - @param demod_rate: input sample rate of complex baseband input. - @type demod_rate: float - @param audio_decimation: how much to decimate demod_rate to get to audio. - @type audio_decimation: integer + Args: + demod_rate: input sample rate of complex baseband input. (float) + audio_decimation: how much to decimate demod_rate to get to audio. (integer) """ gr.hier_block2.__init__(self, "wfm_rcv_pll", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py index 3fcf98f891..e7547d6524 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py @@ -31,14 +31,11 @@ class wfm_tx(gr.hier_block2): Takes a single float input stream of audio samples in the range [-1,+1] and produces a single FM modulated complex baseband output. - @param audio_rate: sample rate of audio stream, >= 16k - @type audio_rate: integer - @param quad_rate: sample rate of output stream - @type quad_rate: integer - @param tau: preemphasis time constant (default 75e-6) - @type tau: float - @param max_dev: maximum deviation in Hz (default 75e3) - @type max_dev: float + Args: + audio_rate: sample rate of audio stream, >= 16k (integer) + quad_rate: sample rate of output stream (integer) + tau: preemphasis time constant (default 75e-6) (float) + max_dev: maximum deviation in Hz (default 75e3) (float) quad_rate must be an integer multiple of audio_rate. """ diff --git a/gnuradio-core/src/python/gnuradio/eng_notation.py b/gnuradio-core/src/python/gnuradio/eng_notation.py index c552a45f55..d23f9005f0 100644 --- a/gnuradio-core/src/python/gnuradio/eng_notation.py +++ b/gnuradio-core/src/python/gnuradio/eng_notation.py @@ -18,6 +18,9 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # +""" +Display numbers as strings using engineering notation. +""" scale_factor = {} scale_factor['E'] = 1e18 diff --git a/gnuradio-core/src/python/gnuradio/eng_option.py b/gnuradio-core/src/python/gnuradio/eng_option.py index 02e9b0b6df..5d8660f0f2 100644 --- a/gnuradio-core/src/python/gnuradio/eng_option.py +++ b/gnuradio-core/src/python/gnuradio/eng_option.py @@ -43,7 +43,8 @@ def check_subdev (option, opt, value): """ Value has the form: (A|B)(:0|1)? - @returns a 2-tuple (0|1, 0|1) + Returns: + a 2-tuple (0|1, 0|1) """ d = { 'A' : (0, 0), 'A:0' : (0, 0), 'A:1' : (0, 1), 'A:2' : (0, 2), 'B' : (1, 0), 'B:0' : (1, 0), 'B:1' : (1, 1), 'B:2' : (1, 2) } diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py index 602d1119fb..525c06cf5d 100644 --- a/gnuradio-core/src/python/gnuradio/gr/__init__.py +++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py @@ -21,6 +21,10 @@ # The presence of this file turns this directory into a Python package +""" +Core contents. +""" + # This is the main GNU Radio python module. # We pull the swig output and the other modules into the gnuradio.gr namespace diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py index 0c45f1691d..bf7f26794f 100644 --- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py @@ -31,7 +31,9 @@ from gnuradio_core import hier_block2_swig # class hier_block2(object): """ - Python wrapper around the C++ hierarchical block implementation. + Subclass this to create a python hierarchical block. + + This is a python wrapper around the C++ hierarchical block implementation. Provides convenience functions and allows proper Python subclassing. """ diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py index ec9e844f6a..2d315a2780 100644 --- a/gnuradio-core/src/python/gnuradio/gr/top_block.py +++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py @@ -85,6 +85,12 @@ class _top_block_waiter(_threading.Thread): # method in gr_top_block # class top_block(object): + """ + Top-level hierarchical block representing a flow-graph. + + This is a python wrapper around the C++ implementation to allow + python subclassing. + """ def __init__(self, name="top_block"): self._tb = top_block_swig(name) diff --git a/gnuradio-core/src/python/gnuradio/gr_unittest.py b/gnuradio-core/src/python/gnuradio/gr_unittest.py index e4510a6eb9..c729566e88 100755 --- a/gnuradio-core/src/python/gnuradio/gr_unittest.py +++ b/gnuradio-core/src/python/gnuradio/gr_unittest.py @@ -19,6 +19,9 @@ # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # +""" +GNU radio specific extension of unittest. +""" import unittest import gr_xmlrunner diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py index 329fd2ed3d..489b6ab255 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py +++ b/gnuradio-core/src/python/gnuradio/gruimpl/socket_stuff.py @@ -27,9 +27,12 @@ import sys def tcp_connect_or_die(sock_addr): """ - @param sock_addr: (host, port) to connect to - @type sock_addr: tuple - @returns: socket or exits + + Args: + sock_addr: (host, port) to connect to (tuple) + + Returns: + : socket or exits """ s = socket.socket (socket.AF_INET, socket.SOCK_STREAM) try: @@ -42,9 +45,12 @@ def tcp_connect_or_die(sock_addr): def udp_connect_or_die(sock_addr): """ - @param sock_addr: (host, port) to connect to - @type sock_addr: tuple - @returns: socket or exits + + Args: + sock_addr: (host, port) to connect to (tuple) + + Returns: + : socket or exits """ s = socket.socket (socket.AF_INET, socket.SOCK_DGRAM) try: diff --git a/gnuradio-core/src/python/gnuradio/optfir.py b/gnuradio-core/src/python/gnuradio/optfir.py index bbf9ead747..bbd48dae75 100644 --- a/gnuradio-core/src/python/gnuradio/optfir.py +++ b/gnuradio-core/src/python/gnuradio/optfir.py @@ -32,18 +32,20 @@ from gnuradio import gr remez = gr.remez -# ---------------------------------------------------------------- - -## Builds a low pass filter. -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq1 End of pass band (in Hz) -# @param freq2 Start of stop band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) def low_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db, nextra_taps=2): + """ + Builds a low pass filter. + + Args: + gain: Filter gain in the passband (linear) + Fs: Sampling rate (sps) + freq1: End of pass band (in Hz) + freq2: Start of stop band (in Hz) + passband_ripple_db: Pass band ripple in dB (should be small, < 1) + stopband_atten_db: Stop band attenuation in dB (should be large, >= 60) + nextra_taps: Extra taps to use in the filter (default=2) + """ passband_dev = passband_ripple_to_dev (passband_ripple_db) stopband_dev = stopband_atten_to_dev (stopband_atten_db) desired_ampls = (gain, 0) @@ -53,19 +55,23 @@ def low_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db, taps = gr.remez (n + nextra_taps, fo, ao, w, "bandpass") return taps -## Builds a band pass filter. -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq_sb1 End of stop band (in Hz) -# @param freq_pb1 Start of pass band (in Hz) -# @param freq_pb2 End of pass band (in Hz) -# @param freq_sb2 Start of stop band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) def band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, passband_ripple_db, stopband_atten_db, nextra_taps=2): + """ + Builds a band pass filter. + + Args: + gain: Filter gain in the passband (linear) + Fs: Sampling rate (sps) + freq_sb1: End of stop band (in Hz) + freq_pb1: Start of pass band (in Hz) + freq_pb2: End of pass band (in Hz) + freq_sb2: Start of stop band (in Hz) + passband_ripple_db: Pass band ripple in dB (should be small, < 1) + stopband_atten_db: Stop band attenuation in dB (should be large, >= 60) + nextra_taps: Extra taps to use in the filter (default=2) + """ passband_dev = passband_ripple_to_dev (passband_ripple_db) stopband_dev = stopband_atten_to_dev (stopband_atten_db) desired_ampls = (0, gain, 0) @@ -78,20 +84,24 @@ def band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, return taps -## Builds a band pass filter with complex taps by making an LPF and -# spinning it up to the right center frequency -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq_sb1 End of stop band (in Hz) -# @param freq_pb1 Start of pass band (in Hz) -# @param freq_pb2 End of pass band (in Hz) -# @param freq_sb2 Start of stop band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, passband_ripple_db, stopband_atten_db, nextra_taps=2): + """ + Builds a band pass filter with complex taps by making an LPF and + spinning it up to the right center frequency + + Args: + gain: Filter gain in the passband (linear) + Fs: Sampling rate (sps) + freq_sb1: End of stop band (in Hz) + freq_pb1: Start of pass band (in Hz) + freq_pb2: End of pass band (in Hz) + freq_sb2: Start of stop band (in Hz) + passband_ripple_db: Pass band ripple in dB (should be small, < 1) + stopband_atten_db: Stop band attenuation in dB (should be large, >= 60) + nextra_taps: Extra taps to use in the filter (default=2) + """ center_freq = (freq_pb2 + freq_pb1) / 2.0 lp_pb = (freq_pb2 - center_freq)/1.0 lp_sb = freq_sb2 - center_freq @@ -102,20 +112,24 @@ def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2, return taps -## Builds a band reject filter -# spinning it up to the right center frequency -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq_pb1 End of pass band (in Hz) -# @param freq_sb1 Start of stop band (in Hz) -# @param freq_sb2 End of stop band (in Hz) -# @param freq_pb2 Start of pass band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) def band_reject (gain, Fs, freq_pb1, freq_sb1, freq_sb2, freq_pb2, passband_ripple_db, stopband_atten_db, nextra_taps=2): + """ + Builds a band reject filter + spinning it up to the right center frequency + + Args: + gain: Filter gain in the passband (linear) + Fs: Sampling rate (sps) + freq_pb1: End of pass band (in Hz) + freq_sb1: Start of stop band (in Hz) + freq_sb2: End of stop band (in Hz) + freq_pb2: Start of pass band (in Hz) + passband_ripple_db: Pass band ripple in dB (should be small, < 1) + stopband_atten_db: Stop band attenuation in dB (should be large, >= 60) + nextra_taps: Extra taps to use in the filter (default=2) + """ passband_dev = passband_ripple_to_dev (passband_ripple_db) stopband_dev = stopband_atten_to_dev (stopband_atten_db) desired_ampls = (gain, 0, gain) @@ -131,16 +145,20 @@ def band_reject (gain, Fs, freq_pb1, freq_sb1, freq_sb2, freq_pb2, return taps -## Builds a high pass filter. -# @param gain Filter gain in the passband (linear) -# @param Fs Sampling rate (sps) -# @param freq1 End of stop band (in Hz) -# @param freq2 Start of pass band (in Hz) -# @param passband_ripple_db Pass band ripple in dB (should be small, < 1) -# @param stopband_atten_db Stop band attenuation in dB (should be large, >= 60) -# @param nextra_taps Extra taps to use in the filter (default=2) def high_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db, nextra_taps=2): + """ + Builds a high pass filter. + + Args: + gain: Filter gain in the passband (linear) + Fs: Sampling rate (sps) + freq1: End of stop band (in Hz) + freq2: Start of pass band (in Hz) + passband_ripple_db: Pass band ripple in dB (should be small, < 1) + stopband_atten_db: Stop band attenuation in dB (should be large, >= 60) + nextra_taps: Extra taps to use in the filter (default=2) + """ passband_dev = passband_ripple_to_dev (passband_ripple_db) stopband_dev = stopband_atten_to_dev (stopband_atten_db) desired_ampls = (0, 1) |