# 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.

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) nbins (int) – Set the number of lightcurve bins. The total time range will be evenly split into this number of time bins. (default : None) 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) – (default : True) 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) LightCurve – Dictionary containing output of the LC analysis dict