threeML.utils.time_series package¶
Submodules¶
threeML.utils.time_series.binned_spectrum_series module¶
-
class
threeML.utils.time_series.binned_spectrum_series.
BinnedSpectrumSeries
(binned_spectrum_set, first_channel=1, ra=None, dec=None, mission=None, instrument=None, verbose=True)[source]¶ Bases:
threeML.utils.time_series.time_series.TimeSeries
-
property
binned_spectrum_set
¶ returns the spectrum set :return: binned_spectrum_set
-
property
bins
¶ the time bins of the spectrum set :return: TimeIntervalSet
-
count_per_channel_over_interval
(start, stop)[source]¶ return the number of counts in the selected interval :param start: start of interval :param stop: stop of interval :return:
-
counts_over_interval
(start, stop)[source]¶ return the number of counts in the selected interval :param start: start of interval :param stop: stop of interval :return:
-
exposure_over_interval
(start, stop)[source]¶ calculate the exposure over the given interval
- Parameters
start – start time
stop – stop time
- Returns
-
property
threeML.utils.time_series.event_list module¶
-
class
threeML.utils.time_series.event_list.
EventList
(arrival_times, measurement, n_channels, start_time=None, stop_time=None, native_quality=None, first_channel=0, ra=None, dec=None, mission=None, instrument=None, verbose=True, edges=None)[source]¶ Bases:
threeML.utils.time_series.time_series.TimeSeries
-
property
arrival_times
¶
-
bin_by_constant
(start, stop, dt=1)[source]¶ Interface to the temporal binner’s constant binning mode
- Parameters
start – start time of the bins
stop – stop time of the bins
dt – temporal spacing of the bins
- Returns
-
bin_by_custom
(start, stop)[source]¶ Interface to temporal binner’s custom bin mode
- Parameters
start – start times of the bins
stop – stop times of the bins
- Returns
-
bin_by_significance
(start, stop, sigma, mask=None, min_counts=1)[source]¶ Interface to the temporal binner’s significance binning model
- param start
start of the interval to bin on
- param stop
stop of the interval ot bin on
- param sigma
sigma-level of the bins
- param mask
(bool) use the energy mask to decide on ,significance
- param min_counts
minimum number of counts per bin
- return
-
property
bins
¶
-
counts_over_interval
(start, stop)[source]¶ return the number of counts in the selected interval :param start: start of interval :param stop: stop of interval :return:
-
property
measurement
¶
-
property
n_events
¶
-
property
-
class
threeML.utils.time_series.event_list.
EventListWithDeadTime
(arrival_times, measurement, n_channels, start_time=None, stop_time=None, dead_time=None, first_channel=0, quality=None, ra=None, dec=None, mission=None, instrument=None, verbose=True, edges=None)[source]¶
-
class
threeML.utils.time_series.event_list.
EventListWithDeadTimeFraction
(arrival_times, measurement, n_channels, start_time=None, stop_time=None, dead_time_fraction=None, first_channel=0, quality=None, ra=None, dec=None, mission=None, instrument=None, verbose=True, edges=None)[source]¶
-
class
threeML.utils.time_series.event_list.
EventListWithLiveTime
(arrival_times, measurement, n_channels, live_time, live_time_starts, live_time_stops, start_time=None, stop_time=None, quality=None, first_channel=0, rsp_file=None, ra=None, dec=None, mission=None, instrument=None, verbose=True, edges=None)[source]¶
threeML.utils.time_series.polynomial module¶
-
exception
threeML.utils.time_series.polynomial.
CannotComputeCovariance
[source]¶ Bases:
RuntimeWarning
-
class
threeML.utils.time_series.polynomial.
PolyBinnedLogLikelihood
(x, y, model, exposure)[source]¶ Bases:
threeML.utils.time_series.polynomial.PolyLogLikelihood
Implements a Poisson likelihood (i.e., the Cash statistic). Mind that this is not the Castor statistic (Cstat). The difference between the two is a constant given a dataset. I kept Cash instead of Castor to make easier the comparison with ROOT during tests, since ROOT implements the Cash statistic.
-
class
threeML.utils.time_series.polynomial.
PolyLogLikelihood
(model, exposure)[source]¶ Bases:
object
-
class
threeML.utils.time_series.polynomial.
PolyUnbinnedLogLikelihood
(events, model, t_start, t_stop, exposure)[source]¶ Bases:
threeML.utils.time_series.polynomial.PolyLogLikelihood
Implements a Poisson likelihood (i.e., the Cash statistic). Mind that this is not the Castor statistic (Cstat). The difference between the two is a constant given a dataset. I kept Cash instead of Castor to make easier the comparison with ROOT during tests, since ROOT implements the Cash statistic.
-
class
threeML.utils.time_series.polynomial.
Polynomial
(coefficients, is_integral=False)[source]¶ Bases:
object
-
property
coefficients
¶ Gets or sets the coefficients of the polynomial.
-
compute_covariance_matrix
(function, best_fit_parameters)[source]¶ Compute the covariance matrix of this fit :param function: the loglike for the fit :param best_fit_parameters: the best fit parameters :return:
-
property
covariance_matrix
¶
-
property
degree
¶ the polynomial degree :return:
-
property
error
¶ the error on the polynomial coefficients :return:
-
property
threeML.utils.time_series.time_series module¶
-
class
threeML.utils.time_series.time_series.
TimeSeries
(start_time, stop_time, n_channels, native_quality=None, first_channel=1, ra=None, dec=None, mission=None, instrument=None, verbose=True, edges=None)[source]¶ Bases:
object
-
property
bins
¶
-
counts_over_interval
(start, stop)[source]¶ return the number of counts in the selected interval :param start: start of interval :param stop: stop of interval :return:
-
get_information_dict
(use_poly=False, extract=False)[source]¶ Return a PHAContainer that can be read by different builders
- Parameters
use_poly – (bool) choose to build from the polynomial fits
-
get_poly_info
()[source]¶ Return a pandas panel frame with the polynomial coeffcients and errors Returns:
a DataFrame
-
get_total_poly_count
(start, stop, mask=None)[source]¶ Get the total poly counts
- Parameters
start –
stop –
- Returns
-
get_total_poly_error
(start, stop, mask=None)[source]¶ Get the total poly error
- Parameters
start –
stop –
- Returns
-
property
n_channels
¶
-
property
poly_fit_exists
¶
-
property
poly_intervals
¶
-
property
poly_order
¶ Get or set the polynomial order
-
property
polynomials
¶ Returns polynomial is they exist
-
save_background
(filename, overwrite=False)[source]¶ save the background to an HD5F
- Parameters
filename –
- Returns
-
set_polynomial_fit_interval
(*time_intervals, **options)[source]¶ Set the time interval to fit the background. Multiple intervals can be input as separate arguments Specified as ‘tmin-tmax’. Intervals are in seconds. Example:
set_polynomial_fit_interval(“-10.0-0.0”,”10.-15.”)
- Parameters
time_intervals – intervals to fit on
options –
-
property
time_intervals
¶ the time intervals of the events
- Returns
-
property