- class AstroToolkit.Data.lightcurvequery.LightcurveStruct[source]
This structure is returned from lightcurve queries, when read from a data file that was originally created by a lightcurve query, or through the Models module.
Attributes
- kindstr
“lightcurve”
- surveystr
survey to which the data belongs
- sourceint
Gaia source ID of target system (if given, else None)
- poslist<float>
Position of target system [right ascension, declination] in degrees
- identifierstr
Position of target system in JHHMMSS.SS±DDMMSS.SS format
- datanamestr
Default file for the
savedata()method- plotnamestr
Default file name for the
showplot()andsaveplot()methods- figureBokeh figure
Stores figures generated by the
plot()method- data: list<dict>
Returned data as a list of bands, with each band in the form:
"band": <band> "ra": [right ascension (degrees)] "dec": [declination in (degrees)] "mjd": [mjd] "mag"/"flux": [apparent magnitude]/[flux] "mag_err"/"flux_err": [error on the apparent magnitude]/[error on the flux]
where <band> is the wavelength band of the data entry, and the bands for each supported light curve survey are:
ztf: g, r, i
atlas: o, c, i
gaia: g, bp, rp
asassn: g, v
crts: v
tess: TESS mag
Methods
- bin(**kwargs)[source]
Bins light curve data into a given number of equally spaced bins in time or a given bin size in days, hours or minutes.
- Parameters:
bins (int, optional) – number of bins in which to bin data, defaults to None (i.e. no binning)
or
- Parameters:
binsize (str, optional) – bin size ending with the unit, e.g. “10d”, “10h” or “10m” for 10 days, hours or minutes, respectively. Defaults to None (i.e. no binning)
- Returns:
Self
- crop(**kwargs)[source]
Crops light curve data between a given start and end time in reduced or original time format, or between two percentages of the light curve’s total coverage in time.
- Parameters:
timeformat (str, optional) – time format, from: ‘reduced’, ‘original’. Defaults to ‘reduced’
start (float/str, optional) – start time in format given by timeformat, or where to start in the light curve as a percentage (e.g. ‘25%’). Defaults to None (i.e. no cropping)
stop (float/str, optional) – end time in format given by timeformat, or where to stop in the light curve as a percentage (e.g. ‘75%’). Defaults to None (i.e. no cropping)
- Returns:
Self
- exportplot(fname)
Exports the figure stored in the ‘figure’ attribute to a PNG, and saves it to local files. If the data structure doesn’t yet hold a figure, one will be generated with a default configuration first.
- Parameters:
fname (str, optional) – file name to same the figure to, defaults to file name given by the data structure’s ‘plotname’ attribute
- Returns:
file name to which the figure was saved
- Return type:
str
- plot(**kwargs)[source]
Plots data contained within a given data stucture and assigns the resulting figure to the data structure’s ‘figure’ attribute. Light curves can be plotted in three ways:
As standard light curves
As a Lomb-Scargle power spectrum
As a phase-folded light curve
Additional Parameters:
- Parameters:
kind (str, optional) – type of figure to generate, from: ‘lightcurve’, ‘powspec’ (power spectrum), ‘phasefold’ (phase-folded light curve), defaults to ‘lightcurve’
Additional optional parameters are available depending on the kind of figure being generated:
For lightcurve plotting:
- Parameters:
bands (list<str>, optional) – list of bands to plot, see listed bands for each supported survey above, defaults to all supported bands of relevant survey
colours (list<str>, optional) – list of colours to apply to selected bands. Supported colours: green, red, blue, black, orange, purple. Default = black for all bands
timeformat (str, optional) – time format from: ‘reduced’, ‘original’. defaults to ‘reduced’
For powspec plotting:
- Parameters:
start_freq (float, optional) – starting frequency in \(\text{days}^{-1}\), defaults to 0
stop_freq (float, optional) – final frequency in \(\text{days}^{-1}\), defaults to 60
samples (int, optional) – number of frequency values at which to calculate power, defaults to 150000
For phasefold plotting:
- Parameters:
freq (float, optional) – frequency on which to fold the data in \(\text{days}^{-1}\), defaults to maximum power Lomb-Scargle frequency
bins (int, optional) – number of equally spaced bins in time to bin phase folded data into, defaults to None (i.e. no binning)
repeat (int, optional) – number of repetitions to plot on the folded period, defaults to 2
shift (float, optional) – shift to apply to phase folded light curve in units of phase, defaults to 0
foverlay (bool, optional) – overlays a sine wave of the fold frequency, defaults to True
- savedata(fname)
Saves a data structure’s data to local files.
- Parameters:
fname (str, optional) – overrides file name, defaults to file name given by the data structure’s ‘dataname’ attribute
- Returns:
name of file to which data was saved
- Return type:
str
- saveplot(fname)
Saves the figure stored in the ‘figure’ attribute to local files without opening it in the web browser. If the data structure doesn’t yet hold a figure, one will be generated with a default configuration first.
- Parameters:
fname (str, optional) – file name to save the figure to, defaults to file name given by the data structure’s ‘plotname’ attribute
- Returns:
file name to which the figure was saved
- Return type:
str
- showdata(pprint, print_methods)
Prints data structure to stdout in a readable format.
- Parameters:
pprint (bool, optional) – collapse arrays and other objects to improve readability, defaults to True
- Returns:
Self
- showplot(fname)
Opens the figure stored in the ‘figure’ attribute in the default web browser, and saves it to local files. If the data structure doesn’t yet hold a figure, one will be generated with a default configuration first.
- Parameters:
fname (str, optional) – file name to save the figure to, defaults to file name given by the data structure’s ‘plotname’ attribute
- Returns:
file name to which the figure was saved
- Return type:
str