utils.condition_filter#
Back to Module page
Summary#
Compute support, weight, and truncate input frequency domain filter
Signature#
def condition_filter(filt, support = None, truncate = False, shorten = False, taper = False, notch_pars = None, flen = None, wfac = params.WFAC_FILT, in_domain = 'fd', out_domain = 'fd', def_fftsize = params.DEF_FFTSIZE, taper_fraction = 0.2, min_trunc_len = 2)
Name |
Type |
Default |
Description |
|---|---|---|---|
|
If in_domain is ‘fd’: Complex array of length nrfft(len(data)) with RFFT of {whitening filter with time domain weight at the edges} else: Real array of length len(data) with whitening filter with time domain weight at the edges |
||
|
None |
Support to truncate at (in indices). If None, it is calculated from the filter itself |
|
|
False |
Flag whether to truncate the time-domain support of the filter |
|
|
False |
Flag whether to shorten the time-domain length of the filter |
|
|
False |
Flag whether to taper the time domain response of the filter with a Tukey window. Applied after truncating if truncate==True, else on the entire length |
|
|
None |
Optional parameters of notches to apply, output of notch_filter_sos |
|
|
None |
Total length of filter in time domain (zero-padded in frequency domain if needed) |
|
|
params.WFAC_FILT |
(1 - Weight of the filter to capture)/2 |
|
|
‘fd’ |
Domain of input (‘fd’ or ‘td’) |
|
|
‘fd’ |
Domain of output (‘fd’ or ‘td’) |
|
|
params.DEF_FFTSIZE |
Default fftsize, one of the limits for the time domain length of the output |
|
|
0.2 |
Fraction of response to taper with a Tukey window, if applicable (0 is boxcar, 1 is Hann) |
|
|
2 |
minimum N_samples//2 after truncation |
Output variables#
Return annotation |
Docstring type |
Description |
|---|---|---|
|
|
Docstring#
Compute support, weight, and truncate input frequency domain filter
:param filt:
If in_domain is 'fd':
Complex array of length nrfft(len(data)) with RFFT of
{whitening filter with time domain weight at the edges}
else:
Real array of length len(data) with whitening filter with time
domain weight at the edges
:param support:
Support to truncate at (in indices). If None, it is calculated from the
filter itself
:param truncate:
Flag whether to truncate the time-domain support of the filter
:param shorten:
Flag whether to shorten the time-domain length of the filter
:param taper:
Flag whether to taper the time domain response of the filter with a
Tukey window. Applied after truncating if truncate==True, else on the
entire length
:param notch_pars:
Optional parameters of notches to apply, output of notch_filter_sos
:param flen:
Total length of filter in time domain (zero-padded in frequency domain
if needed)
:param wfac: (1 - Weight of the filter to capture)/2
:param in_domain: Domain of input ('fd' or 'td')
:param out_domain: Domain of output ('fd' or 'td')
:param def_fftsize:
Default fftsize, one of the limits for the time domain length of the
output
:param taper_fraction:
Fraction of response to taper with a Tukey window, if applicable
(0 is boxcar, 1 is Hann)
:param min_trunc_len: minimum N_samples//2 after truncation
:return: 1. If out_domain is 'fd':
Complex array of the same size as filt with RFFT of
conditioned filter
else:
Real array of the same size as filt with conditioned filter
2. Support of filter (TD filter has 2 * support - 1 nonzero coeffs)
3. Total weight of filter (sum w(t)^2)