NaivePoisson¶
- class gdt.core.background.unbinned.NaivePoisson(times)[source]¶
Bases:
objectA class to estimate the background of unbinned data using the naive Poisson maximum likelihood.
This method is approximately equivalent to sliding a window of fixed length through unbinned data and calculating the Poisson maximum likelihood for the rate. The rate estimate is applied to the center of the sliding window, therefore, the amount of data equivalent to half of the sliding window at the beginning and half of the window at the end of the data is a constant.
Note
This naive approach assumes there is either no strong signal in the data, or the presence of a weaker signal has a duration much less than the window width of the sliding window.
- Parameters:
counts (list of np.array) – A list of length
num_chans, and each element of the list is an array of event times in that channel.
Methods Summary
fit([window_width, fast])Fit the data via Naive Poisson Maximum Likelihood.
interpolate(tstart, tstop)Interpolate the background at the given times
Methods Documentation
- fit(window_width=100.0, fast=True)[source]¶
Fit the data via Naive Poisson Maximum Likelihood.
- Parameters:
window_width (float) –
The width of the sliding window in seconds.
Note
If the range of the data is shorter than
window_width, thewindow_widthwill automatically be shortened to the range of the data.fast (bool) – If True, then will use the fast approximation of the algorithm that allows the
window_widthto change throughout the data (the number of counts in the window is constant). If False, uses the exact algorithm with a fixed window, but is much slower.
- interpolate(tstart, tstop)[source]¶
Interpolate the background at the given times
- Parameters:
tstart (np.array) – The start times of the bins to interpolate
tstop (np.array) – The end times of the bins to interpolate
- Returns:
(np.array, np.array) – The interpolated model value and model uncertainty in each bin