diff options
Diffstat (limited to 'gnuradio-core/src/python')
16 files changed, 192 insertions, 173 deletions
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/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py index 6f7fc520fa..35a0ad7978 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py @@ -32,13 +32,15 @@ class _logpwrfft_base(gr.hier_block2): """ Create an log10(abs(fft)) stream chain. Provide access to the setting the filter and sample rate. - @param sample_rate Incoming stream sample rate - @param fft_size Number of FFT bins - @param ref_scale Sets 0 dB value input amplitude - @param frame_rate Output frame rate - @param avg_alpha FFT averaging (over time) constant [0.0-1.0] - @param average Whether to average [True, False] - @param win the window taps generation function + + Args: + sample_rate: Incoming stream sample rate + fft_size: Number of FFT bins + ref_scale: Sets 0 dB value input amplitude + frame_rate: Output frame rate + avg_alpha: FFT averaging (over time) constant [0.0-1.0] + average: Whether to average [True, False] + win: the window taps generation function """ gr.hier_block2.__init__(self, self._name, gr.io_signature(1, 1, self._item_size), # Input signature @@ -70,28 +72,36 @@ class _logpwrfft_base(gr.hier_block2): def set_decimation(self, decim): """ Set the decimation on stream decimator. - @param decim the new decimation + + Args: + decim: the new decimation """ self._sd.set_decimation(decim) def set_vec_rate(self, vec_rate): """ Set the vector rate on stream decimator. - @param vec_rate the new vector rate + + Args: + vec_rate: the new vector rate """ self._sd.set_vec_rate(vec_rate) def set_sample_rate(self, sample_rate): """ Set the new sampling rate - @param sample_rate the new rate + + Args: + sample_rate: the new rate """ self._sd.set_sample_rate(sample_rate) def set_average(self, average): """ Set the averaging filter on/off. - @param average true to set averaging on + + Args: + average: true to set averaging on """ self._average = average if self._average: @@ -102,7 +112,9 @@ class _logpwrfft_base(gr.hier_block2): def set_avg_alpha(self, avg_alpha): """ Set the average alpha and set the taps if average was on. - @param avg_alpha the new iir filter tap + + Args: + avg_alpha: the new iir filter tap """ self._avg_alpha = avg_alpha self.set_average(self._average) 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_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/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) |