Skip to content

Commit 05b1436

Browse files
committed
- fix v1 COAPSI TL
1 parent 8a29bb7 commit 05b1436

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

pyenzyme/v1/thinlayers/TL_Copasi.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ def _import_experiments(self):
178178
# validate value
179179
if k in data.columns:
180180
initial_value = data[data["time"] == 0.0][k]
181-
if not initial_value.empty and float(initial_value) != v[0]:
181+
if not initial_value.empty and float(initial_value.iloc[0]) != v[0]:
182182
log.warning(
183183
f'The initial value of "{k}" in experiment "{measurement_id}" '
184184
f"is inconsistent with the specified initial concentration: "
185-
f"{float(initial_value)} != {v[0]}"
185+
f"{float(initial_value.iloc[0])} != {v[0]}"
186186
)
187187

188188
exp_filename = os.path.abspath(
@@ -218,21 +218,21 @@ def _import_experiments(self):
218218
obj_map.setRole(i, role)
219219
obj_map.setObjectCN(
220220
i,
221-
self.sbml_id_map[col]
221+
COPASI.CRegisteredCommonName(self.sbml_id_map[col]
222222
.getConcentrationReference()
223223
.getCN()
224-
.getString(),
224+
.getString()),
225225
)
226226

227227
elif col.startswith("init_") and col[5:] in self.sbml_id_map.keys():
228228
role = COPASI.CExperiment.independent
229229
obj_map.setRole(i, role)
230230
obj_map.setObjectCN(
231231
i,
232-
self.sbml_id_map[col[5:]]
232+
COPASI.CRegisteredCommonName(self.sbml_id_map[col[5:]]
233233
.getInitialConcentrationReference()
234234
.getCN()
235-
.getString(),
235+
.getString()),
236236
)
237237

238238
else:
@@ -298,9 +298,9 @@ def set_fit_parameters(self, fit_parameters):
298298
fit_item = self.problem.addFitItem(cn)
299299
assert isinstance(fit_item, COPASI.CFitItem)
300300
if "lower" in item:
301-
fit_item.setLowerBound(COPASI.CCommonName(str(item["lower"])))
301+
fit_item.setLowerBound(COPASI.CRegisteredCommonName(str(item["lower"])))
302302
if "upper" in item:
303-
fit_item.setUpperBound(COPASI.CCommonName(str(item["upper"])))
303+
fit_item.setUpperBound(COPASI.CRegisteredCommonName(str(item["upper"])))
304304
if "start" in item:
305305
fit_item.setStartValue(float(item["start"]))
306306

@@ -399,8 +399,8 @@ def _set_default_items(self):
399399
cn = obj.getCN()
400400
fit_item = self.problem.addFitItem(cn)
401401
assert isinstance(fit_item, COPASI.CFitItem)
402-
fit_item.setLowerBound(COPASI.CCommonName(str(1e-6)))
403-
fit_item.setUpperBound(COPASI.CCommonName(str(1e6)))
402+
fit_item.setLowerBound(COPASI.CRegisteredCommonName(str(1e-6)))
403+
fit_item.setUpperBound(COPASI.CRegisteredCommonName(str(1e6)))
404404
fit_item.setStartValue(float(p.value))
405405

406406
def _set_default_items_from_init_file(self):
@@ -439,8 +439,8 @@ def _set_default_items_from_init_file(self):
439439
cn = mv.getInitialValueReference().getCN()
440440
fit_item = self.problem.addFitItem(cn)
441441
assert isinstance(fit_item, COPASI.CFitItem)
442-
fit_item.setLowerBound(COPASI.CCommonName(str(global_param.lower)))
443-
fit_item.setUpperBound(COPASI.CCommonName(str(global_param.upper)))
442+
fit_item.setLowerBound(COPASI.CRegisteredCommonName(str(global_param.lower)))
443+
fit_item.setUpperBound(COPASI.CRegisteredCommonName(str(global_param.upper)))
444444
fit_item.setStartValue(float(value))
445445

446446
for reaction_id, (model, _) in self.reaction_data.items():
@@ -467,8 +467,8 @@ def _set_default_items_from_init_file(self):
467467
cn = obj.getCN()
468468
fit_item = self.problem.addFitItem(cn)
469469
assert isinstance(fit_item, COPASI.CFitItem)
470-
fit_item.setLowerBound(COPASI.CCommonName(str(p.lower)))
471-
fit_item.setUpperBound(COPASI.CCommonName(str(p.upper)))
470+
fit_item.setLowerBound(COPASI.CRegisteredCommonName(str(p.lower)))
471+
fit_item.setUpperBound(COPASI.CRegisteredCommonName(str(p.upper)))
472472
fit_item.setStartValue(float(value))
473473

474474

0 commit comments

Comments
 (0)