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() Calculate the chi-square test for LightCurve.
compute_fvar() Calculate the fractional excess variance.
plot([ax]) Plot flux versus time.
read(filename, **kwargs) Read from file.
write(filename, **kwargs) Write to file.

Attributes Documentation

time

Time (Time).

time_delta

Time bin width (TimeDelta).

::
time_delta = time_max - time_min
time_format

Time format (str).

time_max

Time bin end (Time).

time_mid

Time bin center (Time).

::
time_mid = time_min + 0.5 * time_delta
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()[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()[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

[Vaughan20032627]“On characterizing the variability properties of X-ray light curves from active galaxies”, Vaughan et al. (2003) http://adsabs.harvard.edu/abs/2003MNRAS.345.1271V
plot(ax=None)[source]

Plot flux versus time.

Parameters:

ax : Axes or None, optional.

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

Returns:

ax : Axes or None, optional.

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

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

Read from file.

Parameters:

filename : str

Filename

kwargs : dict

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

write(filename, **kwargs)[source]

Write to file.

Parameters:

filename : str

Filename

kwargs : dict

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