API Documentation

Datasets for Astronomical Time Series

gatspy.datasets.fetch_rrlyrae_templates(**kwargs)[source]

Access the RR Lyrae template data (table 1 of Sesar 2010)

These return approximately 23 ugriz RR Lyrae templates, with normalized phase and amplitude.

Returns:

templates: RRLyraeTemplates object

collection of RRLyrae templates.

Other Parameters:
 

data_home : str (optional)

Specify the local cache directory for the dataset. If not used, it will default to the astroML default location.

url : str (optional)

Specify the URL of the datasets. Defaults to webpage associated with Sesar 2010.

force_download : bool (optional)

If true, then force re-downloading data even if it is already cached locally. Default is False.

gatspy.datasets.fetch_rrlyrae(partial=False, **kwargs)[source]

Fetch RR Lyrae light curves from Sesar 2010

Parameters:

partial : bool (optional)

If true, return the partial dataset (reduced to 1 band per night)

Returns:

rrlyrae : RRLyraeLC object

This object contains pointers to the RR Lyrae data.

Other Parameters:
 

data_home : str (optional)

Specify the local cache directory for the dataset. If not used, it will default to the astroML default location.

url : str (optional)

Specify the URL of the datasets. Defaults to webpage associated with Sesar 2010.

force_download : bool (optional)

If true, then force re-downloading data even if it is already cached locally. Default is False.

Examples

>>> rrlyrae = fetch_rrlyrae()
>>> rrlyrae.ids[:5]
[1013184, 1019544, 1027882, 1052471, 1056152]
>>> lcid = rrlyrae.ids[0]
>>> t, mag, dmag, bands = rrlyrae.get_lightcurve(lcid)
>>> t[:4]
array([ 51081.347856,  51081.349522,  51081.346189,  51081.347022])
>>> mag[:4]
array([ 18.702,  17.553,  17.236,  17.124])
>>> dmag[:4]
array([ 0.021,  0.005,  0.005,  0.006])
>>> list(bands[:4])
['u', 'g', 'r', 'i']
gatspy.datasets.fetch_rrlyrae_lc_params(**kwargs)[source]

Fetch data from table 2 of Sesar 2010

This table includes observationally-derived parameters for all the Sesar 2010 lightcurves.

gatspy.datasets.fetch_rrlyrae_fitdata(**kwargs)[source]

Fetch data from table 3 of Sesar 2010

This table includes parameters derived from template fits to all the Sesar 2010 lightcurves.

class gatspy.datasets.RRLyraeLC(tablename='table1.tar.gz', dirname='table1', cache_kwargs=None)[source]

Container for accessing RR Lyrae Light Curve data.

This should generally not be instantiated directly, but rather is returned by fetch_rrlyrae().

Parameters:

tablename : str (optional)

Name of the table file to be downloaded. Default=’table1.tar.gz’.

dirname : str (optional)

subdirectory in which the table file is located. Default=’table1’.

Other Parameters:
 

data_home : str (optional)

Specify the local cache directory for the dataset. If not used, it will default to the astroML default location.

url : str (optional)

Specify the URL of the datasets. Defaults to webpage associated with Sesar 2010.

force_download : bool (optional)

If true, then force re-downloading data even if it is already cached locally. Default is False.

Examples

>>> rrlyrae = fetch_rrlyrae()
>>> len(rrlyrae.ids)
483
>>> lcid = rrlyrae.ids[0]
>>> t, mag, dmag, filts = rrlyrae.get_lightcurve(lcid)
>>> t[:4]
array([ 51081.347856,  51081.349522,  51081.346189,  51081.347022])

Attributes

filenames
ids
ids_gen

Methods

get_lightcurve(star_id[, return_1d]) Get the light curves for the given ID
get_metadata(lcid) Get the parameters derived from the fit for the given id.
get_obsmeta(lcid) Get the observation metadata for the given id.
get_lightcurve(star_id, return_1d=True)[source]

Get the light curves for the given ID

Parameters:

star_id : int

A valid integer star id representing an object in the dataset

return_1d : boolean (default=True)

Specify whether to return 1D arrays of (t, y, dy, filts) or 2D arrays of (t, y, dy) where each column is a filter.

Returns:

t, y, dy : np.ndarrays (if return_1d == False)

Times, magnitudes, and magnitude errors. The shape of each array is [Nobs, 5], where the columns refer to [u,g,r,i,z] bands. Non-observations are indicated by NaN.

t, y, dy, filts : np.ndarrays (if return_1d == True)

Times, magnitudes, magnitude errors, and filters The shape of each array is [Nobs], and non-observations are filtered out.

get_metadata(lcid)[source]

Get the parameters derived from the fit for the given id. This is table 2 of Sesar 2010

get_obsmeta(lcid)[source]

Get the observation metadata for the given id. This is table 3 of Sesar 2010

class gatspy.datasets.PartialRRLyraeLC(tablename='table1.tar.gz', dirname='table1', offset=0, cache_kwargs=None)[source]

Class to get a partial Stripe 82 light curve: one band per night.

This should generally not be instantiated directly, but rather is returned by fetch_rrlyrae().

Parameters:

tablename : str (optional)

Name of the table file to be downloaded. Default=’table1.tar.gz’.

dirname : str (optional)

subdirectory in which the table file is located. Default=’table1’.

offset : int (optional)

the integer index offset for choosing the desired bands.

Other Parameters:
 

data_home : str (optional)

Specify the local cache directory for the dataset. If not used, it will default to the astroML default location.

url : str (optional)

Specify the URL of the datasets. Defaults to webpage associated with Sesar 2010.

force_download : bool (optional)

If true, then force re-downloading data even if it is already cached locally. Default is False.

Examples

>>> rrlyrae = fetch_rrlyrae(partial=True)
>>> len(rrlyrae.ids)
483
>>> lcid = rrlyrae.ids[0]
>>> t, mag, dmag, filts = rrlyrae.get_lightcurve(lcid)
>>> t[:4]
array([ 51081.347856,  51819.42063 ,  52288.076401,  52551.350526])

Attributes

filenames
ids
ids_gen

Methods

from_rrlyrae(rrlyrae[, offset])
get_lightcurve(star_id[, return_1d])
get_metadata(lcid) Get the parameters derived from the fit for the given id.
get_obsmeta(lcid) Get the observation metadata for the given id.
class gatspy.datasets.RRLyraeTemplates(tablename='RRLyr_ugriz_templates.tar.gz', cache_kwargs=None)[source]

Container to access the RR Lyrae templates from Sesar 2010

This should generally not be instantiated directly, but rather is returned by fetch_rrlyrae_templates().

Parameters:

tablename : str (optional)

Name of the file from which templates will be extracted. Default is ‘RRLyr_ugriz_templates.tar.gz’

cache_kwargs : dict (optional)

Additional keyword arguments passed to the data cache. Valid options are data_home, url, and force_download

Examples

>>> templates = fetch_rrlyrae_templates()
>>> templates.ids[:5]
['0g', '0i', '0r', '0u', '0z']
>>> phase, mag = templates.get_template('0g')
>>> phase[:5]
array([ 0.   ,  0.002,  0.004,  0.006,  0.008])
>>> mag[:5]
array([ 0.   ,  0.   ,  0.   ,  0.   ,  0.001])

Attributes

filenames List of template filenames
ids List of template ids

Methods

get_template(template_id) Get a particular lightcurve template
filenames

List of template filenames

get_template(template_id)[source]

Get a particular lightcurve template

Parameters:

template_id : str

id of desired template

Returns

——-

phase : ndarray

array of phases

mag : ndarray

array of normalized magnitudes

ids

List of template ids

class gatspy.datasets.RRLyraeGenerated(lcid, random_state=None)[source]

Generate RR Lyrae light curves from Sesar 2010 lightcurves

Parameters:

lcid : int

Valid light curve ID from the Sesar 2010 RR Lyrae dataset

random_state : int

Random number generator seed

Examples

>>> rrlyrae = fetch_rrlyrae()
>>> lcid = rrlyrae.ids[0]
>>> gen = RRLyraeGenerated(lcid, random_state=0)
>>> gen.period
0.61431831
>>> mag = gen.generated('g', [51080.0, 51080.5], err=0.3)
>>> mag.round(2)
array([ 17.74,  17.04])

Attributes

period Period (in days) of the RR Lyrae
lcdata (RRLyraeLC object) Container for the RR Lyrae light curve dataset
templates (RRLyraeTemplates object) Container for the RR Lyrae template dataset

Methods

generated(band, t[, err, corrected]) Return generated magnitudes in the specified band
observed(band[, corrected]) Return observed values in the given band
generated(band, t, err=None, corrected=True)[source]

Return generated magnitudes in the specified band

Parameters:

band : str

desired bandpass: should be one of [‘u’, ‘g’, ‘r’, ‘i’, ‘z’]

t : array_like

array of times (in days)

err : float or array_like

gaussian error in observations

corrected : bool (optional)

If true, correct for extinction

Returns:

mag : ndarray

magnitudes at the specified times under the generated model.

observed(band, corrected=True)[source]

Return observed values in the given band

Parameters:

band : str

desired bandpass: should be one of [‘u’, ‘g’, ‘r’, ‘i’, ‘z’]

corrected : bool (optional)

If true, correct for extinction

Returns:

t, mag, dmag : ndarrays

The times, magnitudes, and magnitude errors for the specified band.

period

Period (in days) of the RR Lyrae