Metadata-Version: 2.4
Name: getCalspec
Version: 2.3.4
Summary: Python package to download Calspec spectra
Author-email: "J. Neveu" <jeremy.neveu@universite-paris-saclay.fr>
License: BSD-3-Clause
Project-URL: Homepage, https://github.com/LSSTDESC/getCalspec
Project-URL: Documentation, https://getcalspec.readthedocs.io
Project-URL: Repository, https://github.com/LSSTDESC/getCalspec
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Astronomy
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>1.15
Requires-Dist: matplotlib>3.1
Requires-Dist: pandas
Requires-Dist: astropy
Requires-Dist: astroquery
Requires-Dist: lxml
Requires-Dist: beautifulsoup4
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-flake8; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Dynamic: license-file

[![PyPI version](https://badge.fury.io/py/getCalspec.svg)](https://badge.fury.io/py/getCalspec)
[![Documentation Status](https://readthedocs.org/projects/getcalspec/badge/?version=latest)](https://getcalspec.readthedocs.io/en/latest/?badge=latest)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# getCalspec
Python package to download Calspec spectra.

The main function query the Calspec table located in `calspec_data/calspec.csv`
to download spectrum FITS files from [STSC archive](https://www.stsci.edu/hst/instrumentation/reference-data-for-calibration-and-tools/astronomical-catalogs/calspec.html).

Example:
```
from getCalspec.getCalspec import *

test = is_calspec("eta1 dor")
c = Calspec("eta1 dor")
print("Gaia source id:", c.source_id)
c.get_spectrum_table(type="stis", date="latest")  # download and return an Astropy table
c.get_spectrum_numpy(type="mod", date="2010-12-11")  # download and return a dictionnary of numpy arrays with units
c.plot_spectrum()  # download and plot the spectrum
```

To get Calspec table and the list of available Calspec names:
```
from getCalspec.getCalspec import getCalspecDataFrame

df = getCalspecDataFrame()
print(df.Name.values)
# Gaia IDs
print(df.source_id.values)
```


To get all Calspec data in one time in cache, write:
```
from getCalspec.rebuild import rebuild_cache
rebuild_cache()
```

When the [STSC webpage](https://www.stsci.edu/hst/instrumentation/reference-data-for-calibration-and-tools/astronomical-catalogs/calspec) is updated,
it might be necessary to rebuild the `calspec_data/calspec.csv` table and the cache:
```
from getCalspec.rebuild import rebuild_tables, rebuild_cache
rebuild_tables()
rebuild_cache()
```
