LightCurveTableModel¶
-
class
gammapy.time.models.LightCurveTableModel(table)[source]¶ Bases:
objectTemporal light curve model.
The lightcurve is given as a table with columns
timeandnorm.The
normis 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=1to get linear interpolation. This class also contains anintegralmethod, making the computation of mean fluxes for a given time interval a one-liner.Parameters: table :
TableA 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
normat a given time:>>> light_curve.evaluate_norm_at_time(46300) 0.49059393580053845
Compute mean
normin a given time interval:>>> light_curve.mean_norm_in_time_interval(46300, 46301)
Methods Summary
evaluate_norm_at_time(time)Evaluate for a given time. mean_norm_in_time_interval(time_min, time_max)Compute mean normin a given time interval.read(path)Read lightcurve model table from FITS file. Methods Documentation
-
evaluate_norm_at_time(time)[source]¶ Evaluate for a given time.
Parameters: time : array_like
Time since the
referencetime.Returns: norm : array_like
-