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:
objectA 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
- time
ndarray, optional Time of observations, by default None
- flux
ndarray, optional Flux from each observations, by default None
- flux_err
ndarray, 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_freqs
numpy.ndarray, optional Frequencies at which to evaluate any periodograms, by default np.arange(0.04, 11, 0.01)
- time
Attributes Summary
The median absolute deviation of the normalised flux of the lightcurve
The normalised flux of the lightcurve
The root-mean-squared normalised flux of the lightcurve
The sigmaG of the normalised flux of the lightcurve
The skewness of the flux of the lightcurve
The standard deviation of the normalised flux of the lightcurve
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)
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
- von_neumann_ratio[source]#
The Von Neumann ratio for the normalised flux of the lightcurve. See
elk.stats.von_neumann_ratiofor 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, axes
Figure,AxesSubplot Figure and axes on which the analysis has been plotted
- fig, axes
- 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_table
Table Table of statistics
- stats_table
- 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, ax
Figure,AxesSubplot Figure and axis on which the lightcurve has been plotted
- fig, ax
- 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, ax
Figure,AxesSubplot Figure and axis on which the autocorrelation function has been plotted
- fig, ax
- plot_periodogram(frequencies=None, title='auto', **kwargs)[source]#
Plot the periodogram for the lightcurve
- Parameters
- frequencies
ndarray 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
- frequencies
- Returns
- fig, ax
Figure,AxesSubplot Figure and axis on which the periodogram has been plotted
- fig, ax
- 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
- Same as
- to_periodogram(frequencies=None, **kwargs)[source]#
Construct a periodogram using the lightcurve
- Parameters
- frequencies
numpy.ndarray, optional Frequencies at which to evaluate the periodogram, by default self.periodogram_freqs
- **kwargsvarious
Keyword arguments to pass to
elk.stats.periodogram
- frequencies
- Returns
- Same as
elk.stats.periodogram
- Same as