MultiFilter¶
- class sofia_redux.scan.filters.multi_filter.MultiFilter(integration=None, data=None)[source]¶
Bases:
VariedFilter
Initialize an integration multi-filter.
The multi-filter contains multiple sub-filters that operate on an integration in sequence.
- Parameters:
- integrationIntegration, optional
- datanumpy.ndarray (float), optional
An array of shape (nt, n_channels) where nt is the nearest power of 2 integer above the number of integration frames. i.e., if n_frames=5, nt=8, or if n_frames=13, nt=16. If not provided will be set to frame_data * frame_relative_weight.
Attributes Summary
Return the number of sub-filters in the multi-filter.
Methods Summary
add_filter
(sub_filter)Add a sub-filter to the list of filters in the multi-filter.
copy
()Return a copy of the filter.
dft_filter
([channels])Return the filter rejection using a discrete FFT.
fft_filter
([channels])Apply the FFT filter to the temporary data.
Return the configuration name.
Return all sub-filters of the multi-filter.
get_id
()Return the filter ID.
Return whether the filter is enabled.
Perform the post-filtering steps.
Perform the pre-filtering steps.
reindex
()Reindex the channel groups to be consistent with parent channels.
remove_filter
(filter_or_name)Remove a sub-filter from the list of multi-filter sub-filters.
response_at
(fch)Return the response at a given frequency channel(s).
set_channels
(channels)Set the filter channels.
set_filter
(filter_index, sub_filter)Insert a sub-filter into the list of filters in the multi-filter.
set_integration
(integration)Set the filter integration.
Determine whether the filter is configuration and if it's pedantic.
Attributes Documentation
- size¶
Return the number of sub-filters in the multi-filter.
- Returns:
- n_filtersint
Methods Documentation
- add_filter(sub_filter)[source]¶
Add a sub-filter to the list of filters in the multi-filter.
The sub-filter integration is set to the multi-filter integration. If an integration already exists for the sub-filter, it must be the same as the multi-filter integration. The sub-filter channels are also set to the multi-filter channels.
- Parameters:
- sub_filterFilter
The filter to add.
- Returns:
- None
- copy()[source]¶
Return a copy of the filter.
All attributes are copied aside from the integration and channels which are referenced only.
- Returns:
- Filter
- dft_filter(channels=None)[source]¶
Return the filter rejection using a discrete FFT.
UNSUPPORTED FOR THE MULTI-FILTER.
- Parameters:
- channelsChannelGroup, optional
The channel group for which the filtering applied. By default, set to the filtering channels.
- Returns:
- None
- fft_filter(channels=None)[source]¶
Apply the FFT filter to the temporary data.
Converts data into a rejected (un-levelled) signal
- Parameters:
- channelsChannelGroup, optional
The channels for which to apply the filter. If not supplied, defaults to the stored filtering channels.
- Returns:
- None
- is_enabled()[source]¶
Return whether the filter is enabled.
In addition to the multi-filter being enabled, a
True
result requires that at least one sub-filter is also enabled.- Returns:
- bool
- post_filter()[source]¶
Perform the post-filtering steps.
The post-filtering is also performed for all enabled sub-filters.
- Returns:
- None
- pre_filter()[source]¶
Perform the pre-filtering steps.
The pre-filtering is also performed for all enabled sub-filters.
- Returns:
- None
- reindex()[source]¶
Reindex the channel groups to be consistent with parent channels.
In addition to the main multi-filter, all sub-filters are re-indexed too.
- Returns:
- None
- remove_filter(filter_or_name)[source]¶
Remove a sub-filter from the list of multi-filter sub-filters.
- Parameters:
- filter_or_nameFilter or str or int
A filter object or class or name or filter index of the filter to retrieve.
- Returns:
- None
- response_at(fch)[source]¶
Return the response at a given frequency channel(s).
- Parameters:
- fchint or numpy.ndarray (int or bool) or slice
The frequency channel or channels in question.
- Returns:
- responsefloat or numpy.ndarray (float)
- set_channels(channels)[source]¶
Set the filter channels.
The channels attribute will be set to a ChannelGroup type.
- Parameters:
- channelsChannels or ChannelData or ChannelGroup
- Returns:
- None
- set_filter(filter_index, sub_filter)[source]¶
Insert a sub-filter into the list of filters in the multi-filter.
The sub-filter integration is set to the multi-filter integration. If an integration already exists for the sub-filter, it must be the same as the multi-filter integration. The sub-filter channels are also set to the multi-filter channels.
If the filter index is greater than the number of filters, pads the filters list with
None
until the length of the filters is able to support the requested index.- Parameters:
- filter_indexint
The index at which to insert the sub-filter.
- sub_filterFilter
The filter to insert.
- Returns:
- None