PySCeS / pysces

The official PySCeS project source code repository.
https://pysces.github.io
Other
34 stars 10 forks source link

Spurious output when loading a new model #12

Closed jmrohwer closed 8 years ago

jmrohwer commented 9 years ago

I've just pulled the latest version from git. When loading a model I now get stdout that looks like this:

In [2]: m=pysces.model('lin4')
Assuming extension is .psc
Using model directory: /home/jr/Pysces/psc
/home/jr/Pysces/psc/lin4.psc loading ..... 
Parsing file: /home/jr/Pysces/psc/lin4.psc

Calculating L matrix . . . . . . .  done.
Calculating K matrix . . . . . . .  done.

('symbolsX', [])
[]
[]

The output in the last 3 lines seems to do no harm but I guess it shouldn't be there. Brett has done some work on topological_sort in PyscesModel.py I see from the logs and browsing the code, which seems to have introduced this. You will be quicker to debug this as I have no idea yet what you did there and why :-)

bgoli commented 9 years ago

Oops. Thanks for reminding me of this, indeed it is harmless. Some debugging stuff that I'm using to implement SBML InitialAssignments (basically arbitrary math that is run at t < 0 or model inititialisation).

Actually we can do a lot more than InitAssignments can already with our !I syntax, however, the problem is that the SBML spec requires one to resolve the dependencies between assignments (cyclic depencies not allowed) ... that's what topological sort is for. Try this input file (I'll push a new version that gets rid of the print messages):

FIX: S P

R1:
    S = A
    V1*(S/S05)*(1 - A/(S*Keq1))*((S/S05)+(A/A05))**(h-1)/
    ((S/S05 + A/A05)**h + (1 + (P/P05)**h)/(1 + alpha*(P/P05)**h))

R2:
    A = B
    V2*(A - B/Keq2)/(A + K2A*(1 + B/K2B))

R3:
    B = P
    V3*(B - P/Keq3)/(B + K3B*(1 + P/K3P))

Keq1 = 400.0
V1 = 200.0
S05 = 1.0
A05 = 10000.0
P05 = 1.0
h = 4.0
alpha = 0.01

V2 = 10000.0
Keq2 = 10.0
K2A = 1.0
K2B = 1.0

V3 = 10000.0
Keq3 = 10.0
K3B = 1.0
K3P = 1.0

S = 1.0
A = 10.0
B = 10.0
P = 1.0

iapar1 = 1.0
iapar2 = 2.0

!I iapar2 = 3
!I S = 2
!I A_init = A + iapar1
!I sim_end = 5
!I sim_points = 50
!I A = iapar1 * iapar2
!I iapar1 = iapar2 * V1