feets.datasets package¶
Submodules¶
feets.datasets.base module¶
Base code for IO dataset retrieval
-
class
feets.datasets.base.
Bunch
(data=None, **kwargs)[source]¶ Bases:
collections.abc.Mapping
Container object for datasets Dictionary-like object that exposes its keys as attributes.
>>> b = Bunch(a=1, b=2) >>> b['b'] 2 >>> b.b 2 >>> b.a = 3 >>> b['a'] 3 >>> b.c = 6 >>> b['c'] 6
Methods
get
((k[,d]) -> D[k] if k in D, …)items
(…)keys
(…)values
(…)
-
class
feets.datasets.base.
Data
(id, ds_name, description, bands, metadata, data) → None[source]¶ Bases:
collections.abc.Mapping
This object encapsulates a full data with their metadata.
Attributes
id (any object or None) the id of the lightcurve or None ds_name (str) The name of the dataset description (str) description about the dataset bands (tuple) the names of the attributes inside data metadata (dict-like) arbitrary data. data (dict-like) lightcurves collection in a dint-like object Methods
get
((k[,d]) -> D[k] if k in D, …)items
(…)keys
(…)values
(…)
-
class
feets.datasets.base.
LightCurve
(time, magnitude, error=None, magnitude2=None, aligned_time=None, aligned_magnitude=None, aligned_magnitude2=None, aligned_error=None, aligned_error2=None) → None[source]¶ Bases:
feets.datasets.base.LightCurveBase
,collections.abc.Mapping
Methods
get
((k[,d]) -> D[k] if k in D, …)items
(…)keys
(…)values
(…)
-
class
feets.datasets.base.
LightCurveBase
(time, magnitude, error=None, magnitude2=None, aligned_time=None, aligned_magnitude=None, aligned_magnitude2=None, aligned_error=None, aligned_error2=None) → None¶ Bases:
object
-
feets.datasets.base.
clear_data_home
(data_home=None)[source]¶ Delete all the content of the data home cache.
Parameters: data_home : str | None
The path to feets data dir.
-
feets.datasets.base.
fetch
(url, dest, force=False)[source]¶ Retrieve data from an url and store it into dest.
Parameters: url: str
Link to the remote data
dest: str
Path where the file must be stored
force: bool (default=False)
Overwrite if the file exists
Returns: cached: bool
True if the file already exists
dest: str
The same string of the parameter
-
feets.datasets.base.
get_data_home
(data_home=None)[source]¶ Return the path of the feets data dir.
This folder is used by some large dataset loaders to avoid downloading the data several times.
By default the data dir is set to a folder named ‘feets_data’ in the user home folder.
Alternatively, it can be set by the ‘feets_DATA’ environment variable or programmatically by giving an explicit folder path. The ‘~’ symbol is expanded to the user home folder.
If the folder does not already exist, it is automatically created.
Parameters: data_home : str | None
The path to feets data dir.
feets.datasets.macho module¶
IO code for read some macho lightcurves
The files are gathered from the original FATS project tutorial: https://github.com/isadoranun/tsfeat
-
feets.datasets.macho.
available_MACHO_lc
()[source]¶ Retrieve a list with the available MACHO lightcurves
-
feets.datasets.macho.
load_MACHO
(macho_id)[source]¶ lightcurve of 2 bands (R, B) from the MACHO survey.
Notes
The files are gathered from the original FATS project tutorial: https://github.com/isadoranun/tsfeat
-
feets.datasets.macho.
load_MACHO_example
()[source]¶ lightcurve of 2 bands (R, B) from the MACHO survey. The Id of the source is 1.3444.614
Notes
The files are gathered from the original FATS project tutorial: https://github.com/isadoranun/tsfeat
feets.datasets.ogle3 module¶
Code for acces the OGLE-III On-line Catalog of Variable Stars.
The main goal of this catalog is to record all variable sources located in the OGLE-III fields in the Magellanic Clouds and Galactic bulge. The data currently available include:
- classical Cepheids in the Galactic Bulge, LMC and SMC,
- type II Cepheids in the Galactic Bulge, LMC and SMC,
- anomalous Cepheids in LMC and SMC,
- RR Lyrae stars in the Galactic Bulge, LMC and SMC,
- Long Period Variables in the Galactic Bulge, LMC and SMC,
- Double Period Variables in LMC,
- R CrB stars in LMC,
- Delta Sct stars in LMC.
The catalog data include basic parameters of the stars (coordinates, periods, mean magnitudes, amplitudes, parameters of the Fourier light curve decompositions), VI multi-epoch photometry collected since 2001, and for some stars supplemented with the OGLE-II photometry obtained between 1997 and 2000, finding charts and cross-identifications with previously published catalogs.
Note to the user: If you use or refer to the data obtained from this catalog in your scientific work, please cite the appropriate papers:
- Udalski, Szymanski, Soszynski and Poleski, 2008, Acta Astron., 58, 69 (OGLE-III photometry)
- Soszynski et al., 2008a, Acta Astron., 58, 163 (Classical Cepheids in the LMC)
- Soszynski et al., 2008b, Acta Astron., 58, 293 (Type II and Anomalous Cepheids in the LMC)
- Soszynski et al., 2009a, Acta Astron., 59, 1 (RR Lyrae Stars in the LMC)
- Soszynski et al., 2009b, Acta Astron., 59, 239 (Long Period Variables in the LMC)
- Soszynski et al., 2009c, Acta Astron., 59, 335 (R CrB Variables in the LMC)
- Poleski et al., 2010a, Acta Astron., 60, 1 (δ Scuti Variables in the LMC)
- Poleski et al., 2010b, Acta Astron., 60, 179 (Double Period Variables in the LMC)
- Soszynski et al., 2010a, Acta Astron., 60, 17 (Classical Cepheids in the SMC)
- Soszynski et al., 2010b, Acta Astron., 60, 91 (Type II Cepheids in the SMC)
- Soszynski et al., 2010c, Acta Astron., 60, 165 (RR Lyrae Stars in the SMC)
- Soszynski et al., 2011a, Acta Astron., 61, 1 (RR Lyrae Stars in the Galactic Bulge)
- Soszynski et al., 2011b, Acta Astron., 61, 217 (Long-Period Variables in the Small Magellanic Cloud)
- Soszynski et al., 2011c, Acta Astron., 61, 285; 2013b, Acta Astron., 63, 37; (Classical and Type II Cepheids in the Galactic Bulge)
- Soszynski et al., 2013a, Acta Astron., 63, 21 (Long-Period Variables in the Galactic Bulge)
More Info: http://ogledb.astrouw.edu.pl/~ogle/CVS/
-
feets.datasets.ogle3.
fetch_OGLE3
(ogle3_id, data_home=None, metadata=None, download_if_missing=True)[source]¶ Retrieve a lighte curve from OGLE-3 database
Parameters: ogle3_id : str
The id of the source (see:
load_OGLE3_catalog()
for available sources.data_home : optional, default: None
Specify another download and cache folder for the datasets. By default all feets data is stored in ‘~/feets’ subfolders.
metadata : bool | None
If it’s True, the row of the dataframe from
load_OGLE3_catalog()
with the metadata of the source are added to the result.download_if_missing : optional, True by default
If False, raise a IOError if the data is not locally available instead of trying to download the data from the source site.
Returns: A Data object.
Examples
>>> ds = fetch_OGLE3("OGLE-BLG-LPV-232377") >>> ds Data(id='OGLE-BLG-LPV-232377', ds_name='OGLE-III', bands=('I', 'V')) >>> ds.bands ('I', 'V') >>> ds.data.I LightCurve(time[100], magnitude[100], error[100]) >>> ds.data.I.magnitude array([ 13.816, 13.826, 13.818, 13.812, 13.8 , 13.827, 13.797, 13.82 , 13.804, 13.783, 13.823, 13.8 , 13.84 , 13.817, 13.802, 13.824, 13.822, 13.81 , 13.844, 13.848, 13.813, 13.836, 13.83 , 13.83 , 13.837, 13.811, 13.814, 13.82 , 13.826, 13.822, 13.821, 13.817, 13.813, 13.809, 13.817, 13.836, 13.804, 13.801, 13.813, 13.823, 13.818, 13.831, 13.833, 13.814, 13.814, 13.812, 13.822, 13.814, 13.818, 13.817, 13.8 , 13.804, 13.799, 13.809, 13.815, 13.846, 13.796, 13.791, 13.804, 13.853, 13.839, 13.816, 13.825, 13.81 , 13.8 , 13.807, 13.819, 13.829, 13.844, 13.84 , 13.842, 13.818, 13.801, 13.804, 13.814, 13.821, 13.821, 13.822, 13.82 , 13.803, 13.813, 13.826, 13.855, 13.865, 13.854, 13.828, 13.809, 13.828, 13.833, 13.829, 13.816, 13.82 , 13.827, 13.834, 13.811, 13.817, 13.808, 13.834, 13.814, 13.829])
feets.datasets.synthetic module¶
Synthetic light curve generator.
-
feets.datasets.synthetic.
create_normal
(mu=0.0, sigma=1.0, mu_err=0.0, sigma_err=1.0, seed=None, **kwargs)[source]¶ - Generate a data with magnitudes that follows a Gaussian
- distribution. Also their errors are gaussian.
Parameters: mu : float (default=0)
Mean of the gaussian distribution of magnitudes
sigma : float (default=1)
Standar deviation of the gaussian distribution of magnitude errors
mu_err : float (default=0)
Mean of the gaussian distribution of magnitudes
sigma_err : float (default=1)
Standar deviation of the gaussian distribution of magnitude errorrs
seed : {None, int, array_like}, optional
Random seed used to initialize the pseudo-random number generator. Can be any integer between 0 and 2**32 - 1 inclusive, an array (or other sequence) of such integers, or None (the default). If seed is None, then RandomState will try to read data from /dev/urandom (or the Windows analogue) if available or seed from the clock otherwise.
kwargs : optional
extra arguments for create_random.
Returns: data
A Data object with a random lightcurves.
Examples
>>> ds = create_normal(0, 1, 0, .0008, seed=42) >>> ds Data(id=None, ds_name='feets-synthetic', bands=('B', 'V')) >>> ds.data.B LightCurve(time[10000], magnitude[10000], error[10000]) >>> ds.data.B.time array([ 0.00000000e+00, 1.00010001e-04, 2.00020002e-04, ..., 9.99799980e-01, 9.99899990e-01, 1.00000000e+00])
-
feets.datasets.synthetic.
create_periodic
(mu_err=0.0, sigma_err=1.0, seed=None, **kwargs)[source]¶ - Generate a data with magnitudes with periodic variability
- distribution; the error instead are gaussian.
Parameters: mu_err : float (default=0)
Mean of the gaussian distribution of magnitudes
sigma_err : float (default=1)
Standar deviation of the gaussian distribution of magnitude errorrs
seed : {None, int, array_like}, optional
Random seed used to initialize the pseudo-random number generator. Can be any integer between 0 and 2**32 - 1 inclusive, an array (or other sequence) of such integers, or None (the default). If seed is None, then RandomState will try to read data from /dev/urandom (or the Windows analogue) if available or seed from the clock otherwise.
kwargs : optional
extra arguments for create_random.
Returns: data
A Data object with a random lightcurves.
Examples
>>> ds = synthetic.create_periodic(bands=["Ks"]) >>> ds Data(id=None, ds_name='feets-synthetic', bands=('Ks',)) >>> ds.data.Ks.magnitude array([ 0.95428053, 0.73022685, 0.03005121, ..., -0.26305297, 2.57880082, 1.03376863])
-
feets.datasets.synthetic.
create_random
(magf, magf_params, errf, errf_params, timef=<function linspace>, timef_params=None, size=10000, id=None, ds_name='feets-synthetic', description='Lightcurve created with random numbers', bands=('B', 'V'), metadata=None)[source]¶ Generate a data with any given random function.
Parameters: magf : callable
Function to generate the magnitudes.
magf_params : dict-like
Parameters to feed the magf function.
errf : callable
Function to generate the magnitudes.
errf_params : dict-like
Parameters to feed the errf function.
timef : callable, (default=numpy.linspace)
Function to generate the times.
timef_params : dict-like or None, (default={“start”: 0., “stop”: 1.})
Parameters to feed the timef callable.
size : int (default=10000)
Number of obervation of the light curves
id : object (default=None)
Id of the created data.
ds_name : str (default=”feets-synthetic”)
Name of the dataset
description : str (default=”Lightcurve created with random numbers”)
Description of the data
bands : tuple of strings (default=(“B”, “V”))
The bands to be created
metadata : dict-like or None (default=None)
The metadata of the created data
Returns: data
A Data object with a random lightcurves.
Examples
>>> from numpy import random >>> create_random( ... magf=random.normal, magf_params={"loc": 0, "scale": 1}, ... errf=random.normal, errf_params={"loc": 0, "scale": 0.008}) Data(id=None, ds_name='feets-synthetic', bands=('B', 'V'))
-
feets.datasets.synthetic.
create_uniform
(low=0.0, high=1.0, mu_err=0.0, sigma_err=1.0, seed=None, **kwargs)[source]¶ - Generate a data with magnitudes that follows a uniform
- distribution; the error instead are gaussian.
Parameters: low : float, optional
Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.
high : float, optional
Upper boundary of the output interval. All values generated will be less than high. The default value is 1.0.
mu_err : float (default=0)
Mean of the gaussian distribution of magnitudes
sigma_err : float (default=1)
Standar deviation of the gaussian distribution of magnitude errorrs
seed : {None, int, array_like}, optional
Random seed used to initialize the pseudo-random number generator. Can be any integer between 0 and 2**32 - 1 inclusive, an array (or other sequence) of such integers, or None (the default). If seed is None, then RandomState will try to read data from /dev/urandom (or the Windows analogue) if available or seed from the clock otherwise.
kwargs : optional
extra arguments for create_random.
Returns: data
A Data object with a random lightcurves.
Examples
>>> ds = synthetic.create_uniform(1, 2, 0, .0008, 42) >>> ds Data(id=None, ds_name='feets-synthetic', bands=('B', 'V')) >>> ds.data.B.magnitude array([ 1.37454012, 1.95071431, 1.73199394, ..., 1.94670792, 1.39748799, 1.2171404 ])
Module contents¶
The feets.datasets
module includes utilities to load datasets,
including methods to load and fetch some example light curves.