Generate light curves from cells

A "light curve" is a table with columns

  • t -- time in MJD
  • tw -- the cell width
  • n -- number of photons
  • e -- exposure, in $\mathrm{10^6 s\ cm^2}$ units
  • fit -- the fit object, containing info about the flux. This is usually a PoissonRep object

It is generated from a set of cells. The primary entry is the class LightCurve.

utc_check[source]

utc_check(kwargs)

Update Axes kwargs for flux_plot with UTC

flux_plot[source]

flux_plot(cell_fits, query='', ax=None, fignum=1, figsize=(12, 4), log=False, title=None, step=False, tzero:time offset=0, flux_factor=1, colors=('cornflowerblue', 'sandybrown', 'blue'), fmt='', ms=None, error_pixsize=10, limit_fmt=None, source_name=None, legend_loc='upper left', error_lw=2, ts_bar_min=4, zorder=0, errorbar_args={}, axhline={}, **kwargs)

Make a plot of flux vs. time. This is invoked by the plot function of LightCurve

  • cell_fits -- cell fits DataFrame
  • query ['']-- DataFrame query to select subset
  • ts_bar_min -- threshold for plotting as bar vs limit
  • tzero -- time offset, in MJD
  • source_name -- draw text in top left
  • flux_factor [1]

  • ax [None] -- a matplotlib.axes._subplots.AxesSubplot object returned from plt.subplots
    if None, create one using subplots with fignum [1] and figsize [(12,4)]

  • fmt [''] -- marker symbol -- if not specified, will use '.' if many bins, else 'o'
  • ms [None] -- for marker size
  • colors -- tuple of colors for signal, limit, step
  • step -- add a "step" plot
  • zorder -- set to different number to order successive calls with same Axis object
  • kwargs -- apply to the ax object, like xlim, ylim

returns the Figure instance

Example plot-- the first 100 days of Fermi data for Geminga

And forcing upper limits

class LightCurve[source]

LightCurve(*pars, **kwargs) :: CellData

Full analysis of a source, Inherits from CellData

LightCurve.periodogram[source]

LightCurve.periodogram(tsamp=0.041666666666666664, **kwargs)

Return a Kerr periodogram

  • tsamp -- sample size, default 1/24 or 1 hour, giving a Nyquist frequency of 6 cycles/day.

Demonstrate TimeSeries

import warnings
warnings.filterwarnings('error', category=RuntimeWarning)
config=Config()
if config.valid:
    lc = LightCurve('3C 279' );
    lc.plot(UTC=True);
    
    from wtlike.time_series import TimeSeries
    ts = lc.periodogram()
    ts.power_plot(pmax=100, xlim=(0.5,None), xscale='log');
SourceData:  4FGL J1256.1-0547: Restoring from cache with key "P88Y3243_data"
SourceData: Source 3C 279 with:
	 data:       191,313 photons from 2008-08-04 to 2022-05-26
	 exposure: 3,042,347 intervals,  average effective area 2768 cm^2 for 90.8 Ms
	 rates:  source 4.03e-07/s, background 3.58e-07/s, TS 183590.9
CellData.rebin: Bin photon data into 720 1-week bins from 54683.0 to 59723.0
LightCurve: select 707 cells for fitting with e>35 & n>2
CellData.rebin: Bin photon data into 121008 1-hour bins from 54683.0 to 59725.0