pyhiperta.integration.windowed_integration_correction¶
- pyhiperta.integration.windowed_integration_correction(ref_pulse_sample_times_ns: ndarray, ref_pulse_waveform: ndarray, integration_function: IntegrationFunctionType, nb_frames_before_max_real_data: int, nb_frames_after_max_real_data: int, real_data_sampling_period_ns: float) ndarray [source]¶
Calculate the correction to apply to compensate the bias introduced by the windowed integration of real data.
The windowed integration results are biased with respect to an integration on the total time range, because the integration window is typically shorter than the time range of the full signal (this is on purpose: the edges of the signals are cut-off because they are closer to noise level than the pulse center).
The bias introduced depends on the integration window parameters: position around maximum and range. To be able to compare integrated charge computed with different integration windows, we need to be able to correct the biases. The correction is such that correction * windowed_integration(noise_less_signal, n_slice_before, n_slice_after) = integration(noise_less_signal)
The noise less signal is called the “reference pulse” and typically provided by camera teams, it is the response of a pixel to a single photo-electron.
The waveform signals (reference pulse and real data) come as as number of p.e. at a certain time, ie it is binned number of p.e. wrt time. To compute the correction, the reference pulse is re-binned (typically it has a different bin size than real data) to real data bins which introduces a small error: the ratio between real data bins and the reference bins is not an integer, so the bins on the edge of the integration window have a signal that is a bit mixed with the neighbor’s bin (outside of the window).
- Parameters:
ref_pulse_sample_times_ns (np.ndarray) – Array containing the timestamps at which the number of photoelectrons are measured, for the reference pulse. Shape: (N_samples,)
ref_pulse_waveform (np.ndarray) – Array containing the number of photoelectrons at each timestamp, for the reference pulse. ref_pulse_waveform[0] is the reference pulse of the channel 0 (low gain) and ref_pulse_waveform[1] is the reference pulse for channel 1 (high gain) Shape: (2, N_samples)
integration_function (IntegrationFunctionType) – Function performing a window integration. It must accept the “waveform”, “nb_frames_before_max” and “nb_frames_after_max” arguments.
nb_frames_before_max_real_data (int) – Number of frames before the maximum to include in the integration window, when used with real data. The number of frames of the reference pulse to integrate will be computed based on the reference pulse sampling period and real_data_sampling_period_ns.
nb_frames_after_max_real_data (int) – Number of frames after the maximum to include in the integration window, when used with real data. The number of frames of the reference pulse to integrate will be computed based on the reference pulse sampling period and real_data_sampling_period_ns.
real_data_sampling_period_ns (float) – Sampling period (amount of time between 2 samples) of the real data, in nanoseconds.
- Returns:
Correction value for each channel such that correction * windowed_integration(noiseless_real_data) = full_integration(noiselesss_real_data) Shape: (2,)
- Return type:
np.ndarray
- Raises:
TypeError – If integration_function does not accept the expected arguments.