NuRadioReco.modules.channelCWNotchFilter module
- NuRadioReco.modules.channelCWNotchFilter.find_frequency_peaks_from_trace(trace: ndarray, fs: float, threshold: float = 4)[source]
Function fo find the frequency peaks in the real fourier transform of the input trace.
- Parameters:
- tracenp.ndarray
Waveform
- fsfloat
Sampling frequency, (input should be taking from the channel object)
- thresholdfloat, default = 4
Threshold for peak definition. A peak is defined as a point in the frequency spectrum that exceeds threshold * rms(real fourier transform)
- Returns:
- freq_peaksnp.ndarray
Frequencies at which a peak was found
- NuRadioReco.modules.channelCWNotchFilter.find_frequency_peaks(freq: ndarray, spectrum: ndarray, threshold: float = 4)[source]
Function fo find the frequency peaks in the real fourier transform of the input trace.
- Parameters:
- freqnp.ndarray
Frequencies of a NuRadio time trace
- spectrumnp.ndarray
Spectrum of a NuRadio time trace
- thresholdfloat, default = 4
Threshold for peak definition. A peak is defined as a point in the frequency spectrum that exceeds threshold * rms(real fourier transform)
- Returns:
- freqnp.ndarray
Frequencies at which a peak was found
- NuRadioReco.modules.channelCWNotchFilter.get_filter(freq: int, fs, quality_factor=1000.0, cache=None)[source]
Function to get single notch filter for a given frequency.
- Parameters:
- freqnp.ndarray
Frequency
- fsfloat,
sampling frequency in MHz
- quality_factorint, default = 1000
quality factor of the notch filter, defined as the ratio f0/bw, where f0 is the centre frequency and bw the bandwidth of the filter at (f0,-3 dB)
- cachedict, default = None,
Optional caching dictionary. The function will check whether the frequency to be filtered is in the dictionary values and will otherwise add it !!! Note this does not cache the quality factor information
- Returns:
- filterlist, shape (6)
second order IIR notch filter at frequency freq
- NuRadioReco.modules.channelCWNotchFilter.filter_cws(trace: ndarray, freq: ndarray, spectrum: ndarray, fs: float, quality_factor=1000.0, threshold=4, cache: Optional[dict] = None, filters: Optional[list] = None)[source]
Function that applies a notch filter at the frequency peaks of a given time trace using the scipy library
- Parameters:
- tracenp.ndarray
waveform (shape: [2048])
- freqnp.ndarray
Frequency of the trace’s real fourier transform
- spectrum:
the trace’s real fourier transform
- fsfloat
sampling frequency in MHz
- quality_factorint, default = 1000
quality factor of the notch filter, defined as the ratio f0/bw, where f0 is the centre frequency and bw the bandwidth of the filter at (f0,-3 dB)
- thresholdint, default = 4
threshold for peak definition. A peak is defined as a point in the frequency spectrum that exceeds threshold * rms(real fourier transform)
- cachedict, default = None,
Optional caching dictionary. The function will check whether the frequency to be filtered is in the dictionary values and will otherwise add it !!! Note this assumes the quality_factor is the same for all notch filters!!!
- filtersNoneType or list, default = None
Optional list to which the filters used in this function can be appended for future reference
- Returns:
- tracenp.ndarray
CW-filtered trace
- NuRadioReco.modules.channelCWNotchFilter.plot_trace(channel, ax, fs=3.2, label=None, plot_kwargs={})[source]
Function to plot trace of given channel
- Parameters:
- channelNuRadio channel class
channel from which to get trace
- axmatplotlib.axes
ax on which to plot
- fsfloat, default = 3.2 Hz
sampling frequency
- labelstring
plotlabel
- plot_kwargsdict
options for plotting
- NuRadioReco.modules.channelCWNotchFilter.plot_ft(channel, ax, label=None, plot_kwargs={})[source]
Function to plot real frequency spectrum of given channel
- Parameters:
- channelNuRadio channel class
channel from which to get trace
- axmatplotlib.axes
ax on which to plot
- labelstring
plotlabel
- plot_kwargsdict
options for plotting