amici.petab.parameter_mapping
Functions
|
Convert amici scale id to petab scale id. |
|
Generate AMICI specific parameter mapping. |
Generate AMICI-specific parameter mapping for a PEtab simulation. |
|
|
Convert petab scale id to amici scale id. |
|
Bring parameter from linear scale to target scale. |
|
Bring parameters from linear scale to target scale. |
|
Bring parameter from scale to linear scale. |
|
Bring parameters from target scale to linear scale. |
Classes
|
Parameter mapping for multiple conditions. |
|
Parameter mapping for condition. |
- class amici.petab.parameter_mapping.ParameterMapping(parameter_mappings=None)[source]
Parameter mapping for multiple conditions.
This can be used like a list of
ParameterMappingForCondition
s.- Parameters:
parameter_mappings (
list
[amici.petab.parameter_mapping.ParameterMappingForCondition
]) – List of parameter mappings for specific conditions.
- count(value) integer -- return number of occurrences of value
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- class amici.petab.parameter_mapping.ParameterMappingForCondition(map_sim_var=None, scale_map_sim_var=None, map_preeq_fix=None, scale_map_preeq_fix=None, map_sim_fix=None, scale_map_sim_fix=None)[source]
Parameter mapping for condition.
Contains mappings for free parameters, fixed parameters, and fixed pre-equilibration parameters, both for parameters and scales.
In the scale mappings, for each simulation parameter, the scale on which the value is passed (and potentially gradients are to be returned) is given. In the parameter mappings, for each simulation parameter a corresponding optimization parameter (or a numeric value) is given.
If a mapping is not passed, the parameter mappings are assumed to be empty, and if a scale mapping is not passed, all scales are set to linear.
- Parameters:
map_sim_var (
dict
[str
,numbers.Number
|str
]) – Mapping for free simulation parameters.scale_map_sim_var (
dict
[str
,str
]) – Scales for free simulation parameters.map_preeq_fix (
dict
[str
,numbers.Number
|str
]) – Mapping for fixed pre-equilibration parameters.scale_map_preeq_fix (
dict
[str
,str
]) – Scales for fixed pre-equilibration parameters.map_sim_fix (
dict
[str
,numbers.Number
|str
]) – Mapping for fixed simulation parameters.scale_map_sim_fix (
dict
[str
,str
]) – Scales for fixed simulation parameters.
- amici.petab.parameter_mapping.amici_to_petab_scale(amici_scale)[source]
Convert amici scale id to petab scale id.
- Return type:
- amici.petab.parameter_mapping.create_parameter_mapping(petab_problem, simulation_conditions, scaled_parameters, amici_model=None, fill_fixed_parameters=True, **parameter_mapping_kwargs)[source]
Generate AMICI specific parameter mapping.
- Parameters:
petab_problem (
petab.v1.problem.Problem
) – PEtab problemsimulation_conditions (
pandas.core.frame.DataFrame
|list
[dict
] |None
) – Result ofpetab.get_simulation_conditions()
. Can be provided to save time if this has been obtained before.scaled_parameters (
bool
) – IfTrue
, problem_parameters are assumed to be on the scale provided in the PEtab parameter table and will be unscaled. IfFalse
, they are assumed to be in linear scale.amici_model (
typing.Union
[amici.amici.Model
,amici.amici.ModelPtr
,None
]) – AMICI model.fill_fixed_parameters (
bool
) – Whether to fill in nominal values for fixed parameters (estimate=0 in the parameters table). To allow changing fixed PEtab problem parameters, usefill_fixed_parameters=False
.parameter_mapping_kwargs – Optional keyword arguments passed to
petab.get_optimization_to_simulation_parameter_mapping()
.
- Return type:
- Returns:
List of the parameter mappings.
- amici.petab.parameter_mapping.create_parameter_mapping_for_condition(parameter_mapping_for_condition, condition, petab_problem, amici_model=None, fill_fixed_parameters=True)[source]
Generate AMICI-specific parameter mapping for a PEtab simulation.
- Parameters:
parameter_mapping_for_condition (
tuple
[dict
[str
,str
|numbers.Number
],dict
[str
,str
|numbers.Number
],dict
[str
,str
],dict
[str
,str
]]) – Preliminary parameter mapping for condition.condition (
pandas.core.series.Series
|dict
) –pandas.DataFrame
row withpreequilibrationConditionId
andsimulationConditionId
.petab_problem (
petab.v1.problem.Problem
) – Underlying PEtab problem.amici_model (
typing.Union
[amici.amici.Model
,amici.amici.ModelPtr
,None
]) – AMICI model.fill_fixed_parameters (
bool
) – Whether to fill in nominal values for fixed parameters (estimate=0 in the parameters table).
- Return type:
- Returns:
The parameter and parameter scale mappings, for fixed pre-equilibration, fixed simulation, and variable simulation parameters, and then the respective scalings.
- amici.petab.parameter_mapping.petab_to_amici_scale(petab_scale)[source]
Convert petab scale id to amici scale id.
- Return type:
- amici.petab.parameter_mapping.scale_parameter(value, petab_scale)[source]
Bring parameter from linear scale to target scale.
- Parameters:
value (
numbers.Number
) – Value to scalepetab_scale (
str
) – Target scale ofvalue
- Return type:
- Returns:
value
on target scale
- amici.petab.parameter_mapping.scale_parameters_dict(value_dict, petab_scale_dict)[source]
Bring parameters from linear scale to target scale.
Bring values in
value_dict
from linear scale to the scale provided inpetab_scale_dict
(in-place). Both arguments are expected to have the same length and matching keys.- Parameters:
value_dict (
dict
[typing.Any
,numbers.Number
]) – Values to scalepetab_scale_dict (
dict
[typing.Any
,str
]) – Target scales ofvalues
- Return type:
- amici.petab.parameter_mapping.unscale_parameter(value, petab_scale)[source]
Bring parameter from scale to linear scale.
- Parameters:
value (
numbers.Number
) – Value to scalepetab_scale (
str
) – Target scale ofvalue
- Return type:
- Returns:
value
on linear scale
- amici.petab.parameter_mapping.unscale_parameters_dict(value_dict, petab_scale_dict)[source]
Bring parameters from target scale to linear scale.
Bring values in
value_dict
from linear scale to the scale provided inpetab_scale_dict
(in-place). Both arguments are expected to have the same length and matching keys.- Parameters:
value_dict (
dict
[typing.Any
,numbers.Number
]) – Values to scalepetab_scale_dict (
dict
[typing.Any
,str
]) – Target scales ofvalues
- Return type: