You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use PySCeS for a very simple chemical reaction, the goal is to define a model, perform a parameter scan and finally run simulations with the fitted parameters.
I followed the documentation for a 2D parameter scan, but unfortunately, I ran into a problem. There is probably a problem with my code, but at the moment I'm not exactly sure what the problem is in detail
My model is:
Modelname: simulatio_metaraminol
Description: Kinetic model to describe the synthesis of metaraminol from 3-OH-PAC
R1:
x0 = s0
k1*x0 - k2*s0
# parameters
k1 = 0.2
k2 = 0.1
# init values
x0 = 35.0
s0 = 0
Info: No reagents have been fixed
Calculating L matrix . . . . . . . done.
Calculating K matrix . . . . . . . no flux conservation
done.
MaxMode 0
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_32904\2699428414.py in <module>
14 p2 = ["s0", 0,14.09,concentrations_s0]
15
---> 16 model.Scan2D(p1,p2, output, log=False)
~\anaconda3\envs\pysces2\lib\site-packages\pysces\PyscesModel.py in Scan2D(self, p1, p2, output, log)
9213 sc1.addScanParameter(*p2)
9214 sc1.addUserOutput(output)
-> 9215 sc1.Run()
9216
9217 self.__scan2d_pars__ = [p1[0], p2[0], output]
~\anaconda3\envs\pysces2\lib\site-packages\pysces\PyscesScan.py in Run(self, ReRun)
273 for gen in self.GenOrder:
274 if self.GenDict[gen][4] == False: # don't increase Tsteps for follower
--> 275 Tsteps *= self.GenDict[gen][2]
276 print(next(self.scanT.RUN))
277 analysis_counter = 0
TypeError: can't multiply sequence by non-int of type 'list'
I'm unfortunately also a little bit confused with the Syntax of the 2D parameter scan:
p1 is a list of [model parameter 1, start value, end value, points]
p2 is a list of [model parameter 2, start value, end value, points]
output the steady-state variable e.g. 'J_R1' or 'A_ss'
log if True scan using log ranges for both axes
Are the start and end values the time or the measured values?
Are the points only the measured values or do they have to be submitted as for example data frame together with the time?
The text was updated successfully, but these errors were encountered:
Parameter scanning is only for repeated run of steady-state analyses, not for time simulations. What this method actually does, is changes the two parameters through the list of values and calculates the steady state for each of these, outputting the results.
The syntax of the parameter scan list is as follows:
p1 = ["k1", 1, 10, 10]
p2 = ["k2", 2, 20, 10]
This would vary the parameter "k1" from 1 to 10 in 10 points, i.e. [1, 2, 3, ..., 10]. If you select log, this would be on a log scale. And parameter "k2" from 2 to 20. The output argument is a list of steady-state variables to output (this would typically be fluxes or steady-state concentrations). In your example you are outputting the parameters k1 and k2, so that won't work.
What you want to do is different, i.e. run various simulations with different starting conditions. You would have to code this manually in a for loop, each time setting mod.x0_init and mod.s0_init (the initial values), setting mod.sim_time (list of time points you want to simulate over, and then calling mod.Simulate(userinit=1).
I am trying to use PySCeS for a very simple chemical reaction, the goal is to define a model, perform a parameter scan and finally run simulations with the fitted parameters.
I followed the documentation for a 2D parameter scan, but unfortunately, I ran into a problem. There is probably a problem with my code, but at the moment I'm not exactly sure what the problem is in detail
My model is:
The code for the parameter fit is:
At the moment I get as an error message:
I'm unfortunately also a little bit confused with the Syntax of the 2D parameter scan:
The text was updated successfully, but these errors were encountered: