BasicLightcurve#

class elk.lightcurve.BasicLightcurve(time=None, flux=None, flux_err=None, sector=None, fits_path=None, hdu_index=None, periodogram_freqs=array([0.04, 0.05, 0.06, ..., 10.97, 10.98, 10.99]))[source]#

Bases: object

A basic lightcurve class for calculating statistics of corrected lightcurves and plotting them.

This class can either be instantiated manually using time, flux and flux_err values, or loaded in from a fits file that has previously been created.

Parameters
timendarray, optional

Time of observations, by default None

fluxndarray, optional

Flux from each observations, by default None

flux_errndarray, optional

Errors on the flux, by default None

sectorint, optional

TESS sector in which observations were taken, by default None

fits_pathstr, optional

Path to a fits file containing the lightcurve, by default None

hdu_indexint, optional

Index of the HDU containing the lightcurve, by default None

periodogram_freqsnumpy.ndarray, optional

Frequencies at which to evaluate any periodograms, by default np.arange(0.04, 11, 0.01)

Attributes Summary

MAD

The median absolute deviation of the normalised flux of the lightcurve

normalized_flux

The normalised flux of the lightcurve

rms

The root-mean-squared normalised flux of the lightcurve

sigmaG

The sigmaG of the normalised flux of the lightcurve

skewness

The skewness of the flux of the lightcurve

std

The standard deviation of the normalised flux of the lightcurve

von_neumann_ratio

The Von Neumann ratio for the normalised flux of the lightcurve.

Methods Summary

J_stetson(**kwargs)

Calculate the J Stetson statistic for the lightcurve

analysis_plot([name, run_all, show])

Plot a 3-panel plot of the lightcurve for quick analysis

get_stats_table(name[, run_all])

Create an Astropy Table of the statistics (for aggregation with other lightcurves)

get_stats_using_defaults()

Generate all statistics for the lightcurve using default settings

plot([title, fold_period])

Plot the lightcurve

plot_acf([title])

Plot the autocorrelation function

plot_periodogram([frequencies, title])

Plot the periodogram for the lightcurve

to_acf(**kwargs)

Calculate the autocorrelation function for the lightcurve

to_periodogram([frequencies])

Construct a periodogram using the lightcurve

Attributes Documentation

MAD[source]#

The median absolute deviation of the normalised flux of the lightcurve

normalized_flux[source]#

The normalised flux of the lightcurve

rms[source]#

The root-mean-squared normalised flux of the lightcurve

sigmaG[source]#

The sigmaG of the normalised flux of the lightcurve

skewness[source]#

The skewness of the flux of the lightcurve

std[source]#

The standard deviation of the normalised flux of the lightcurve

von_neumann_ratio[source]#

The Von Neumann ratio for the normalised flux of the lightcurve. See elk.stats.von_neumann_ratio for more information

Methods Documentation

J_stetson(**kwargs)[source]#

Calculate the J Stetson statistic for the lightcurve

Keyword arguments are passed directly to elk.stats.J_stetson

Returns
J_Stetson

The J Stetson statistic

analysis_plot(name=None, run_all=False, show=True)[source]#

Plot a 3-panel plot of the lightcurve for quick analysis

Plot includes the lightcurve, periodogram and autocorrelation function.

Parameters
namestr

Identifier for this lightcurve (e.g. name of cluster)

run_allbool, optional

Whether to run all statistics using default settings (see .get_stats_using_defaults()), by default False

showbool, optional

Whether to immediately show the plot, by default True

Returns
fig, axesFigure, AxesSubplot

Figure and axes on which the analysis has been plotted

get_stats_table(name, run_all=False)[source]#

Create an Astropy Table of the statistics (for aggregation with other lightcurves)

Parameters
namestr

Identifier for this lightcurve (e.g. name of cluster)

run_allbool, optional

Whether to run all statistics using default settings (see .get_stats_using_defaults()), by default False

Returns
stats_tableTable

Table of statistics

get_stats_using_defaults()[source]#

Generate all statistics for the lightcurve using default settings

NOTE: This may not be optimal for your use case, be sure to consider each setting! By default we use a list of frequencies generated with np.arange(0.04, 11, 0.01) for the periodogram.

Returns
statsdict

A dictionary of the various statistics (also stored in self.stats)

plot(title='auto', fold_period=None, **kwargs)[source]#

Plot the lightcurve

Parameters
titlestr, optional

Title for the plot, by default “auto” (resulting in “Lightcurve for Sector …”)

fold_periodfloat, optional

Period on which to fold the light curve, if None then no folding is done, by default None

**kwargs: `various`

Keyword arguments passed to elk.plot.plot_lightcurve

Returns
fig, axFigure, AxesSubplot

Figure and axis on which the lightcurve has been plotted

plot_acf(title='auto', **kwargs)[source]#

Plot the autocorrelation function

Parameters
titlestr, optional

Title for the plot, by default “auto” (resulting in “Autocorrelation function for Sector …”)

**kwargs: `various`

Keyword arguments passed to elk.plot.plot_acf

Returns
fig, axFigure, AxesSubplot

Figure and axis on which the autocorrelation function has been plotted

plot_periodogram(frequencies=None, title='auto', **kwargs)[source]#

Plot the periodogram for the lightcurve

Parameters
frequenciesndarray

Frequencies at which periodogram evaluated, if None then periodogram must have already been generated using .to_periodogram()

titlestr, optional

Title for the plot, by default “auto” (resulting in “Periodogram for Sector …”)

**kwargs: `various`

Keyword arguments passed to elk.plot.plot_periodogram

Returns
fig, axFigure, AxesSubplot

Figure and axis on which the periodogram has been plotted

to_acf(**kwargs)[source]#

Calculate the autocorrelation function for the lightcurve

Keyword arguments are passed directly to elk.stats.autocorr

Returns
Same as elk.stats.periodogram
to_periodogram(frequencies=None, **kwargs)[source]#

Construct a periodogram using the lightcurve

Parameters
frequenciesnumpy.ndarray, optional

Frequencies at which to evaluate the periodogram, by default self.periodogram_freqs

**kwargsvarious

Keyword arguments to pass to elk.stats.periodogram

Returns
Same as elk.stats.periodogram