-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile_two_compartment.py
More file actions
32 lines (22 loc) · 955 Bytes
/
profile_two_compartment.py
File metadata and controls
32 lines (22 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""In case you want to find out what makes your code so slow, run this file. It does a single run and prints what is taking up time."""
import cProfile
import numpy
from stem_cell_model.parameters import SimulationParameters, SimulationConfig
from stem_cell_model.results import MultiRunStats
from stem_cell_model.two_compartment_model import run_simulation
def main():
T = (16.153070175438597, 3.2357834505600382)
D = 20
phi = 0.05
params = SimulationParameters(n0=(D, 0), alpha=(0, 0), phi=(phi, phi), T=T, a=1/T[0], S=D)
random = numpy.random.Generator(numpy.random.MT19937(seed=1))
t_sim = 100000
output = MultiRunStats()
# run simulation
while output.t_tot < t_sim:
config = SimulationConfig(t_sim=t_sim - output.t_tot, random=random)
res = run_simulation(config, params)
output.add_results(res)
# print run statistics
output.print_run_statistics()
cProfile.run('main()')