Light Curves

lightcurve() can be used to fit charateristics of a source (flux, TS, etc.) in a sequence of time bins.

Examples

# Generate a lightcurve with two bins
lc = gta.lightcurve('sourceA', nbins=2)

# Generate a lightcurve with 1-week binning
lc = gta.lightcurve('sourceA', binsz=86400.*7.0)

# Generate a lightcurve freeing sources within 3 deg of the source
# of interest
lc = gta.lightcurve('sourceA', binsz=86400.*7.0, free_radius=3.0)

Reference/API

GTAnalysis.lightcurve(name, **kwargs)

Generate a lightcurve for the named source. The function will complete the basic analysis steps for each bin and perform a likelihood fit for each bin. Extracted values (along with errors) are Integral Flux, spectral model, Spectral index, TS value, pred. # of photons. Note: successful calculation of TS:subscript:var requires at least one free background parameter and a previously optimized ROI model.

Parameters:
  • name (str) – source name
  • binsz (float) – Set the lightcurve bin size in seconds. (default : 86400.0)
  • free_background (bool) – Leave background parameters free when performing the fit. If True then any parameters that are currently free in the model will be fit simultaneously with the source of interest. (default : False)
  • free_params (list) – Set the parameters of the source of interest that will be re-fit in each time bin. If this list is empty then all parameters will be freed. (default : None)
  • free_radius (float) – Free normalizations of background sources within this angular distance in degrees from the source of interest. If None then no sources will be freed. (default : None)
  • free_sources (list) – List of sources to be freed. These sources will be added to the list of sources satisfying the free_radius selection. (default : None)
  • make_plots (bool) – Generate diagnostic plots. (default : False)
  • max_free_sources (int) – Maximum number of sources that will be fit simultaneously with the source of interest. (default : 5)
  • multithread (bool) – Split the calculation across number of processes set by nthread option. (default : False)
  • nbins (int) – Set the number of lightcurve bins. The total time range will be evenly split into this number of time bins. (default : None)
  • nthread (int) – Number of processes to create when multithread is True. If None then one process will be created for each available core. (default : None)
  • outdir (str) – Store all data in this directory (e.g. “30days”). If None then use current directory. (default : None)
  • save_bin_data (bool) – Save analysis directories for individual time bins. If False then only the analysis results table will be saved. (default : True)
  • shape_ts_threshold (float) – Set the TS threshold at which shape parameters of sources will be freed. If a source is detected with TS less than this value then its shape parameters will be fixed to values derived from the analysis of the full time range. (default : 16.0)
  • systematic (float) – Systematic correction factor for TS:subscript:var. See Sect. 3.6 in 2FGL for details. (default : 0.02)
  • time_bins (list) – Set the lightcurve bin edge sequence in MET. This option takes precedence over binsz and nbins. (default : None)
  • use_local_ltcube (bool) – Generate a fast LT cube. (default : True)
  • use_scaled_srcmap (bool) – Generate approximate source maps for each time bin by scaling the current source maps by the exposure ratio with respect to that time bin. (default : False)
  • write_fits (bool) – Write the output to a FITS file. (default : True)
  • write_npy (bool) – Write the output dictionary to a numpy file. (default : True)
Returns:

LightCurve – Dictionary containing output of the LC analysis

Return type:

dict