Skip to main content

A package to simulate diatomic optical emission spectra relying on line-by-line databases compiled for MassiveOES

Project description

Logo

Moose: Molecular optical emission spectroscopy for Python

DOI PyPI - Version GitHub License PyPI build Docs build PyPI python versions PyPI Downloads Binder Ruff Hatch project

Welcome to Moose, a python package for simulating optical emission spectra for diatomic molecules.

Moose was born out of a need to fit rotational and vibrational temperatures for a large set of data.

For this it uses line-by-line databases, assuming a Boltzmann distribution for rotational and/or vibrational temperatures.

On top of that Moose is intended to be minimal: it provides you some basic tools to do just that, simulate some spectra.

It is up to you to read and sanitize experimental data, that you would like to fit based on these simulations, for instance.

In addition, Moose is quite adaptable: you can use it as a foundation for more elaborate models and analysis.

Put differently, Moose is aimed at helping you: you can integrate and adapt it to your workflow, rather than the reverse.

To get a better grasp of how it works under the hood, see the online documentation for code reference and examples.

Supported bands

Since Moose reuses the databases from MassiveOES, it supports the same bands for fitting. Details can be found in data_sources.txt, and the page with information on citing.

Molecule Band
OH A-X
N2+ B-X
NH A-X
NO B-X
N2 C-B
C2 Swan
CN B-X

Other bands

If you have suitable line-by-line data available for other molecular bands, you can also use Moose to fit those species.

You'd need to provide the data as a Dataframe that the function [create_stick_spectrum][https://antoinetue.github.io/Moose/latest/reference/Moose/Simulation/#Moose.Simulation.create_stick_spectrum] can work with, or write your own function.

Dependencies

Dependencies are mainly specified in the pyproject.toml. See below for a table of the core dependencies, which will be installed along with Moose if they are not present yet. Version numbers are just indications of the package versions that were used to develop the code, your mileage may vary using either older versions. Part of the automated test suite checks for compatibility of numpy and pandas version <= 2.0 and >= 2.0, to ensure these older versions remain supported.

Furthermore, even though the project does not import by default lmfit and contains no functions that specifically rely on it, the code contains convenience functions that were specifically written for usage with the lmfit.Model and lmfit.Parameters classes. If lmfit is installed in the active environment, some additional convenience function will be imported.

Further optional dependecies can be installed by specifying the appropriate feature flags when installing Moose, see also this doc page.

These dependencies will be installed when you install Moose using pip or uv.

Package Version
Numpy >= 1.24.2
Pandas >= 1.5.3
scipy >= 1.11.1
xxhash >= 3.6.0
lmfit (optional) >= 1.2.0

Installation

To simply install Moose itself, running the following suffices (note that on PyPI it is known as moose-spectra):

pip install moose-spectra

Installing Moose with additional optional dependencies is described on the documentation page on getting started.

You can also install the lastest development version of Moose, which may not be released to PyPI yet, using this git repository directly:

pip install git+https://github.com/AntoineTUE/Moose.git

The docs for this development version can be found here

Basic usage

A basic example demonstrating the usage is as follows. It assumes that there is a pandas DataFrame (called data) containing several spectra normalized on the interval (0,1), with the first column being a shared wavelength axis. It is important that the wavelength range over which we query the database (wl_interval) plus the padding range wl_pad, is larger than the experimental range plus the possible shift (mu) between simulation and experiment.

Extending the fitting over multiple cores/processes can be done by using for instance the excellent Dask library, via i.e. client.map. More elaborate examples are available via the online documentation.

import Moose, lmfit

wl_interval = (320,345) # Wavelength interval over which to simulate the spectrum
db = Moose.query_DB('N2CB.db', wl_interval)


# Create the lmfit.Model and lmfit.Parameters object needed for the fit.
model = lmfit.Model(Moose.model_for_fit, sim_db=db)
params = lmfit.create_params(**Moose.default_params)
# Or use some default suggested parameters for thermal fitting, i.e. T_rot==T_vib
# params = lmfit.create_params(**Moose.thermal_default_params)

# Perform the fit
fits = []
for col in data.columns[1:]:
    fits.append(model.Fit(data[col].values, x=data['Wavelength'].values, params=params))

You can also try a cloud instance provided by Binder to run the Moose examples, or try it with your own data: Try Moose.

Copyright notice from MassiveOES

The original software is massiveOES developed by the Masaryk University available from: https://bitbucket.org/OES_muni/massiveoes.

Publications

VORÁČ, Jan; SYNEK, Petr; PROCHÁZKA, Vojtěch; HODER, Tomáš. State-by-state emission spectra fitting for non-equilibrium plasmas: OH spectra of surface barrier discharge at argon/water interface. Journal of Physics D: Applied Physics. 2017, 50(29), 294002. DOI: https://doi.org/10.1088/1361-6463/aa7570.

VORÁČ, Jan; SYNEK, Petr; POTOČŇÁKOVÁ, Lucia; HNILICA, Jaroslav; KUDRLE, Vít. Batch processing of overlapping molecular spectra as a tool for spatio-temporal diagnostics of power modulated microwave plasma jet. Plasma Sources Science and Technology 26.2 (2017), 025010. DOI: https://doi.org/10.1088/1361-6595/aa51f0.

Original sources for databases

Database Source DOI
OHAX J. Luque and D.R. Crosley, J. Chem. Phys., 109, 439 (1998) https://dx.doi.org/10.1088/0022-3727/39/17/015
OHAX L.R. Williams and D.R. Crosley, J. Chem. Phys, 104, 6507 (1996) https://doi.org/10.1063/1.471371
N$_2^+$BX J. Luque and D.R. Crosley, “LIFBASE: Database and Spectral Simulation Program (Version 1.5) ”, SRI International Report MP 99-009 (1999).
NHAX Western C 2016 PGOPHER—a program for simulating rotational structure, Version 9.0.100, University of Bristol
NHAX Ram R and Bernath P 2010 J. Mol. Spectrosc. 260 115–9 https://doi.org/10.1016/j.jms.2010.01.006
NHAX Lents J 1973 J. Quant. Spectrosc. Radiat. Transfer 13 297–310 https://doi.org/10.1016/0022-4073(73)90061-7
NHAX Seong J, Park J K and Sun H 1994 Chem. Phys. Lett. 228 443–50 https://doi.org/10.1016/j.jms.2010.01.006
NOBX J. Luque and D.R. Crosley, “LIFBASE: Database and Spectral Simulation Program (Version 1.5) ”, SRI International Report MP 99-009 (1999).
N$_2$CB Nassar H, Pellerin S, Musiol K, Martinie O, Pellerin N and Cormier J 2004. Phys. D: Appl. Phys. 37 1904 https://doi.org/10.1088/0022-3727/37/14/005
N$_2$CB Laux C O and Kruger C H 1992 J. Quant. Spectrosc. Radiat. Transfer 48 9–24 https://doi.org/10.1016/0022-4073(92)90003-M
N$_2$CB Faure G and Shko’nik S 1998 J. Phys. D: Appl. Phys. 31 1212 https://doi.org/10.1088/0022-3727/31/10/013
C$_2$ Swan James S.A. Brooke and Peter F. Bernath and Timothy W. Schmidt and George B. Bacskay; Journal of Quantitative Spectroscopy and Radiative Transfer; 2013 https://doi.org/10.1016/j.jqsrt.2013.02.025
C$_2$ Swan Carbone, Emile and D'Isa, Federico and Hecimovic, Ante and Fantz, Ursel; PSST; 2020; https://doi.org/10.1088/1361-6595/ab74b4

License information

This project is licensed under the MIT license. See LICENSE.

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

moose_spectra-0.3.0.tar.gz (75.4 MB view details)

Uploaded Source

Built Distribution

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

moose_spectra-0.3.0-py3-none-any.whl (74.2 MB view details)

Uploaded Python 3

File details

Details for the file moose_spectra-0.3.0.tar.gz.

File metadata

  • Download URL: moose_spectra-0.3.0.tar.gz
  • Upload date:
  • Size: 75.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moose_spectra-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f39f4f0b91795189c2bbc3006d460e40aeabb02a5c7688eb9d7005f94651940c
MD5 6fbd9385ffa0ea39da496cf152c24612
BLAKE2b-256 40cd8498faf54ca6165ded06edca371532856a7050153aef334ccdfc93eb622b

See more details on using hashes here.

Provenance

The following attestation bundles were made for moose_spectra-0.3.0.tar.gz:

Publisher: build.yml on AntoineTUE/Moose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moose_spectra-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: moose_spectra-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 74.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moose_spectra-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 033dca169572a59c4da90e6512a5603c656411a09a3313ee41ff8396621ff167
MD5 8f9064f77811dece1d678ee2e5d20a0c
BLAKE2b-256 0b908b41fe494a5da34a5a01ca9ee67f5ff674ff28ef21b1ca2c44c9345b2917

See more details on using hashes here.

Provenance

The following attestation bundles were made for moose_spectra-0.3.0-py3-none-any.whl:

Publisher: build.yml on AntoineTUE/Moose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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