Metadata-Version: 2.4
Name: rainbowkit
Version: 0.0.3
Summary: Tools to work with spectra
Author-email: Sourav Das <souravdas.sd20@gmail.com>
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: matplotlib
Dynamic: license-file

# RainbowKit

RainbowKit is a Python toolkit for spectral analysis. It allows you to create spectrum objects and perform various tasks, such as plotting spectra, marking spectral lines, and estimating redshifts from observed spectral transitions.

## Features

- Create and manipulate spectrum objects
- Plot flux versus wavelength
- Plot normalized flux
- Mark important spectral lines for analysis
- Estimate redshift from spectral transitions

## Installation

You can install RainbowKit using pip:

```bash
pip install rainbowkit
```

RainbowKit requires Python 3.8 or later.

## Quick start

Import RainbowKit:

```python
import rainbowkit
```

RainbowKit includes an example spectrum, which can be loaded directly:

```python
spec = rainbowkit.Spectrum()
```

or your own spectrum file:

```python
spec = rainbowkit.Spectrum("my_spectrum.dat")
```

You can then plot the spectrum:

```python
spec.fplot()
```

or plot the normalized spectrum:

```python
spec.nfplot()
```

The input file should contain four columns:

1. Wavelength
2. Flux
3. Error
4. Continuum

Important spectral transitions can be marked on the spectrum:

```python
spec.marklines()
```

The lines can also be shifted according to a redshift:

```python
spec.marklines(z=3.0)
```

RainbowKit can estimate the redshift of a spectral transition interactively.

For example:

```python
spec.getz("CIV_1548")
```

After calling this method, click on the observed transition in the plotted spectrum.
RainbowKit will calculate and print the corresponding redshift.

## Example workflow

A minimal working example:

```python
import rainbowkit

spec = rainbowkit.Spectrum()  # default example spectrum
# For user-provided spectrum
# spec = rainbowkit.Spectrum('my_spectrum.dat')

spec.nfplot()
spec.marklines()
```

## Input Spectrum Format

RainbowKit expects a plain-text spectrum containing four columns:

| Column | Description |
|---|---|
| 1 | Wavelength |
| 2 | Flux |
| 3 | Error |
| 4 | Continuum |

The columns should be separated by whitespace.

## Requirements

- Python >= 3.8
- NumPy
- Matplotlib

## Acknowledgements

I would like to thank Prof. Sowgat Muzahid at the Inter-University Centre for Astronomy and Astrophysics (IUCAA), who was my MSc supervisor, for his guidance and support during the development of this work.

I am particularly grateful to him for providing the spectral line lists and the example spectrum included with RainbowKit.

## License

RainbowKit is released under the MIT License. See the `LICENSE` file for details.

## Author

[Sourav Das](https://github.com/PhysicistSouravDas "PhysicistSouravDas GitHub page")

