Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.model.setParameterList([
i for i in reversed(self.model.getParameterList())
])
# set ExpData parameters
self.edata.parameters = self.model.getParameters()
# perturb model parameters
self.model.setParameters(tuple(
p * 2 for p in self.model.getParameters()
))
# set ExpData pscale
self.edata.pscale = self.model.getParameterScale()
# perturb model pscale, needs to be done after getting parameters,
# otherwise we will mess up parameter value
self.model.setParameterScale(amici.parameterScalingFromIntVector([
amici.ParameterScaling_log10
if scaling == amici.ParameterScaling_none
else amici.ParameterScaling_none
for scaling in self.model.getParameterScale()
]))
self.edata.x0 = rdata['x_ss']
self.edata.sx0 = rdata['sx_ss'].flatten()
# perturb model initial states
self.model.setInitialStates(rdata['x_ss'] * 4)
self.model.setInitialStateSensitivities(rdata['sx_ss'].flatten() / 2)
rdata_edata = amici.runAmiciSimulation(
self.model, self.solver, self.edata
)
def test_parameterScalingFromIntVector(self):
"""Ensure we can generate a ParameterScaling vector from Python"""
scale_vector = amici.parameterScalingFromIntVector(
[
amici.ParameterScaling_log10,
amici.ParameterScaling_ln,
amici.ParameterScaling_none
])
assert scale_vector[0] == amici.ParameterScaling_log10
assert scale_vector[1] == amici.ParameterScaling_ln
assert scale_vector[2] == amici.ParameterScaling_none
self.edata.fixedParametersPresimulation
self.edata_presim.fixedParametersPresimulation = ()
self.edata_presim.fixedParametersPreequilibration = ()
self.edata_sim = amici.ExpData(self.edata)
self.edata_sim.t_presim = 0
self.edata_sim.setTimepoints(self.edata.getTimepoints())
self.edata_sim.fixedParameters = \
self.edata.fixedParameters
self.edata_sim.fixedParametersPresimulation = ()
self.edata_sim.fixedParametersPreequilibration = ()
self.pscales = [
amici.ParameterScaling_log10, amici.ParameterScaling_ln,
amici.ParameterScaling_none,
amici.parameterScalingFromIntVector([
amici.ParameterScaling_log10, amici.ParameterScaling_ln,
amici.ParameterScaling_none, amici.ParameterScaling_log10,
amici.ParameterScaling_ln, amici.ParameterScaling_none
])
]
self.plists = [
[3, 1, 2, 4], [0, 1, 2, 3, 4, 5], [5, 3, 2, 0, 4, 1],
[1, 2, 3, 4, 5], [1, 1, 1],
]