Metadata-Version: 2.4
Name: specex
Version: 1.1.1
Summary: Extract spectra from fits cubes
Author: Maurizio D'Addona
Author-email: mauritiusdadd@gmail.com
Maintainer: Maurizio D'Addona
Maintainer-email: mauritiusdadd@gmail.com
License: GPL-3.0-or-later
Project-URL: documentation, https://python-specex.readthedocs.io/en/latest
Project-URL: repository, https://github.com/mauritiusdadd/python-specex
Keywords: spectroscopy,spectra,spectrum,spectral cubes
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: astropy
Requires-Dist: specutils
Requires-Dist: matplotlib
Requires-Dist: rich>=15.0.0
Provides-Extra: animations
Requires-Dist: imageio; extra == "animations"
Provides-Extra: regions
Requires-Dist: regions>=0.11; extra == "regions"
Provides-Extra: advanced
Requires-Dist: reproject>=0.19.0; extra == "advanced"
Provides-Extra: all
Requires-Dist: specex[advanced,animations,regions]; extra == "all"
Provides-Extra: test
Requires-Dist: coverage; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: specex[all]; extra == "test"
Dynamic: license-file

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7808292.svg)](https://doi.org/10.5281/zenodo.7808292) [![Documentation Status](https://img.shields.io/readthedocs/python-specex)](https://python-specex.readthedocs.io/en/latest/?badge=latest) [![Build Status](https://github.com/mauritiusdadd/python-specex/actions/workflows/test_linux.yml/badge.svg)](https://github.com/mauritiusdadd/python-specex/actions/workflows/test_linux.yml) [![Coverage Status](https://coveralls.io/repos/github/mauritiusdadd/python-specex/badge.svg?branch=main)](https://coveralls.io/github/mauritiusdadd/python-specex?branch=main)


# python-specex

Extract spectra from fits cubes

# SETUP

To install the latest stable version of specex, just use pip:

    $ pip install specex

Some functionalities are enabled only if some optional packages are installed, these packages can be installed by pip when installing Specex by specifying the desired configuration, for example

    $ pip install specex[animations]

will install the packages required to use the command ``specex-cube-anim``, while with the command

    $ pip install specex[animations,regions]

you install packages required for animations and region file handling, and

    $ pip install specex[advanced]

installs ``reproject`` for external weightmap reprojection. To install all the optional dependencies use

    $ pip install specex[all]

To install the bleeding edge version, clone the github repository then use pip:

    $ git clone 'https://github.com/mauritiusdadd/python-specex.git'
    $ cd python-specex
    $ pip install .

# COMMAND-LINE TOOLS

Specex provides the following CLI entry points:

- `specex`: Extract IVOA-compliant 1D FITS spectra from datacubes using a source catalog or region file, with optional spatial weighting, background annulus subtraction (`--anulus-size`), air/vacuum wavelength detection and header propagation, `--from-air`/`--from-vac` overrides, and `--to-vac [METHOD]` air-to-vacuum conversion (`specutils`).
- `specex-cubestack`: Create 2D white-light images by stacking a datacube over optional wavelength intervals.
- `specex-cutout`: Extract spatial cutouts from datacubes, grayscale images, or RGB images using sky/pixel coordinates or region files.
- `specex-smooth`: Apply spatial and/or spectral smoothing to datacubes and variance extensions.
- `specex-plot`: Plot extracted 1D spectra with optional smoothing, cutouts, and redshifted spectral line overlays.
- `specex-cube-anim`: Generate animated GIFs scanning datacube slices around spectral lines.

# DOCUMENTATION

To build the documentation, install the requirements and run sphinx:

    $ pip install -r docs/requirements.txt
    $ sphinx-build -b html docs/ docs/_build/html

The full documentation is also available here: [https://python-specex.readthedocs.io/en/latest/index.html]

# ACKNOWLEDGMENTS

If you used this software for your research, please consider to cite the following article

https://doi.org/10.1051/0004-6361/202349060

```
@ARTICLE{DAddona2024,
  title     = "The powerful lens galaxy cluster {PLCK} G287.0+32.9
               ({$\vartheta$E} $\sim 43$ ′′)",
  author    = "D'Addona, M and Mercurio, A and Rosati, P and Grillo, C and
               Caminha, G and Acebron, A and Angora, G and Bergamini, P and
               Bozza, V and Granata, G and Annunziatella, M and Gargiulo, A and
               Gobat, R and Tozzi, P and Girardi, M and Lombardi, M and
               Meneghetti, M and Schipani, P and Tortorelli, L and Vanzella, E",
  journal   = "Astron. Astrophys.",
  publisher = "EDP Sciences",
  month     =  feb,
  year      =  2024,
}
```
