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:
pip install rainbowkit
RainbowKit requires Python 3.8 or later.
Quick start
Import RainbowKit:
import rainbowkit
RainbowKit includes an example spectrum, which can be loaded directly:
spec = rainbowkit.Spectrum()
or your own spectrum file:
spec = rainbowkit.Spectrum("my_spectrum.dat")
You can then plot the spectrum:
spec.fplot()
or plot the normalized spectrum:
spec.nfplot()
The input file should contain four columns:
- Wavelength
- Flux
- Error
- Continuum
Important spectral transitions can be marked on the spectrum:
spec.marklines()
The lines can also be shifted according to a redshift:
spec.marklines(z=3.0)
RainbowKit can estimate the redshift of a spectral transition interactively.
For example:
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:
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
Metadata
Release files for rainbowkit 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rainbowkit-0.0.3.tar.gz | 876.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rainbowkit-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.8 MB
Release files / rainbowkit-0.0.3.tar.gz
| Download URL | rainbowkit-0.0.3.tar.gz |
|---|---|
| Size | 876.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adf2a05281b8eee6fec37c0e45ec28c8e05726fb5687a7a20c1087b867273921
|
|
BLAKE2b-256 checksum How to use checksums |
51b2df759ba572cf66411a6cf42234cad0bbcee40046d2a9e45c427774c2dcb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / rainbowkit-0.0.3-py3-none-any.whl
| Download URL | rainbowkit-0.0.3-py3-none-any.whl |
|---|---|
| Size | 885.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
680ee3698a7a27828d9cbb03d8aac56b460081ed998f504479804f0825b5137e
|
|
BLAKE2b-256 checksum How to use checksums |
956eb879bf011fce133c05e736f6911ee5a8c1cd9dedd276f6f190dc66fd855d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|