sys-bio / roadrunner

libRoadRunner: A high-performance SBML simulator
http://libroadrunner.org/
Other
39 stars 24 forks source link

Another issue with Matthias's code #301

Closed hsauro closed 8 years ago

hsauro commented 8 years ago

I ran his stochastic simulation (without the setSeed call which caused problems) and now get a new error, in the following line:

r.plot(s, show=False, loc=None, alpha=0.4, linewidth=1.0)

File "C:/Users/hsauro/Documents/Tellurium/stochastic1.py", line 30, in r.plot(s, show=False, loc=None, alpha=0.4, linewidth=1.0)

TypeError: plot() got an unexpected keyword argument 'alpha'

He must have a different version of tellurium/roadrunner or are there some changes not yet in release? It also doesn't understand linewidth and ignores show.

This is the full script:

import tellurium as te import numpy as np

r = te.loada(''' J1: S1 -> S2; k1_S1; J2: S2 -> S3; k2_S2 - k3_S3

J2_1: S2 -> S3; k2_S2

# J2_2: S3 -> S2; k3_S3;
J3: S3 -> S4; k4_S3;
k1 = 0.1; k2 = 0.5; k3 = 0.5; k4 = 0.5;
S1 = 100;

''')

set integrator, seed and selections for output

r.setIntegrator('gillespie') r.setSeed(1234) r.selections = ['time'] + r.getBoundarySpeciesIds() + r.getFloatingSpeciesIds()

run repeated simulation

Ncol = len(r.selections) Nsim = 30 points = 101 s_sum = np.zeros(shape=[points, Ncol]) for k in range(Nsim): r.resetToOrigin() s = r.simulate(0, 50, points) s_sum += s

no legend, do not show

r.plot(s, show=False, loc=None, alpha=0.4, linewidth=1.0)

add mean curve, legend, show everything and set labels, titels, ...

s_mean = s_sum/Nsim r.plot(s_mean, loc='upper right', show=True, linewidth=3.0, title="Stochastic simulation", xlabel="time", ylabel="concentration", grid=True);

kirichoi commented 8 years ago

te.plot and r.plot has been unified. Some of the options might have been lost on the process. Something to check.

matthiaskoenig commented 8 years ago

@hsauro @kirichoi All my examples are covered in unit tests in tellurium and run successfully. I think any issues arising are due to the win/mac versions not being the latest code (tellurium & roadrunner). During the building of the documentation it is tested that all notebooks can be completely executed with latest code and python code, i.e. the examples, are created automatically. In the unittests these python examples are all tested. All examples always have to run with the latest code. This was one of the main issues for me and that's why they are all part of the tellurium unit tests:

There should be an automatic workflow to fastly build the win & max versions from the latest code. @0u812 fixed all the roadrunner issues, for instance the getIntegratorByName things and are part of the develop versions of roadrunner and tellurium

matthiaskoenig commented 8 years ago

Latest develop version of tellurium and roadrunner fix these (but are not yet in packaged Tellurium).

By the way, this should never occur. The point 6. on the package checklist for tellurium https://github.com/sys-bio/tellurium/wiki/Checklists makes sure that the unit tests have to be run when creating the win and mac versions and these tests cover all python examples in the tellurium git.

0u812 commented 8 years ago

Looks like this is fixed in the repo