MotionFilter¶
- class sofia_redux.scan.filters.motion_filter.MotionFilter(integration=None, data=None)[source]¶
Bases:
KillFilter
Initializes a motion filter.
The motion filter kills specific frequencies based on motion statistics.
- 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.
Methods Summary
add_filter
(positions, direction)Filters motion in a given direction.
Expand the kill filter based on stability.
Return the configuration name.
get_fft_rms
(fft_signal)Return the RMS of an FFT signal.
get_id
()Return the filter ID.
Kills harmonics of the rejected frequencies.
Perform the pre-filtering steps.
Applies the filter over a certain frequency range.
set_integration
(integration)Set the filter integration.
Methods Documentation
- add_filter(positions, direction)[source]¶
Filters motion in a given direction.
The FFT of the motion is calculated, and those frequencies where the power spectrum is above a certain threshold are added to a kill filter.
The cutoff threshold is given as:
threshold_rms = critical * RMS(power spectrum)
where “critical` is determined from the filter.motion.s2n configuration setting. If filter.motion.above is set, then the threshold is set to:
max(threshold_rms, max(power_spectrum * above))
- Parameters:
- positionsQuantity
An array of positions with shape (n_frames, 2)
- directionstr or int or MotionFlagTypes
The direction of motion to examine.
- Returns:
- None
- expand_filter()[source]¶
Expand the kill filter based on stability.
A number of frequency bins on either side of each rejected point will be added to the kill filter. The number of additional bins on either side is given as half_width / frequency_spacing.
- Returns:
- None
- static get_fft_rms(fft_signal)[source]¶
Return the RMS of an FFT signal.
- Parameters:
- fft_signalnumpy.ndarray (complex)
The complex signal.
- Returns:
- rmsfloat
- harmonize()[source]¶
Kills harmonics of the rejected frequencies.
The number of harmonics will be determined from the ‘filter.motion.harmonics’ configuration setting.
- Returns:
- None
- pre_filter()[source]¶
Perform the pre-filtering steps.
During the pre-filtering steps, dependents are retrieved from the filter integration and cleared (subtracted from integration dependents, integration channels, and zeroed).
- Returns:
- None
- range_check()[source]¶
Applies the filter over a certain frequency range.
The frequency range is supplied by the ‘filter.motion.range’ configuration option. All previously killed frequencies outside of this range will be allowed to pass.
- Returns:
- None
- set_integration(integration)[source]¶
Set the filter integration.
Sets the padding of the FFT filter, the number of frequencies, the frequency spacing, and retrieves the channels from the integration if necessary.
This is where the integration is examined to extract the relevant motion statistics.
- Parameters:
- integrationIntegration
- Returns:
- None