Skip to main content

Simulated LIBS

PyPI version License Tests ZENADO DOI

SimulatedLIBS provides Python class to simulate LIBS spectra with NIST LIBS Database interface.
SimulatedLIBS also allows the creation of simulated data sets that can be used to train ML models.
SimulatedLIBS was mentioned is FOSS For Spectroscopy by Prof. Bryan A. Hanson, DePauw University.

Project created for B.Eng. thesis:
Computer methods of the identification of the elements in optical spectra obtained by Laser Induced Breakdown Spectroscopy.

Thesis supervisor: Paweł Gąsior PhD
e-mail: pawel.gasior@ifpilm.pl
Institute of Plasma Physics and Laser Microfusion - IPPLM

Installation

pip install SimulatedLIBS

Import

from simLIBS import SimulatedLIBS

Example

Parameters:

  • Te - electron temperature [eV]
  • Ne - electron density [cm^-3]
  • elements - list of elements
  • percentages - list of elements concentrations
  • resoulution
  • wavelength range: low_w, upper_w
  • maximal ion charge: max_ion_charge
  • websraping: 'static' or 'dynamic'

Static websraping

libs = SimulatedLIBS(Te=1.0,
                     Ne=10**17,
                     elements=['W','Fe','Mo'],
                     percentages=[50,25,25],
                     resolution=1000,
                     low_w=200,
                     upper_w=1000,
                     max_ion_charge=3,
                     webscraping='static')

Plot

libs.plot(color='blue', title='W Fe Mo composition')

Save to file

libs.save_to_csv('filename.csv')

Interpolated spectrum

SimulatedLIBS interpolates retrieved data from NIST with cubic splines.

libs.get_interpolated_spectrum()

Raw spectrum

Raw retrieved data from NIST

libs.get_raw_spectrum()

Dynamic webscraping

libs = SimulatedLIBS(Te=1.0,
                     Ne=10**17,
                     elements=['W','Fe','Mo'],
                     percentages=[50,25,25],
                     resolution=1000,
                     low_w=200,
                     upper_w=1000,
                     max_ion_charge=3,
                     webscraping='dynamic')

Plot

libs.plot(color='blue', title='W Fe Mo composition')

Ion spectra

After simulation with parameter websraping = dynamic, ion spectra are stored in ion_spectra (pd.DataFrame) and can be plotted.

libs.plot_ion_spectra()

Random dataset of samples

Based on .csv file with chemical composition of samples, one can generate dataset of simulated LIBS measurements with different Te and Ne values.

Example of input_composition_df pd.DataFrame:

W H He name
50 25 25 A
30 60 10 B
40 40 20 C
SimulatedLIBS.create_dataset(input_composition_df,
                             size=100,
                             Te_min=1.0,
                             Te_max=2.0,
                             Ne_min=10**17,
                             Ne_max=10**18)

Example of output .csv file:

200.0 200.1 200.2 200.3 200.4 ... H W Te Ne
0 0 0 0 0 0 ... 2 50 1.43 1.08e+17
1 0 0 0 0 0 ... 0 0 1.06 1.08e+17
2 0 0.1 0.1 0.1 0.1 ... 0 68 1.82 1.18e+17
3 0 54.5 56.7 54.4 48.4 ... 0 3 1.25 1.06e+17
4 0 121.7 143.1 140.5 115.3 ... 0 84 1.08 9.23e+17

Animations

SimulatedLIBS can be helpful in creating LIBS animations mostly for educational purpose.

Resolution animation

Changes in resolution in range: 500-10000.

Electron temperature animation

Changes in electron temperature Te in range: 0.5-5 eV.

Electron density animation

Changes in electron density Ne in range: 0.7-1.3 e+17 [cm^-3].

References

  • M. Kastek, et al., Analysis of hydrogen isotopes retention in thermonuclear reactors with LIBS supported by machine learning. Spectrochimica Acta Part B Atomic Spectroscopy 199: 106576. DOI: 10.1016/j.sab.2022.106576.

Used in Research

  • Chen Z, Chen Z, Jiang W, Guo L, Zhang Y. Line intensity calculation of laser-induced breakdown spectroscopy during plasma expansion in nonlocal thermodynamic equilibrium. Opt Lett. 2023 Jun 15;48(12):3227-3230. DOI: 10.1364/OL.488250.

Metadata

Release files for simLIBS 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simLIBS 2.0.3
File Size Uploaded
simlibs-2.0.3.tar.gz 7.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for simLIBS 2.0.3
File Interpreter ABI Platform
simLIBS-2.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 MB

Release files / simlibs-2.0.3.tar.gz

Download URL simlibs-2.0.3.tar.gz
Size 7.9 MB
Tags Source
SHA-256 checksum
How to use checksums
0e7443a3b615699d6ac3e0bd9848c73916573152a842c020a5c398b747e4dea7
BLAKE2b-256 checksum
How to use checksums
0b7d54753c9f265df51bec6a1849653985661c3fbbaed6014bea5a4fc8278fad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / simLIBS-2.0.3-py3-none-any.whl

Download URL simLIBS-2.0.3-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a82b0a59a6dede497e1d9c354f220b09339eef150f4a6a39f663b360c60262aa
BLAKE2b-256 checksum
How to use checksums
518844e29fac90535cd18b5d30137cd8130d3212b9b5b92fd9f21b1f3133274d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page