Usage#
Installation#
To use SpExod, first install it using pip:
pip install spexod
Or try one of the other installation methods.
conda install -c conda-forge spexod
Or
git clone https://github.com/spexod/spexod
cd spexod
pip install .
Retrieving Data#
Note
It may be helpful to view the DataFlow source page as you follow along with the documentation.
The following functions are used to retrieve almost all data from the database:
API.get_available_isotopologues()
, get_params_and_units()
, get_curated()
, get_spectra()
,
and get_star_aliases()
. Each of these functions returns a list of dictionaries, where each dictionary
represents a row in the database. The keys of the dictionaries are the column names of the database,
- spexod.api.get_available_isotopologues() list #
Returns a list of dictionaries of available isotopologues and their properties
- Returns:
A list of dictionaries of available isotopologues
- Return type:
list[dict]
- Exception:
requests.RequestException
- spexod.api.get_params_and_units() list #
Returns a list dictionaries of available parameters and units.
- Returns:
A list of dictionaries of available parameters and units
- Return type:
list[dict]
- Exception:
requests.RequestException
- spexod.api.get_curated() list #
Returns a list of dictionaries of ALL curated data and corresponding handles.
- Returns:
A list of dictionaries of curated data
- Return type:
list[dict]
- Exception:
requests.RequestException
- spexod.api.get_spectra() list #
Returns a dictionary of available spectra.
- Returns:
A list of dictionaries of available parameters and units
- Return type:
list[dict]
- Exception:
requests.RequestException
- spexod.api.get_star_aliases() list #
Returns a dictionary of star aliases and corresponding handles associated with alias.
- Returns:
A list of dictionaries star aliases
- Return type:
list[dict]
- Exception:
requests.RequestException
Misc Functions#
- spexod.api.get_stars_from_file(filename: str) list #
Retrieves a list of stars from a given file.
- Parameters:
filename (str) – The name of the file to read from
- Returns:
A list of stars from a given file
- Return type:
list
- Exception:
FileNotFoundError
- Exception:
pd.errors.EmptyDataError
- Exception:
pd.errors.ParserError
- spexod.api.create_spectra_file(stars: list) None #
Creates a CSV file with all spectra handles for a given list of stars
- Parameters:
stars (list) – A list of stars to search for
- Returns:
None
- spexod.api.download_spectrum(spectra: List) None #
Downloads spectra from the SpExoDisks database.
- Parameters:
spectra (list) – A list of spectra to download
- Returns:
None
- spexod.api.plot_spectra(wavelength, flux) None #
Plots a spectrum similar to the website.
- Parameters:
wavelength (list) – A list of wavelengths
flux (list) – A list of fluxes
- Returns:
None
Note
To see a working example of the API, check out the following jupyter notebook: spexod/spexod