This is an automated email from the git hooks/post-receive script. yoh pushed a commit to tag 0.4 in repository python-mne.
commit 60d61a8d9f923b5c2d9f08d5e0cfafe180b3f095 Author: [email protected] <[email protected]> Date: Sun Jun 24 02:37:16 2012 -0400 low and high trans_bandwidth --- mne/fiff/raw.py | 18 +++++++++++------- mne/filter.py | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/mne/fiff/raw.py b/mne/fiff/raw.py index b55068f..5c5ee3e 100644 --- a/mne/fiff/raw.py +++ b/mne/fiff/raw.py @@ -363,7 +363,8 @@ class Raw(object): self.apply_function(hilbert, picks, np.complex64, n_jobs, verbose) def filter(self, l_freq, h_freq, picks=None, filter_length=None, - trans_bw=0.5, n_jobs=1, verbose=5): + l_trans_bandwidth=0.5, h_trans_bandwidth=0.5, n_jobs=1, + verbose=5): """Filter a subset of channels. Applies a zero-phase band-pass filter to the channels selected by @@ -392,11 +393,12 @@ class Raw(object): (n_times: number of timepoints in Raw object) the filter length used is n_times. Otherwise, overlap-add filtering with a filter of the specified length is used (faster for long signals). - trans_bw : float - Width of the transition band in Hz. + l_trans_bandwidth : float + Width of the transition band at the low cut-off frequency in Hz. + h_trans_bandwidth : float + Width of the transition band at the high cut-off frequency in Hz. n_jobs: int (default: 1) Number of jobs to run in parallel. - verbose: int (default: 5) Verbosity level. """ @@ -410,15 +412,17 @@ class Raw(object): if l_freq is None and h_freq is not None: self.apply_function(low_pass_filter, picks, None, n_jobs, verbose, fs, h_freq, filter_length=filter_length, - trans_bw=trans_bw) + trans_bandwidth=l_trans_bandwidth) if l_freq is not None and h_freq is None: self.apply_function(high_pass_filter, picks, None, n_jobs, verbose, fs, l_freq, filter_length=filter_length, - trans_bw=trans_bw) + trans_bandwidth=h_trans_bandwidth) if l_freq is not None and h_freq is not None: self.apply_function(band_pass_filter, picks, None, n_jobs, verbose, fs, l_freq, h_freq, - filter_length=filter_length, trans_bw=trans_bw) + filter_length=filter_length, + l_trans_bandwidth=l_trans_bandwidth, + h_trans_bandwidth=h_trans_bandwidth) @deprecated('band_pass_filter is deprecated please use raw.filter instead') def band_pass_filter(self, picks, l_freq, h_freq, filter_length=None, diff --git a/mne/filter.py b/mne/filter.py index 0246fab..55f82a4 100644 --- a/mne/filter.py +++ b/mne/filter.py @@ -235,7 +235,8 @@ def _filter(x, Fs, freq, gain, filter_length=None): return xf -def band_pass_filter(x, Fs, Fp1, Fp2, filter_length=None, trans_bw=0.5): +def band_pass_filter(x, Fs, Fp1, Fp2, filter_length=None, + l_trans_bandwidth=0.5, h_trans_bandwidth=0.5): """Bandpass filter for the signal x. Applies a zero-phase bandpass filter to the signal x. @@ -254,8 +255,10 @@ def band_pass_filter(x, Fs, Fp1, Fp2, filter_length=None, trans_bw=0.5): Length of the filter to use. If None or "len(x) < filter_length", the filter length used is len(x). Otherwise, overlap-add filtering with a filter of the specified length is used (faster for long signals). - trans_bw : float - Width of the transition band in Hz. + l_trans_bandwidth : float + Width of the transition band at the low cut-off frequency in Hz. + h_trans_bandwidth : float + Width of the transition band at the high cut-off frequency in Hz. Returns ------- @@ -264,7 +267,7 @@ def band_pass_filter(x, Fs, Fp1, Fp2, filter_length=None, trans_bw=0.5): Notes ----- - The passbands (Fp1 Fp2) frequencies are defined in Hz as + The frequency response is (approximately) given by ---------- /| | \ / | | \ @@ -275,20 +278,20 @@ def band_pass_filter(x, Fs, Fp1, Fp2, filter_length=None, trans_bw=0.5): Fs1 Fp1 Fp2 Fs2 Where - Fs1 = Fp1 - trans_bw in Hz - Fs2 = Fp2 + trans_bw in Hz + Fs1 = Fp1 - l_trans_bandwidth in Hz + Fs2 = Fp2 + h_trans_bandwidth in Hz """ Fs = float(Fs) Fp1 = float(Fp1) Fp2 = float(Fp2) - Fs1 = Fp1 - trans_bw - Fs2 = Fp2 + trans_bw + Fs1 = Fp1 - l_trans_bandwidth + Fs2 = Fp2 + h_trans_bandwidth if Fs1 <= 0: raise ValueError('Filter specification invalid: Lower stop frequency ' 'too low (%0.1fHz). Increase Fp1 or reduce ' - 'transition bandwidth (trans_bw)' % Fs1) + 'transition bandwidth (l_trans_bandwidth)' % Fs1) xf = _filter(x, Fs, [0, Fs1, Fp1, Fp2, Fs2, Fs / 2], [0, 0, 1, 1, 0, 0], filter_length) @@ -296,7 +299,7 @@ def band_pass_filter(x, Fs, Fp1, Fp2, filter_length=None, trans_bw=0.5): return xf -def low_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): +def low_pass_filter(x, Fs, Fp, filter_length=None, trans_bandwidth=0.5): """Lowpass filter for the signal x. Applies a zero-phase lowpass filter to the signal x. @@ -313,7 +316,7 @@ def low_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): Length of the filter to use. If None or "len(x) < filter_length", the filter length used is len(x). Otherwise, overlap-add filtering with a filter of the specified length is used (faster for long signals). - trans_bw : float + trans_bandwidth : float Width of the transition band in Hz. Returns @@ -323,7 +326,7 @@ def low_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): Notes ----- - The passbands (Fp1 Fp2) frequencies are defined in Hz as + The frequency response is (approximately) given by ------------------------- | \ | \ @@ -331,20 +334,20 @@ def low_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): | \ | ----------------- | - Fp Fp+trans_bw + Fp Fp+trans_bandwidth """ Fs = float(Fs) Fp = float(Fp) - Fstop = Fp + trans_bw + Fstop = Fp + trans_bandwidth xf = _filter(x, Fs, [0, Fp, Fstop, Fs / 2], [1, 1, 0, 0], filter_length) return xf -def high_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): +def high_pass_filter(x, Fs, Fp, filter_length=None, trans_bandwidth=0.5): """Highpass filter for the signal x. Applies a zero-phase highpass filter to the signal x. @@ -361,7 +364,7 @@ def high_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): Length of the filter to use. If None or "len(x) < filter_length", the filter length used is len(x). Otherwise, overlap-add filtering with a filter of the specified length is used (faster for long signals). - trans_bw : float + trans_bandwidth : float Width of the transition band in Hz. Returns @@ -371,7 +374,7 @@ def high_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): Notes ----- - The passbands (Fp1 Fp2) frequencies are defined in Hz as + The frequency response is (approximately) given by ----------------------- /| / | @@ -379,18 +382,19 @@ def high_pass_filter(x, Fs, Fp, filter_length=None, trans_bw=0.5): / | ---------- | | - Fp-trans_bw Fp + Fstop Fp + where Fstop = Fp - trans_bandwidth """ Fs = float(Fs) Fp = float(Fp) - Fstop = Fp - trans_bw + Fstop = Fp - trans_bandwidth if Fstop <= 0: raise ValueError('Filter specification invalid: Stop frequency too low' '(%0.1fHz). Increase Fp or reduce transition ' - 'bandwidth (trans_bw)' % Fstop) + 'bandwidth (trans_bandwidth)' % Fstop) xf = _filter(x, Fs, [0, Fstop, Fp, Fs / 2], [0, 0, 1, 1], filter_length) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
