cait.filter¶
-
cait.filter.box_car_smoothing(event, length=50)[source]¶ Calculates a moving average on an event array and returns the smoothed event
- Parameters
event – 1D array, the event to calcualte the MA
length – the length of the moving average
- Returns
1D array the smoothed array
-
cait.filter.filter_event(event, transfer_function, window=False)[source]¶ this function filters a single event
- Parameters
event – 1D array of the one event that should be filtered, size N
transfer_function – the filter in fourier space, size N/2 +1 complex numpy array
window – bool, if activated the array is multiplied with a window function befor filtering
- Returns
1D array length N, the filtered event
-
cait.filter.get_amplitudes(events_array, stdevent, nps, hard_restrict=False, down=1, window=False, peakpos=None, return_peakpos=False, flexibility=20)[source]¶ This function determines the amplitudes of several events with optimal sig-noise-ratio.
- Parameters
events_array – 2D array (nmbr_events, rec_length), the events to determine ph
stdevent – 1D array, the standardevent
nps – 1D array, length N/2 + 1, the noise power spectrum
hard_restrict – bool, The maximum search is restricted to 20-30% of the record window.
down – int, a factor by which the events and filter is downsampled before application
window – bool, if activated the array is multiplied with a window function befor filtering
peakpos – array of length nmbr_events,
return_peakpos – bool, if true a second array is returned, namely the peak positions within the arrays
flexibility – int, in case a peak position is provided, the maximum search can still deviate by this amount of samples
- Returns
1D array size (nmbr_events), the phs after of filtering; if return_peakpos is true, this is instead a 2-tuple of the of_ph and the maximum positions
-
cait.filter.normalization_constant(stdevent, nps)[source]¶ this function is needed as utility for the function optimal_transition_function and calculates the normalization constant s.t. the Variance of an event is preserved Remark: We do not use this function, as we want to preserve the height of a peak and not the RMS.
- Parameters
stdevent – 1D array of the standardevent with length N
nps – 1D array of the noise power spectrum with length N/2 + 1
- Returns
integer, the normalization constant
-
cait.filter.optimal_transfer_function(stdevent, nps, window=True)[source]¶ This function calculates the transition function for an optimal filter.
- Parameters
stdevent – 1D array, pulse shape standard event with length N
nps – 1D array, the NPS of a baseline, with length N/2 + 1
window – bool, include a window function to the standard event
- Returns
1D complex numpy array of length N/2 + 1, the optimal transfer function