KappaTools
KappaTools copied to clipboard
Spawn multiple simulations and plot their average
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.
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...
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))