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: time - Time analysis

Parameters
tableTable

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

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

plot(self, ax=None, time_format='mjd', flux_unit='cm-2 s-1', **kwargs)[source]

Plot flux points.

Parameters
axAxes, 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_unitstr, Unit, optional

Unit of the flux axis

kwargsdict

Keyword arguments passed to matplotlib.pyplot.errorbar()

Returns
axAxes

Axis object

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

Read from file.

Parameters
filenamestr

Filename

kwargsdict

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

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

Write to file.

Parameters
filenamestr

Filename

kwargsdict

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