LightCurve

class gammapy.time.LightCurve(table)[source]

Bases: object

Lightcurve container.

The lightcurve data is stored in table.

For now we only support times stored in MJD format!

TODO: specification of format is work in progress See https://github.com/open-gamma-ray-astro/gamma-astro-data-formats/pull/61

Usage: Lightcurve

Parameters:
table : Table

Table with lightcurve data

Attributes Summary

time Time (Time).
time_delta Time bin width (TimeDelta).
time_format Time format (str).
time_max Time bin end (Time).
time_mid Time bin center (Time).
time_min Time bin start (Time).
time_scale Time scale (str).

Methods Summary

compute_chisq(self) Calculate the chi-square test for LightCurve.
compute_fvar(self) Calculate the fractional excess variance.
plot(self[, ax, time_format, flux_unit]) Plot flux points.
read(filename, \*\*kwargs) Read from file.
write(self, filename, \*\*kwargs) Write to file.

Attributes Documentation

time

Time (Time).

time_delta

Time bin width (TimeDelta).

time_format

Time format (str).

time_max

Time bin end (Time).

time_mid

Time bin center (Time).

time_min

Time bin start (Time).

time_scale

Time scale (str).

Taken from table “TIMESYS” header. Common values: “TT” or “UTC”. Assumed default is “UTC”.

Methods Documentation

compute_chisq(self)[source]

Calculate the chi-square test for LightCurve.

Chisquare test is a variability estimator. It computes deviations from the expected value here mean value

Returns:
ChiSq, P-value : tuple of float or ndarray

Tuple of Chi-square and P-value

compute_fvar(self)[source]

Calculate the fractional excess variance.

This method accesses the the FLUX and FLUX_ERR columns from the lightcurve data.

The fractional excess variance \(F_{var}\), an intrinsic variability estimator, is given by

\[F_{var} = \sqrt{\frac{S^{2} - \bar{\sigma^{2}}}{\bar{x}^{2}}}.\]

It is the excess variance after accounting for the measurement errors on the light curve \(\sigma\). \(S\) is the variance.

Returns:
fvar, fvar_err : ndarray

Fractional excess variance.

References

[Vaughan2003]“On characterizing the variability properties of X-ray light curves from active galaxies”, Vaughan et al. (2003) https://ui.adsabs.harvard.edu/abs/2003MNRAS.345.1271V
plot(self, ax=None, time_format='mjd', flux_unit='cm-2 s-1', **kwargs)[source]

Plot flux points.

Parameters:
ax : Axes, optional.

The Axes object to be drawn on. If None, uses the current Axes.

time_format : {‘mjd’, ‘iso’}, optional

If ‘iso’, the x axis will contain Matplotlib dates. For formatting these dates see: https://matplotlib.org/gallery/ticks_and_spines/date_demo_rrule.html

flux_unit : str, Unit, optional

Unit of the flux axis

kwargs : dict

Keyword arguments passed to matplotlib.pyplot.errorbar()

Returns:
ax : Axes

Axis object

classmethod read(filename, **kwargs)[source]

Read from file.

Parameters:
filename : str

Filename

kwargs : dict

Keyword arguments passed to astropy.table.Table.read.

write(self, filename, **kwargs)[source]

Write to file.

Parameters:
filename : str

Filename

kwargs : dict

Keyword arguments passed to astropy.table.Table.write.