Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.24.0 #2406

Merged
merged 17 commits into from
Apr 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix initial state issues with PEtab (#2382)
* Ensure initial state parameters are always fixed parameters
* Ensure initial concentration for preequilibration and simulation are both set in both phases to avoid NaN issues
* Fix initialAssignment handling during PEtab import (missed in #2359)
dweindl authored Mar 18, 2024
commit 790ab4427508de57ad430a6cc156e1869458bb31
15 changes: 9 additions & 6 deletions python/sdist/amici/petab/parameter_mapping.py
Original file line number Diff line number Diff line change
@@ -486,12 +486,11 @@ def create_parameter_mapping_for_condition(
condition_scale_map_preeq,
preeq_value,
)
else:
# need to set dummy value for preeq parameter anyways, as it
# is expected below (set to 0, not nan, because will be
# multiplied with indicator variable in initial assignment)
condition_map_sim[init_par_id] = 0.0
condition_scale_map_sim[init_par_id] = LIN
# need to set dummy value for preeq parameter anyways, as it
# is expected below (set to 0, not nan, because will be
# multiplied with indicator variable in initial assignment)
condition_map_sim[init_par_id] = 0.0
condition_scale_map_sim[init_par_id] = LIN

# for simulation
condition_id = condition[SIMULATION_CONDITION_ID]
@@ -505,6 +504,10 @@ def create_parameter_mapping_for_condition(
condition_scale_map_sim,
value,
)
# set dummy value as above
if condition_map_preeq:
condition_map_preeq[init_par_id] = 0.0
condition_scale_map_preeq[init_par_id] = LIN

##########################################################################
# separate fixed and variable AMICI parameters, because we may have
4 changes: 3 additions & 1 deletion python/sdist/amici/petab/sbml_import.py
Original file line number Diff line number Diff line change
@@ -300,6 +300,8 @@ def import_model_sbml(
init_par = sbml_model.createParameter()
init_par.setId(init_par_id)
init_par.setName(init_par_id)
# must be a fixed parameter in any case to allow reinitialization
fixed_parameters.append(init_par_id)
assignment = sbml_model.getInitialAssignment(assignee_id)
if assignment is None:
assignment = sbml_model.createInitialAssignment()
@@ -535,7 +537,7 @@ def _get_fixed_parameters_sbml(
ia.getMath(), parser_settings
)
)
if not sym_math.is_Number:
if not sym_math.evalf().is_Number:
fixed_parameters.remove(fixed_parameter)
continue