Skip to main content

A Python library for classifying stellar spectra based on the MKCLASS package

Project description

NutMaat

NutMaat

GitHub Created At GitHub License GitHub last commit GitHub repo size GitHub Issues or Pull Requests PyPI - Python Version Maintenance PyPI - Version

GitHub watchers GitHub Repo stars GitHub forks

NutMaat is a Python package designed to classify stellar spectra on the MK Spectral Classification system in a way similar to humans—by direct comparison with the MK classification standards, based on the MKCLASS C package. The package is OS-independent, installable via pip, and integrated with to work with pandas data frames.

Table of Contents

Features

  • Spectral type determination by comparison to a standard library
  • Detecting a number of spectral peculiarities, e.g. barium stars, carbon-rich giants, Am stars, etc.
  • Evaluating the quality of the classification
  • Capablity of classifying spectra in the violet–green region in either the rectified or flux-calibrated format
  • No need to correct for reddening
  • Possibility to use custom standard libraries
  • Batching large number of stars for classification

spectral type results

luminosity class error histogram

Installation

NutMaat requires:

  • numpy>=2.0.0
  • pandas==2.2.2
  • scipy>=1.14.0
  • tqdm>=4.66.5

To install NutMaat, simply use pip:

pip install NutMaat

Alternatively, you can install it directly from the source by cloning the repository:

git clone https://github.com/rehamelkholy/nutmaat.git
cd NutMaat
python setup.py install

Usage

Here's a quick example showing how to use NutMaat to classify a stellar spectrum from file:

from NutMaat.classifier import Classifier

# initializing the classifier
clf = Classifier()

# defining the file_path
file_path = <your_file_path>

# applying classification method
result = clf.classify_spectrum(2, 3, from_file=True, file_name=file_path)

# printing the result
print(result)

For more advanced use cases such as classifying using pandas data frames, classifying several spectra at a time, or rebinning or smoothing spectra prior to classification, refer to the examples folder.

Documentation

NutMaat comes with comprehensive docstrings embedded within the code. You can easily access the documentation for any function or class by using Python’s built-in help() function. For example:

from NutMaat.classifier import Classifier
help(Classifier.classify_spectrum)

Citing NutMaat

If you use NutMaat in your research or publications, please cite it using the following BibTeX entry:

@misc{nutmaat2024,
  author = {{El-Kholy}, R.~I. and {Hayman}, Z.~M.},
  title  = {NutMaat: A Python library for classifying stellar spectra based on the MKCLASS package},
  year   = {2024},
  doi    = {10.5281/zenodo.13945430},
  url    = {https://github.com/rehamelkholy/NutMaat},
}

Since NutMaat is based upon the C package MCCLASS, please also cite the following paper:

@article{mcclass2014,
  author = {{Gray}, R.~O. and {Corbally}, C.~J.},
  title = "{An Expert Computer Program for Classifying Stars on the MK Spectral Classification System}",
  journal = {\aj},
  year = 2014,
  volume = {147},
  number = {4},
  pages = {80},
  doi = {10.1088/0004-6256/147/4/80},
}

Additionally, we appreciate it if you mention NutMaat in the acknowledgments section of your papers or reports.

Contact

If you have any questions, feedback, or need assistance, feel free to reach out:

License

NutMaat is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nutmaat-0.1.1.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

NutMaat-0.1.1-py3-none-any.whl (50.4 kB view details)

Uploaded Python 3

File details

Details for the file nutmaat-0.1.1.tar.gz.

File metadata

  • Download URL: nutmaat-0.1.1.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for nutmaat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5e9b9f848f9cae4796f6bdf190859e076852ebd284bd18ee8c600acc003cdba6
MD5 71b47d365591e7b25d681dfa23346e57
BLAKE2b-256 c9e11c7dbeeeeb36fdbe2d3765fd9da106c97a8849fc2517385f4d17138be925

See more details on using hashes here.

File details

Details for the file NutMaat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: NutMaat-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 50.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for NutMaat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48aa2dea9a2d0e5d17156bb14e898a3d7d4b1c2b729568882daee40f127e9e1e
MD5 995ea93f9d212c27a99a3fe5ee576a6a
BLAKE2b-256 b51b8122bc2abe77bb4eeebfd768dd3a9627484095f199469001a6f552f5f69a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page