Skip to content

Commit

Permalink
#40: allow setting of initial time via set_value
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Mar 18, 2024
1 parent fc5f34c commit 7b7e4ca
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions basico/model_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,8 @@ def _replace_cns_with_names(expression, **kwargs):
obj = dm.getObject(COPASI.CCommonName(cn))
if obj is not None:
word = obj.getObjectDisplayName()
if ' ' in word:
word = '{' + word + '}'
resulting_expression += ' ' + word

return resulting_expression.strip()
Expand Down Expand Up @@ -4939,16 +4941,17 @@ def _get_named_value(obj, name):

elif is_metab:
value = {
'Concentration': obj.getConcentration(),
'ParticleNumber': obj.getValue(),
'Rate': obj.getConcentrationRate(),
'ParticleNumberRate': obj.getRate(),
'InitialParticleNumber': obj.getInitialValue(),
'InitialConcentration': obj.getInitialConcentration(),
'Concentration': obj.getConcentration(),
'Rate': obj.getConcentrationRate(),
'InitialParticleNumber': obj.getInitialValue(),
}.get(name, None)

elif is_model:
value = {
'Initial Time': obj.getInitialTime(),
'Time': obj.getValue(),
}.get(name, None)

Expand Down Expand Up @@ -5016,14 +5019,15 @@ def _set_named_value(obj, name, new_value, ref):

elif is_metab:
set_function = {
'Concentration': obj.setConcentration,
'ParticleNumber': obj.setValue,
'InitialParticleNumber': obj.setInitialValue,
'InitialConcentration': obj.setInitialConcentration,
'Concentration': obj.setConcentration,
}.get(name, None)

elif is_model:
set_function = {
'Initial Time': obj.setInitialTime,
'Time': obj.setValue,
}.get(name, None)

Expand Down

0 comments on commit 7b7e4ca

Please sign in to comment.