KappaTools icon indicating copy to clipboard operation
KappaTools copied to clipboard

Spawn multiple simulations and plot their average

Open hmedina opened this issue 8 years ago • 2 comments

One way of dealing with large models is to down-scale them (e.g. by adjusting initial amounts, and rates) into smaller simulations that run faster. However, the noise is amplified as the amounts go down, so often I run many simulations in parallel and work with their average.

It would be useful if KaJaSim were capable of spawning 'n' identical simulations, plot the average trajectories, and also add (for a few points) the standard error.

In terms of recuperating the output files, the simulation runs could be named data_i.out, with i in [1:n], the file with the means something like means.out, and it all could be downloaded as a 7zip archive.

hmedina avatar Apr 19 '16 17:04 hmedina

We will not provide that directly in the very near futur but we are clearly going in the direction of making easier for other to right a program to do so using StdSim the KaSim simulator driven in json through stdin/stdout or it's wrapping as a Python library...

pirbo avatar Nov 04 '16 02:11 pirbo

I call KaSim using python multiprocessing and then averaging (and also calculating the standard deviation) the outputs files using pandas dataframes.

multiprocessing.Pool(multiprocessing.cpu_count()-1).map(run_kasim_precompiled, range(0, 1000))

glucksfall avatar Nov 22 '17 17:11 glucksfall