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:
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:
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:
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
- 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]
Bases:
EventList
- 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]
Bases:
EventList
- 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]
Bases:
EventList
threeML.utils.time_series.polynomial module
- class threeML.utils.time_series.polynomial.Polynomial(coefficients: Iterable[float], is_integral: bool = False)[source]
Bases:
object
- property coefficients
Gets or sets the coefficients of the polynomial.
- property covariance_matrix: ndarray
- property degree: int
the polynomial degree :return:
- property error
the error on the polynomial coefficients :return:
- classmethod from_previous_fit(coefficients, covariance) Polynomial [source]
- threeML.utils.time_series.polynomial.polyfit(x: Iterable[float], y: Iterable[float], grade: int, exposure: Iterable[float], bayes: bool | None = False) Tuple[Polynomial, float] [source]
function to fit a polynomial to data. not a member to allow parallel computation
- Parameters:
x – the x coord of the data
y – the y coord of the data
grade – the polynomical order or grade
expousure – the exposure of the interval
bayes – to do a bayesian fit or not
- threeML.utils.time_series.polynomial.unbinned_polyfit(events: Iterable[float], grade: int, t_start: Iterable[float], t_stop: Iterable[float], exposure: float, bayes: bool) Tuple[Polynomial, float] [source]
function to fit a polynomial to unbinned event data. not a member to allow parallel computation
- Parameters:
events – the events to fit
grade – the polynomical order or grade
t_start – the start time to fit over
t_stop – the end time to fit over
expousure – the exposure of the interval
bayes – to do a bayesian fit or not
threeML.utils.time_series.time_series module
- class threeML.utils.time_series.time_series.TimeSeries(start_time: float, stop_time: float, n_channels: int, native_quality=None, first_channel: int = 1, ra: float | None = None, dec: float | None = None, mission: str | None = None, instrument: str | None = None, verbose: bool = True, edges=None)[source]
Bases:
object
- property bins
- property bkg_intervals
- counts_over_interval(start, stop) int [source]
return the number of counts in the selected interval :param start: start of interval :param stop: stop of interval :return:
- fit_polynomial(**kwargs)[source]
Fit the polynominals to the selected time intervals :param kwargs: :returns:
- get_information_dict(use_poly: bool = False, extract: bool = False) _OutputContainer [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() dict [source]
Return a pandas panel frame with the polynomial coeffcients and errors :returns: a DataFrame
- get_total_poly_count(start: float, stop: float, mask=None) int [source]
Get the total poly counts
- Parameters:
start
stop
- Returns:
- get_total_poly_error(start: float, stop: float, mask=None) float [source]
Get the total poly error
- Parameters:
start
stop
- Returns:
- property n_channels: int
- property poly_fit_exists: bool
- 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_background_interval(*time_intervals, **options)[source]
Set the time interval for the background observation. 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
- set_polynomial_fit_interval(*time_intervals, **kwargs) None [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.”) :param time_intervals: intervals to fit on :param unbinned: :param bayes: :param kwargs:
- property time_intervals
the time intervals of the events
- Returns: