FitUtil
Moose.FitUtil
Contains convenience functions, to streamline the workflow a bit when using lmfit
as a fitting library.
Whenever lmfit
is installed in the currently active environment, these functions are imported into the Moose
namespace as well.
This behaviour occurs regardless of if Moose
has been installed with the [fit] optional dependencies or not.
Functions:
Name | Description |
---|---|
make_model |
Create a |
set_param |
Set or modify a single parameter in |
set_params |
Set or modify a bunch of parameters using a dict in a |
make_model
make_model(species: str, range: tuple[float, float] = (0, np.inf), resolution: int = 100, wl_pad: float = 10, **kwargs)
Create a lmfit.Model
instance already prepared with the line-by-line database for fitting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
species
|
str
|
The name of the species database to query. |
required |
range
|
tuple[float, float]
|
The wavelength range in nanometer to restric the database query to. Defaults to (0,np.inf) |
(0, inf)
|
resolution
|
int
|
The resolution per nanometer of the equidistant mesh compared to bin/sample simulation by (default: 100) |
100
|
wl_pad
|
float
|
The amount of nanometer to pad the x-axis of the simulation with to avoid edge effects. Default: 10 |
10
|
Kwargs
params (lmfit.Parameters, Optional): A Parameters
object with appropriate fit parameters for the model. Defaults to Moose.default_params
Returns:
Name | Type | Description |
---|---|---|
model |
Model
|
A |
params |
Parameters
|
A |
Source code in src/Moose/FitUtil.py
set_param
set_param(params: Parameters, param_name: str, value: float = 0, min: float = -np.inf, max: float = np.inf, vary: bool = True)
Set or modify a single parameter in lmfit.Parameters
object.
Source code in src/Moose/FitUtil.py
set_params
Set or modify a bunch of parameters using a dict in a lmfit.Parameters
object.