Metadata-Version: 2.4
Name: gelsa
Version: 4.0
Summary: Advanced tools for Euclid grism spectroscopy
Author-email: Ben Granett <benjamin.granett@inaf.it>
License-Expression: MIT AND Apache-2.0
Project-URL: Homepage, https://github.com/elsa-euclid/gelsa
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: gelsa/_vendor/LICENSE.fast_interp
Requires-Dist: numpy>=1.21.6
Requires-Dist: scipy>=1.11
Requires-Dist: numba>=0.56
Requires-Dist: matplotlib>=3.5
Requires-Dist: astropy>=5.0
Requires-Dist: healpy>=1.17
Requires-Dist: h5py>=3.7
Requires-Dist: joblib>=1.3
Requires-Dist: reproject>=0.9
Requires-Dist: scikit-image>=0.19
Requires-Dist: azulero>=2.1
Requires-Dist: astroquery>=0.4.10
Requires-Dist: ipywidgets>=7.6
Requires-Dist: ipython>=8.0
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: ruff>=0.2; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: pydata-sphinx-theme; extra == "docs"
Requires-Dist: sphinx-design; extra == "docs"
Dynamic: license-file

GELSA: Advanced tools for Euclid grism spectroscopy
===================================================

Overview
--------

*GELSA* is a Python library to facilitate the analysis of 2D dispersed images from *Euclid*'s slitless spectroscopic observations. Developed as part of the [ELSA project](https://elsa-euclid.github.io) (Euclid Legacy Science Advanced analysis tools),
GELSA builds on the products of the Euclid Science Ground Segment and SIR processing function.


**Links**
* [Documentation](https://elsa-euclid.github.io/gelsa/)
* [Notebooks](https://github.com/elsa-euclid/gelsa-notebooks)
* [Source code](https://github.com/elsa-euclid/gelsa)

**Key Features:**

*   **Data handling:** Read *Euclid* SGS data products.
*   **Spectra location:** Map between sky (RA, Dec), wavelength, and detector pixel coordinates using SIR instrument models.
*   **Simulation:** Generate NISP spectrograms based on source properties and instrument models.
*   **Spectral extraction:** Extract 1D and 2D spectra with decontamination modelling.
*   **Emission line maps:** Remap spectra to make spatial emission line maps.
*   **Visualization:** Routines for displaying spectrograms and associated data.


Contributors
------------

Ben Granett (benjamin.granett@inaf.it), Louis Gabarra, Fabio Rigamonti, Francesca Passalacqua, Federico Lepri, Nadir El Ariny



Install
-------

```
python -m pip install git+https://github.com/elsa-euclid/gelsa.git
```

For development, clone the repository and install in editable mode:
```
python -m pip install -e ".[dev]"
```

Usage
-----

On [ESA Datalabs](https://datalabs.esa.int) the SIR calibration files are found automatically; elsewhere, pass `calibdir`.
The following code loads a SIR science frame, cuts out the spectrum of a source, and displays it.

```python
import gelsa
from gelsa import visu

G = gelsa.Gelsa()

frame = G.load_spec_frame("EUC_SIR_W-SCIFRM_....fits")

ra, dec, z = 150.09382, 2.503955, 0.751
crops = frame.cutout(ra, dec, z)     # one SpecCrop per detector the trace falls on

for det, crop in crops.items():
    visu.show(crop, levels=(1, 99))
```

See the [documentation](https://elsa-euclid.github.io/gelsa/) for simulations, stacking many exposures and emission line maps.

License
-------

`gelsa` is released under the MIT License (see `LICENSE`).

Third-party code
----------------

`gelsa/_vendor/fast_interp.py` is a lightly modified copy of [fast_interp](https://github.com/dbstein/fast_interp) by David Stein, distributed under the Apache License 2.0 (see `gelsa/_vendor/LICENSE.fast_interp`).

Acknowledgments
---------------

<img src="https://raw.githubusercontent.com/elsa-euclid/gelsa/main/docs/_static/EN_FundedbytheEU_RGB_POS.png" alt="EU Funding" width="150">
“ELSA: Euclid Legacy Science Advanced analysis tools” (Grant Agreement no. 101135203) is funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or Innovate UK. Neither the European Union nor the granting authority can be held responsible for them. UK participation is funded through the UK Horizon guarantee scheme under Innovate UK grant 10093177.
