Skip to content

Problem with 2D parameter scan #90

@StephanM87

Description

@StephanM87

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

The code for the parameter fit is:

import pysces

model = pysces.model('simulatio_metaraminol')

time_values = [0,1,2,3,4,5,6,7,8,23.6,24]
concentrations_s0 = [0, 6.27, 8.47, 10.77, 11.58,10.97, 11.75, 12.09, 12.10,14.55, 14.09]
concentrations_x0 = [35.16, 27.30,26.12, 28.45, 29.27, 25.90,24.29, 25.24,24.86,24.51,24.55]

scan = pysces.Scanner(model)

output = ['k1', 'k2']

p1 = ["x0", 35, 24.55, concentrations_x0]
p2 = ["s0", 0,14.09,concentrations_s0]

model.Scan2D(p1,p2, output, log=False)

At the moment I get as an error message:

Details
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions