.. image:: _static/logos/logo_skycalc_ipy_t.png
    :width: 600 px
    :alt: Welcome to the SkyCalc-iPy Documentation!
    :align: center

|logo| Another tool from the `A* Vienna software team <https://astarvienna.github.io/>`_

.. |logo| image:: https://raw.githubusercontent.com/AstarVienna/astarvienna.github.io/main/logos/star_small_t.png
   :height: 30px
   :align: middle


A SkyCalc wrapper for Interactive Python
----------------------------------------

SkyCalc-iPy ("SkyCalc for Interactive PYthon") is a package for accessing
atmospheric emission and transmission data generated by ESO's SkyCalc tool
interactively with Python.

This package is based on the `command line tool by ESO`_ for accessing spectra
on the ESO SkyCalc server. For references to SkyCalc see `ESO SkyCalc`_,
`Noll et al. (2012)`_, and `Jones et al. (2013)`_.

.. _ESO SkyCalc: https://www.eso.org/observing/etc/bin/gen/form?INS.MODE=swspectr+INS.NAME=SKYCALC
.. _command line tool by ESO: https://www.eso.org/observing/etc/doc/skycalc/helpskycalccli.html

.. _Noll et al. (2012): http://www.aanda.org/articles/aa/abs/2012/07/aa19040-12/aa19040-12.html
.. _Jones et al. (2013): http://www.aanda.org/articles/aa/full_html/2013/12/aa22433-13/aa22433-13.html

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   GettingStarted
   Reference API <reference/skycalc_ipy>

Installation
------------

Skycalc_ipy is available on PyPi::

    pip install skycalc_ipy

This is still the very first version of SkyCalc iPy, so please open an issue on
GithHub if you find any bugs, or if would like to see different functionality
included.

https://github.com/AstarVienna/skycalc_ipy/issues


Dependencies
------------

The following packages are required for normal operation:

* :mod:`httpx`
* :mod:`pyyaml`
* :mod:`numpy`
* :mod:`astropy`
* :mod:`astar-utils`

The following packages are optional:

* :mod:`matplotlib`
* :mod:`synphot`

Changelog
---------

Please see https://github.com/AstarVienna/skycalc_ipy/releases for the changelog
from version 0.1.4 onwards. For pre-v0.1.4 changes see below.

.. versionchanged:: 0.1.3

   Updated default values for `wmax`, `wgrid_mode`, `wres`

   SkyCalc-ipy now uses a logarithmic wavelength binning with R=1000 over the
   fully available SkyCalc wavelength range of [0.3, 30] um

   - `wmax`: --> `30000  # [nm]`
   - `wgrid_mode`: --> `fixed_spectral_resolution`
   - `wres`: --> `1000`  `[wres = wave/dwave]`

.. versionchanged:: 0.1.3

   No longer saves a temporary FITS file to disk.

   SkyCalc now uses astropy to download the fits file from the SkyCalc server.
   The HDUList is now stored internally in `<SkyCalc>.last_skycalc_response`.

.. versionchanged:: 0.1.2

   Upgrade fixes PyYaml warning/error for PyYaml >=6.0

   SkyCalc-ipy v0.1.1 is only compatible with versions of PyYaml <=5.4.
   PyYaml v6+ removed backwards compatibility by forcing the user to pass a
   Loader object when reading YAML files. SkyCalc-ipy v0.1.0 and v0.1.1 does
   not do this.
