threeML.utils.time_series.time_series module

exception threeML.utils.time_series.time_series.OverLappingIntervals[source]

Bases: RuntimeError

exception threeML.utils.time_series.time_series.ReducingNumberOfSteps[source]

Bases: Warning

exception threeML.utils.time_series.time_series.ReducingNumberOfThreads[source]

Bases: Warning

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
count_per_channel_over_interval(start, stop)[source]
Parameters:
  • start

  • stop

Returns:

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:

exposure_over_interval(tmin, tmax) float[source]

calculate the exposure over a given interval

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

restore_fit(filename)[source]
save_background(filename, overwrite=False)[source]

save the background to an HD5F

Parameters:

filename

Returns:

set_active_time_intervals(*args)[source]
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:

view_lightcurve(start=-10, stop=20.0, dt=1.0, use_binner=False, use_echans_start=0, use_echans_stop=-1)[source]
threeML.utils.time_series.time_series.ceildiv(a, b)[source]