Spectrum Database

RADIS has SpecDatabase feature used to store and retrieve calculated Spectrums. A path can be specified for SpecDatabase all Spectrums are stored as .spec files which can be loaded from the SpecDatabase object itself. A csv file is generated which contains all input and conditional parameters of Spectrum.

RADIS also has init_database() feature which initializes the SpecDatabase for the SpectrumFactory and every Spectrum generated from it will be stored in the SpecDatabase automatically.

You can use plot_cond() to make a 2D plot using the conditions of the Spectrums in the SpecDatabase and use a z_label to plot a heat map based on it.

SpecDatabase also has useful fit_spectrum() and interpolate() methods.

from pathlib import Path

import numpy as np

from radis import SpectrumFactory
from radis.tools import SpecDatabase

sf = SpectrumFactory(
    wavenum_min=2900,
    wavenum_max=3200,
    molecule="OH",
    truncation=5,  # cm-1
    medium="vacuum",
    verbose=0,  # more for more details
    pressure=10,
    wstep=0.1,
)
sf.warnings = {"AccuracyError": "ignore"}
sf.fetch_databank("hitemp")

# Generating a Spectrum
s1 = sf.eq_spectrum(Tgas=300, path_length=1)

Creating SpecDatabase This is simply a local folder on your computer.

from radis.test.utils import getTestFile

my_folder = Path(getTestFile(".")) / "SpecDatabase_Test"
db = SpecDatabase(my_folder)
Database SpecDatabase_Test initialised in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files
*** Loading the database with 1 processor (0 files)***

There are many ways to add spectra to the database : Method 1: Creating .spec file and adding manually to SpecDatabase

Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817.spec (0.1Mb)
loaded 20220817.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.


'/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817.spec'

Method 2: Using init_database() SpecDatabase is connected to the SpectrumFactory sf above Generated Spectrum are added to SpecDatabase automatically :

sf.init_database(my_folder)

wstep = np.linspace(0.1, 0.001, 4)
Tgas = np.linspace(300, 3000, 4)


# Multiple Spectrum calculation based on different values of Tgas and wstep
for i in wstep:
    sf._wstep = i
    sf.params.wstep = i
    for j in Tgas:
        sf.eq_spectrum(Tgas=j, path_length=1)


# Loading SpecDatabase
db_new = SpecDatabase(my_folder)

# Plot Tgas vs wstep for all Spectrums, heatmap based on calculation_time
db_new.plot_cond("Tgas", "wstep", "calculation_time")
SpecDatabase_Test
Loading database SpecDatabase_Test
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib1200K_Trot1200K.spec (0.1Mb)
loaded 20220817_Tvib1200K_Trot1200K.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib2100K_Trot2100K.spec (0.1Mb)
loaded 20220817_Tvib2100K_Trot2100K.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib3000K_Trot3000K.spec (0.1Mb)
loaded 20220817_Tvib3000K_Trot3000K.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib300K_Trot300K.spec (0.2Mb)
loaded 20220817_Tvib300K_Trot300K.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib1200K_Trot1200K_1.spec (0.2Mb)
loaded 20220817_Tvib1200K_Trot1200K_1.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib2100K_Trot2100K_1.spec (0.2Mb)
loaded 20220817_Tvib2100K_Trot2100K_1.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib3000K_Trot3000K_1.spec (0.2Mb)
loaded 20220817_Tvib3000K_Trot3000K_1.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib300K_Trot300K_1.spec (0.3Mb)
loaded 20220817_Tvib300K_Trot300K_1.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib1200K_Trot1200K_2.spec (0.4Mb)
loaded 20220817_Tvib1200K_Trot1200K_2.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib2100K_Trot2100K_2.spec (0.4Mb)
loaded 20220817_Tvib2100K_Trot2100K_2.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib3000K_Trot3000K_2.spec (0.4Mb)
loaded 20220817_Tvib3000K_Trot3000K_2.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib300K_Trot300K_2.spec (10.7Mb)
loaded 20220817_Tvib300K_Trot300K_2.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib1200K_Trot1200K_3.spec (12.2Mb)
loaded 20220817_Tvib1200K_Trot1200K_3.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib2100K_Trot2100K_3.spec (12.4Mb)
loaded 20220817_Tvib2100K_Trot2100K_3.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Warning. File already exists. Filename is incremented
Spectrum stored in /home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/test/files/SpecDatabase_Test/20220817_Tvib3000K_Trot3000K_3.spec (12.4Mb)
loaded 20220817_Tvib3000K_Trot3000K_3.spec
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/tools/database.py:2349: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Loading database SpecDatabase_Test

Total running time of the script: ( 0 minutes 7.907 seconds)