Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
model = model_module.getModel()
model.setTimepoints(np.linspace(0, 60, 60))
solver = model.getSolver()
solver.setSensitivityOrder(amici.SensitivityOrder_first)
rdata = amici.runAmiciSimulation(model, solver)
edata = [amici.ExpData(rdata, 1, 0)]
rdata = amici.runAmiciSimulations(model, solver, edata)
# check roundtripping of DataFrame conversion
df_edata = amici.getDataObservablesAsDataFrame(model, edata)
edata_reconstructed = amici.getEdataFromDataFrame(model, df_edata)
self.assertTrue(
np.isclose(
amici.ExpDataView(edata[0])
['observedData'],
amici.ExpDataView(edata_reconstructed[0])
['observedData'],
).all()
)
self.assertTrue(
np.isclose(
amici.ExpDataView(edata[0])
['observedDataStdDev'],
amici.ExpDataView(edata_reconstructed[0])
['observedDataStdDev'],
).all()
)
if len(edata[0].fixedParameters):
self.assertListEqual(
list(edata[0].fixedParameters),
# check roundtripping of DataFrame conversion
df_edata = amici.getDataObservablesAsDataFrame(model, edata)
edata_reconstructed = amici.getEdataFromDataFrame(model, df_edata)
self.assertTrue(
np.isclose(
amici.ExpDataView(edata[0])
['observedData'],
amici.ExpDataView(edata_reconstructed[0])
['observedData'],
).all()
)
self.assertTrue(
np.isclose(
amici.ExpDataView(edata[0])
['observedDataStdDev'],
amici.ExpDataView(edata_reconstructed[0])
['observedDataStdDev'],
).all()
)
if len(edata[0].fixedParameters):
self.assertListEqual(
list(edata[0].fixedParameters),
list(edata_reconstructed[0].fixedParameters),
)
else:
self.assertListEqual(
list(model.getFixedParameters()),
list(edata_reconstructed[0].fixedParameters),
)