ATK.Models.Lightcurve#
- class ATK.Models.Lightcurve[source]#
Bases:
Container,DataFrameIOMixin,TableIOMixin,FITSIOMixinContainer for storing time-series photometry. This object stores both data and relevant metadata.
Valid Configurations
A
Lightcurvemust be initialised with one of the following mutually exclusive forms:Photometry:
fluxandflux_errmagandmag_err
Time axis:
mjdphase
Providing both or neither in either group raises a
ValueError.Units
The following attributes are automatically converted to
Quantitywith a default unit unless one is explictly provided:mjd- dmag- magmag_err- magflux- ct s⁻¹flux_err- ct s⁻¹ra- degdec- degphase- dimensionless
Data Methods
The following Data Methods are supported by
Lightcurve- either individually or throughDataSet.apply():Plotting Arguments
The following keyword arguments are accepted when plotting via
plot()oropen().- bandslist of str, optional
Bands to process and include in figure. Only used
If not provided, all bands are plotted. See here for a list of supported bands in default surveys.
- colourslist of str, optional
Colour to give to each band.
If not provided, a default set of colours are used. The following colours are supported:
"green","red","blue","orange","purple","black".If
bandsisNone, colours are automatically assigned among all available bands.- cmap{‘mean’, ‘flat’}, optional
Sets the colour map. Only used in unfolded
Lightcurves, i.e. whenphaseisNone.'mean': colour scales with distance from the centre.'flat': no colour scaling.Default is
'mean'.- time_format{‘reduced’, ‘original’}, optional
Sets the format of the time axis. Only used in unfolded
Lightcurves, i.e. whenphaseisNone.'reduced': minimum MJD across all available photometry is subtracted. Time axis starts at date of first observation.'original': time axis is MJD.Default is
'reduced'.- subtract{‘mean’, ‘mean’, None}, optional
Sets metric used in subtracting (and hence aligning) photometry. E.g. if
'median, y-axis represents change in brightness relative to median. Only used in foldedLightcurves, i.e. whenphaseis notNone.If
None, no photometry subtraction/alignment is performed.Default is
'median'.- align{‘max’, ‘min’, ‘median’, ‘mean’, None}, optional
Aligns photometry to a chosen feature.
'max': photometry is aligned to begin at a local maximum in modulation.'min': photometry is aligned to begin at a local minimum in modulation.'median': photometry is aligned to begin at the median.'mean': photometry is aligned to begin at the mean.If
None, no phase-alignment is performed.Default is
'max'.- repeatint, optional
Sets the number of modulations in brightness to display.
Default is
2.
Attributes
Photometric band of stored data.
Achieved degree of proper motion correction.
Declination values.
Flux values.
Flux error values.
Fold frequency.
Magnitude values.
Magnitude error values.
Modified Julian Day values.
Survey-specific object ID.
Phase values.
Fold period.
Right ascension values.
Position of search at time of execution (i.e. post-correction).
Separation between position of the search and the returned data.
Survey from which the stored data originates.
Methods
bin([bins, size, inplace])Bins all array-like attributes into a number of bins or a bin size in x (i.e.
mjdorphase).clip(sigma[, sigma_lower, sigma_upper, inplace])Sigma clips a
Lightcurveto a given sigma (or range in sigma) in y (i.e.magorflux).crop([cmin, cmax, inplace])Crops all array-like attributes to a given range in x (i.e.
mjdorphase).fold(fmin, fmax, samples[, optimise, freq, ...])Phase-folds the
Lightcurvecurve onto the best frequency over a range of trial frequencies, or a fixed frequency.from_dataframe(target, data, **kwargs)Construct a
Lightcurvefrom aDataFrame.from_table(target, data, **kwargs)Construct a
Lightcurvefrom aTable.pspec(fmin, fmax, samples)Generates a
Powspec(power spectrum) usingastropy.timeseries.LombScargleover a range of trial frequencies.show([show_types, show_all])Prints structure to stdout in a human-readable format.
Combines all array-like attributes of a structure into a
DataFrame.to_hdu()Converts structure into a FITS
BinTableHDU.to_table()Combines all array-like attributes of a structure into a
Table, preserving units.Attribute Descriptions
- correction: str | None = None#
Achieved degree of proper motion correction.
'full'= complete 3-dimensional projection on the sky.'partial'= 2-dimensional plane projection.'none'= no correction.
- dec: Quantity | None = None#
Declination values.
Noneunless light curve has been folded withfold().
- fopt: Quantity | None = None#
Fold frequency.
Only relevant in folded light curves (i.e. when
phaseis notNone).
- obj_id: str | None = None#
Survey-specific object ID.
Set when performing light curve queries with
split = True.
- popt: Quantity | None = None#
Fold period.
Only relevant in folded light curves (i.e. when
phaseis notNone).
- ra: Quantity | None = None#
Right ascension values.
Noneunless light curve has been folded withfold().
- separation: Quantity | None = None#
Separation between position of the search and the returned data.
Method Descriptions
- bin(bins: int | None = None, size: Quantity | float | None = None, inplace=True) Self[source]#
Bins all array-like attributes into a number of bins or a bin size in x (i.e.
mjdorphase).Exactly one of
binorsizemust be provided.- Parameters:
- binsint, optional
Number of bins in which to bin data.
- sizefloat or
Quantity, optional Size of each bin in which to bin data. If a
Unitis not provided,sizeis assumed to be in the same unit as x.- inplacebool, optional
If
True, modify the currentLightcurveinplace. IfFalse, operate on and return a copy - leaving the original unchanged.
- Returns:
SelfThe binned
Lightcurve. Returnsselfifinplace=True, otherwise returns a new instance.
- clip(sigma: float, sigma_lower: float | None = None, sigma_upper: float | None = None, inplace: bool = False) Self[source]#
Sigma clips a
Lightcurveto a given sigma (or range in sigma) in y (i.e.magorflux).This method utilises
astropy.stats.sigma_clip(), see the Astropy documentation for details.- Parameters:
- sigmafloat
Number of standard deviations to use for clipping.
- sigma_lowerfloat or None, optional
Lower bound for clipping. If
None, defaults tosigma.- sigma_upperfloat or None, optional
Upper bound for clipping. If
None, defaults tosigma.- inplacebool, optional
If
True, modify the currentLightcurveinplace. IfFalse, operate on and return a copy - leaving the original unchanged.
- Returns:
SelfThe clipped
Lightcurve. Returnsselfifinplace=True, otherwise returns a new instance.
- crop(cmin: float | Quantity | None = None, cmax: float | Quantity | None = None, inplace: bool = True) Self[source]#
Crops all array-like attributes to a given range in x (i.e.
mjdorphase).At least one of
cmin,cmaxmust be provided.- Parameters:
- cminfloat or
Quantity, optional Minimum x value. If not provided, bottom range is not clipped.
If a
Unitis not provided,cminis assumed to be in the same unit as x.- cmaxfloat or
Quantity, optional. Maximum x value. If not provided, top range is not clipped.
If a
Unitis not provided,cmaxis assumed to be in the same unit as x.- inplacebool, optional
If
True, modify the currentLightcurveinplace. IfFalse, operate on and return a copy - leaving the original unchanged.
- cminfloat or
- Returns:
SelfThe cropped
Lightcurve. Returnsselfifinplace=True, otherwise returns a new instance.
- fold(fmin: float | Quantity, fmax: float | Quantity, samples: int, optimise: bool = True, freq: float | Quantity | None = None, inplace: bool = True) Self[source]#
Phase-folds the
Lightcurvecurve onto the best frequency over a range of trial frequencies, or a fixed frequency.- Parameters:
- fminfloat or
Quantity, optional Minimum frequency.
If a
Quantityis not provided,fminis assumed to be in \(\mathrm{days}^{-1}\).- fmaxfloat or
Quantity, optional Maximum frequency.
If a
Quantityis not provided,fmaxis assumed to be in \(\mathrm{days}^{-1}\).- samplesint, optional
Number of samples in the frequency range defined by
fminandfmax.- optimisebool, optional
If True, a phase-dispersion metric is calculated for a set of harmonics either side of the peak frequency, and the best is chosen. This can help to preserve real periodic structure, especially in the case of asymmetric modulation.
- freqfloat or
Quantity, optional Specific frequency on which to fold the
Lightcurve. If provided, this overridesfmin,fmax, andsamples.If a
Quantityis not provided,freqis assumed to be in \(\mathrm{days}^{-1}\).- inplacebool, optional
If
True, modify the currentLightcurvein place - leaving the original unchanged. IfFalse, operate on and return a copy.
- fminfloat or
- Returns:
SelfThe folded
Lightcurve, withfoptandpoptset to the folded frequency and folded period, respectively. Returnsselfifinplace=True, otherwise returns a new instance.
- classmethod from_dataframe(target, data, **kwargs)#
Construct a
Lightcurvefrom aDataFrame.- Parameters:
- target
Target, int, orSkyCoord Astronomical target with which to associate input data.
- data
DataFrame Tabular data containing the relevant fields (i.e. array-like attributes) required to construct a
Lightcurve. Units are assumed to be as listed above.- **kwargs
Additional keyword arguments to be forwarded to the internal parser.
The following keyword arguments are required:
survey,band
- target
- Returns:
- classmethod from_table(target, data, **kwargs)#
Construct a
Lightcurvefrom aTable.- Parameters:
- target
Target, int, orSkyCoord Astronomical target with which to associate input data.
- data
Table Tabular data containing the relevant fields (i.e. array-like attributes) required to construct a
Lightcurve. Units are taken from the table where available, with missing units assumed to be those listed above.- **kwargs
Additional keyword arguments to be forwarded to the internal parser.
The following keyword arguments are required:
survey,band
- target
- Returns:
- pspec(fmin: float | Quantity, fmax: float | Quantity, samples: int) Powspec[source]#
Generates a
Powspec(power spectrum) usingastropy.timeseries.LombScargleover a range of trial frequencies.- Parameters:
- fminfloat | Quantity
Minimum frequency.
If a
Unitis not provided,fminis assumed to be in \(\mathrm{days}^{-1}\).- fmaxfloat | Quantity
Maximum frequency.
If a
Unitis not provided,fmaxis assumed to be in \(\mathrm{days}^{-1}\).- samples: int
Number of samples in frequency range defined by
fminandfmax.
- Returns:
- show(show_types=False, show_all=False)#
Prints structure to stdout in a human-readable format.
- Parameters:
- show_typesbool, optional
If True, print data types of structure attributes.
Default is
False- show_allbool, optional
If True, do not truncate printing of large iterables.
Default is
False.
- Returns:
self
- to_dataframe()#
Combines all array-like attributes of a structure into a
DataFrame.Units are not preserved.
- Returns:
- to_hdu() BinTableHDU#
Converts structure into a FITS
BinTableHDU.- Returns: