LightCurveTableModel¶
-
class
gammapy.time.models.
LightCurveTableModel
(table)[source]¶ Bases:
gammapy.utils.fitting.Model
Temporal light curve model.
The lightcurve is given as a table with columns
time
andnorm
.The
norm
is supposed to be a unite-less multiplicative factor in the model, to be multiplied with a spectral model.The model does linear interpolation for times between the given
(time, norm)
values.The implementation currently uses
scipy.interpolate.InterpolatedUnivariateSpline
, using degreek=1
to get linear interpolation. This class also contains anintegral
method, making the computation of mean fluxes for a given time interval a one-liner.Parameters: table :
Table
A table with ‘TIME’ vs ‘NORM’
Examples
Read an example light curve object:
>>> from gammapy.time.models import LightCurveTableModel >>> path = '$GAMMAPY_EXTRA/test_datasets/models/light_curve/lightcrv_PKSB1222+216.fits' >>> light_curve = LightCurveTableModel.read(path)
Show basic information about the lightcurve:
>>> print(light_curve) LightCurve model summary: Start time: 59000.5 MJD End time: 61862.5 MJD Norm min: 0.01551196351647377 Norm max: 1.0
Compute
norm
at a given time:>>> light_curve.evaluate_norm_at_time(46300) 0.49059393580053845
Compute mean
norm
in a given time interval:>>> light_curve.mean_norm_in_time_interval(46300, 46301)
Methods Summary
copy
()A deep copy. evaluate_norm_at_time
(time)Evaluate for a given time. mean_norm_in_time_interval
(time_min, time_max)Compute mean norm
in a given time interval.read
(path)Read lightcurve model table from FITS file. Methods Documentation
-
copy
()¶ A deep copy.
-
evaluate_norm_at_time
(time)[source]¶ Evaluate for a given time.
Parameters: time : array_like
Time since the
reference
time.Returns: norm : array_like
-