sage.dsp.filters
Filename : filters.py Description : Short description of the file
Created on 2025-12-12 15:44:50
__author__ = Narenraju Nagarajan __copyright__ = Copyright 2025, ProjectName __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __affiliation__ = N/A __email__ = N/A __status__ = [‘inProgress’, ‘Archived’, ‘inUsage’, ‘Debugging’]
GitHub Repository: NULL
Documentation: NULL
Attributes
Functions
|
Resample and high-pass filter a strain time series via PyCBC. |
|
Robust zero-phase highpass using Butterworth SOS + filtfilt-like forward-backward. |
Module Contents
- pycbc_downsample(strain, old_sample_rate, new_sample_rate=2048.0, trim=0.2, noise_low_freq_cutoff=15.0)[source]
Resample and high-pass filter a strain time series via PyCBC.
Downsamples
strainfromold_sample_ratetonew_sample_rateusing PyCBC’s polyphase resampler, applies a high-pass filter atnoise_low_freq_cutoff, converts to float32, and trims edge corruption introduced by the resampler.- Parameters:
strain (array-like, shape
(N,)) – Input time series atold_sample_rate.old_sample_rate (float) – Original sample rate in Hz.
new_sample_rate (float) – Target sample rate in Hz (default
2048.0).trim (float) – Edge corruption to remove from each side in seconds (default
0.2).noise_low_freq_cutoff (float) – High-pass cutoff frequency in Hz (default
15.0).
- Returns:
Resampled and filtered strain with edges trimmed.
- Return type:
numpy.ndarray, dtype float32
- highpass(x, fs, cutoff=15.0, order=4, padlen_seconds=2.0, pad_type='reflect', fallback_to_sos=False)[source]
Robust zero-phase highpass using Butterworth SOS + filtfilt-like forward-backward. NOTE: Padding reduces edge effects
- Parameters:
x (array) – 1D time series (float).
fs (float) – sampling rate (Hz).
cutoff (float) – cutoff frequency (Hz).
order (int) – nominal Butterworth order (sos built from order).
padlen_seconds (float) – pad length in seconds (mirror padding)
pad_type – ‘reflect’ or ‘odd’ or ‘constant’ (prefer ‘reflect’).
fallback_to_sos – if True and sosfiltfilt fails, do sosfilt (causal).
- Returns:
filtered 1D array same length as input.
- Return type:
y (np.ndarray)