Fit an equilibrium spectrum with Tgas as fit parameter using new fitting modules

RADIS has its own fitting feature, as shown in 1 temperature fit example, where you have to manually create the spectrum model, input the experimental spectrum and other ground-truths into numerous RADIS native functions, as well as adjust the fitting pipeline yourself.

Now with the new fitting module released, all you have to do is to prepare a .spec file containing your experimental spectrum, fill some JSON forms describing the ground-truth conditions just like how you fill your medical checkup paper, call the function fit_spectrum() and let it do all the work! If you are not satisfied with the result, you can simply adjust the parameters in your JSON, such as slit and path_length , then recall the function again, until the results are satisfied.

This is way easier and more convenient than dwelling into RADIS documentation to find out and learn how to use the current example, especially for new RADIS users. This new fitting module aims to provide an end-to-end fitting experience, with minimum amount of RADIS knowledge needed.

Instruction:

  • Step 1: prepare a .spec file. Create a .spec file containing your experimental spectrum. You can do it with RADIS by saving a Spectrum object with s.store(). If your current data is not a Spectrum object, you can convert it to a Spectrum object from Python arrays or from text files, and then save it as .spec file using s.store() as mentioned above.

  • Step 2: fill the JSON forms. There are 4 JSON forms you need to fill: experimental_conditions with ground-truth data about your experimental environment, fit_parameters with the parameters you need to fit (such as Tgas, mole fraction, etc.), bounding_ranges with fitting ranges for parameters you listed in fit_parameters, and fit_properties for some fitting pipeline references.

  • Step 3: call fit_spectrum() with the experimental spectrum and 4 JSON forms and see the result.

This example features fitting an experimental spectrum with Tgas, using new fitting modules.

plot newfitting Tgas
Successfully retrieved the experimental data in 0.0008730888366699219s.


Acquired spectral quantity 'radiance' from the spectrum.
NaN values successfully purged.Number of data points left: 16666 points.
Successfully refined the experimental data in 0.0011479854583740234s.
"tol" parameter spotted but "method" is not "lbfgsb"!
Using /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3


Data is fetched from http://hitran.org

BEGIN DOWNLOAD: NH3_1
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.data
Header written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_1.header
END DOWNLOAD
                     Lines parsed: 76353
PROCESSED

Data is fetched from http://hitran.org

BEGIN DOWNLOAD: NH3_2
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
  65536 bytes written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.data
Header written to /home/docs/.radisdb/hitran/downloads__can_be_deleted/NH3/NH3_2.header
END DOWNLOAD
                     Lines parsed: 13662
PROCESSED
Added HITRAN-NH3 database in /home/docs/radis.json

Commence fitting process for LTE spectrum!
[[Fit Statistics]]
    # fitting method   = leastsq
    # function evals   = 24
    # data points      = 1
    # variables        = 1
    chi-square         = 2.1725e-14
    reduced chi-square = 2.1725e-14
    Akaike info crit   = -29.4603003
    Bayesian info crit = -31.4603003
[[Variables]]
    Tgas:  999.982716 +/- 20814687.5 (2081504.73%) (init = 700)

Succesfully finished the fitting process in 5.9167540073394775s.
/home/docs/checkouts/readthedocs.org/user_builds/radis/envs/latest/lib/python3.8/site-packages/radis/misc/curve.py:241: UserWarning:

Presence of NaN in curve_divide!
Think about interpolation=2


Residual history:

[1.2170348021620845e-05, 1.2170348021620845e-05, 1.2170348021620845e-05, 1.2170347877322698e-05, 1.5663057078584574e-05, 3.0328704734086317e-06, 3.0328702692986844e-06, 1.63559060271813e-07, 1.6355913155931358e-07, 3.3982255217581304e-07, 3.3982255217581304e-07, 1.6012291452771e-07, 1.601228495198606e-07, 1.4745364448662093e-07, 1.4745364915391358e-07, 1.5979615813821301e-07, 1.4741621397410174e-07, 1.4741621116254957e-07, 1.473972870137881e-07, 1.4739728794681056e-07, 1.4741622852391794e-07, 1.4739494411950278e-07, 1.4739494411947742e-07, 1.4739728716278985e-07, 1.4739496749691e-07, 1.4739494434795228e-07, 1.4739494411950278e-07]

Fitted values history:

[700.0]
[700.0]
[700.0]
[700.0000062548726]
[1407.3656469083326]
[934.8090047352978]
[934.8090091337364]
[1001.5173205547788]
[1001.5173241156315]
[993.3641908747975]
[993.3641908747975]
[998.6292168437317]
[998.6292204424527]
[1000.0727475668766]
[1000.0727511466864]
[998.6474093762648]
[999.9285316256967]
[999.9285352073973]
[1000.0007026197072]
[1000.0007062004618]
[999.9285130941261]
[999.9827164960714]
[999.9827200770617]
[1000.0007031915928]
[999.9845151583453]
[999.982896362226]
[999.9827164960714]

Total fitting time:
5.9167540073394775 s

from radis import load_spec
from radis.test.utils import getTestFile
from radis.tools.new_fitting import fit_spectrum

# Load an experimental spectrum. You can prepare yours, or fetch one of them in the radis/test/files directory.
my_spec = getTestFile("synth-NH3-1-500-2000cm-P10-mf0.01-p1.spec")
s_experimental = load_spec(my_spec)

# Experimental conditions which will be used for spectrum modeling. Basically, these are known ground-truths.
experimental_conditions = {
    "molecule": "NH3",  # Molecule ID
    "isotope": "1",  # Isotope ID, can have multiple at once
    "wmin": 1000,  # Starting wavelength/wavenumber to be cropped out from the original experimental spectrum.
    "wmax": 1050,  # Ending wavelength/wavenumber for the cropping range.
    "wunit": "cm-1",  # Accompanying unit of those 2 wavelengths/wavenumbers above.
    "mole_fraction": 0.01,  # Species mole fraction, from 0 to 1.
    "pressure": 10,  # Partial pressure of gas, in "bar" unit.
    "path_length": 1,  # Experimental path length, in "cm" unit.
    "slit": "1 nm",  # Experimental slit, must be a blank space separating slit amount and unit.
    "offset": "-0.2 nm",  # Experimental offset, must be a blank space separating offset amount and unit.
    "wstep": 0.003,  # Resolution of wavenumber grid, in cm-1.
    "databank": "hitran",  # Databank used for the spectrum calculation. Must be stated.
}

# List of parameters to be fitted, accompanied by their initial values.
fit_parameters = {
    "Tgas": 700,  # Gas temperature, in K.
}

# List of bounding ranges applied for those fit parameters above.
# You can skip this step and let it use default bounding ranges, but this is not recommended.
# Bounding range must be at format [<lower bound>, <upper bound>].
bounding_ranges = {
    "Tgas": [
        500,
        2000,
    ],
}

# Fitting pipeline setups.
fit_properties = {
    "method": "leastsq",  # Preferred fitting method from the 17 confirmed methods of LMFIT stated in week 4 blog. By default, "leastsq".
    "fit_var": "radiance",  # Spectral quantity to be extracted for fitting process, such as "radiance", "absorbance", etc.
    "normalize": False,  # Either applying normalization on both spectra or not.
    "max_loop": 150,  # Max number of loops allowed. By default, 200.
    "tol": 1e-15,  # Fitting tolerance, only applicable for "lbfgsb" method.
}


# Conduct the fitting process!
s_best, result, log = fit_spectrum(
    s_exp=s_experimental,  # Experimental spectrum.
    fit_params=fit_parameters,  # Fit parameters.
    bounds=bounding_ranges,  # Bounding ranges for those fit parameters.
    model=experimental_conditions,  # Experimental ground-truths conditions.
    pipeline=fit_properties,  # Fitting pipeline references.
    verbose=False,  # If you want a clean result, stay False. If you want to see more about each loop, True.
)


# Now investigate the result logs for additional information about what's going on during the fitting process

print("\nResidual history: \n")
print(log["residual"])

print("\nFitted values history: \n")
for fit_val in log["fit_vals"]:
    print(fit_val)

print("\nTotal fitting time: ")
print(log["time_fitting"], end=" s\n")

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