Skip to main content

SimulatedLIBS provides simple Python class to simulate LIBS spectra with NIST LIBS Database interface

Project description

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 SimulatedLIBS import simulation

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 = simulation.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 = simulation.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 .csv file:

W H He name
50 25 25 A
30 60 10 B
40 40 20 C
simulation.SimulatedLIBS.create_dataset(input_csv_file="data.csv",
                                        output_csv_file='output.csv', 
                                        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.

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

SimulatedLIBS-1.0.3.tar.gz (7.9 MB view details)

Uploaded Source

Built Distribution

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

SimulatedLIBS-1.0.3-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file SimulatedLIBS-1.0.3.tar.gz.

File metadata

  • Download URL: SimulatedLIBS-1.0.3.tar.gz
  • Upload date:
  • Size: 7.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for SimulatedLIBS-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4c465f86724553520a091ac17043f3e9871004ef33133f1eb2c8fd0f5100cd4c
MD5 27f933ef4d04438256bb0fb5b9056959
BLAKE2b-256 f83f50ba417d386de1d2f599b66278513f826932fdf574cc0443f4ad0cdbd607

See more details on using hashes here.

File details

Details for the file SimulatedLIBS-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: SimulatedLIBS-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for SimulatedLIBS-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5d3ce3a7f701d228e967420a768f0056cba9ecf5c7f1c86871646fd803c8f646
MD5 fc321d58a552fb4b307b05717ded1cf2
BLAKE2b-256 6986b839fa9ba62e94910c5241c1ec5f7349f65409b3066f06a9d6416e950f84

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