radis.tools.fitting moduleΒΆ

Fitting Tools embedded RADIS, for simple cases

For more advanced cases, use Fitroom : https://github.com/radis/fitroom

https://user-images.githubusercontent.com/16088743/120166810-4ac14980-c1fd-11eb-9dd5-8fb037db8793.mp4

Originally in radis-examples : https://github.com/radis/radis-examples

LTEModel(factory, fittable_parameters, fixed_parameters={}) radis.spectrum.spectrum.Spectrum[source]ΒΆ

A model returning a single-slab LTE spectrum

Parameters

model_input (dict) – input dictionary (typically: temperatures). Example

{'Trot':value}
Returns

Spectrum

Return type

calculated spectrum

Examples

Tvib12Tvib3Trot_NonLTEModel(factory, fittable_parameters, fixed_parameters={}) radis.spectrum.spectrum.Spectrum[source]ΒΆ

A model returning a single-slab non-LTE spectrum with Tvib=(T12, T12, T3), Trot

Used for non-LTE CO2 modeling. See the multi-temperature fit example

Parameters
  • fittable_parameters (dict) – input dictionary of fittable parameters (typically: temperatures). Example

    {'T12':value,
     'T3':value,
     'Trot':value}
    
  • fixed_parameters (dict) – input dictionary of non-fittable parameters. Will override input conditions given to non_eq_spectrum()

Returns

Spectrum

Return type

calculated spectrum

Examples

See also

LTEModel()

fit_spectrum(factory, s_exp, model, fit_parameters, bounds={}, fixed_parameters={}, plot=False, verbose=True, solver_options={'maxiter': 300}) Union[radis.spectrum.spectrum.Spectrum, scipy.optimize.optimize.OptimizeResult][source]ΒΆ

Fit an experimental spectrum with an arbitrary model and an arbitrary number of fit parameters.

Parameters
  • s_exp (Spectrum) – experimental spectrum. Should have only spectral array only. Use take(), e.g:

    sf.fit_spectrum(s_exp.take('transmittance'))
    
  • model (func -> Spectrum) – a line-of-sight model returning a Spectrum. Example : Tvib12Tvib3Trot_NonLTEModel()

  • fit_parameters (dict) –

    example:

    {fit_parameter:initial_value}s
    
  • bounds (dict, optional) –

    example:

    {fit_parameter:[min, max]}
    
  • fixed_parameters (dict) –

    fixed parameters given to the model. Example:

    fit_spectrum(fixed_parameters={"vib_distribution":"treanor"})
    
Other Parameters
  • plot (bool) – if True, plot spectra as they are computed; and plot the convergence of the residual. Defaut False

  • verbose (bool, or 2) – use 2 for high verbose level.

  • solver_options (dict) – parameters forwarded to the solver. More info in minimize Example:

    {"maxiter": (int)  max number of iteration default ``300``,
     }
    
Returns

  • s_best (Spectrum) – best spectrum

  • res (OptimizeResults) – output of minimize

Examples

See a one-temperature fit example or a multi-temperature fit example.

More advanced tools for interactive fitting of multi-dimensional, multi-slabs spectra can be found in fitroom.