Skip to content

Commit

Permalink
#26: actually, only optionally dont modify parameters
Browse files Browse the repository at this point in the history
(to be compatible with the old behavior, we still will update parameters automatically unless otherwise requested)
  • Loading branch information
fbergmann committed Jul 26, 2022
1 parent 6ee36cd commit 98e26b7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions basico/task_parameterestimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,14 +1016,14 @@ def run_parameter_estimation(**kwargs):
return get_parameters_solution(model)


def get_simulation_results(values_only=False, update_parameters=False, **kwargs):
def get_simulation_results(values_only=False, update_parameters=True, **kwargs):
"""Runs the current solution statistics and returns result of simulation and experimental data
:param values_only: if true, only time points at the measurements will be returned
:type values_only: bool
:param update_parameters: if set true, the model will be updated with the parameters
found from the solution. (defaults to False)
found from the solution. (defaults to True)
:type update_parameters: bool
:param kwargs:
Expand Down Expand Up @@ -1174,13 +1174,29 @@ def _update_fit_parameters_from(dm, solution, exp_name=''):
for j in range(solution.shape[0]):
name = solution.iloc[j].name
value = solution.iloc[j].sol
lower= solution.iloc[j].lower
upper = solution.iloc[j].upper

cn = params.iloc[j].cn
if np.isnan(value):
continue
affected = solution.iloc[j].affected
if any(affected) and exp_name not in affected:
continue

# ensure that values is within the constraint
if value < lower:
try:
value = str(lower)
except ValueError:
value = basico.get_value(lower)
if value > upper:
try:
value = str(upper)
except ValueError:
value = basico.get_value(upper)


obj = dm.getObject(COPASI.CCommonName(cn))

if obj is None: # not found skip
Expand Down

0 comments on commit 98e26b7

Please sign in to comment.