I'm trying to benchmark my code using the cProfile
and pstats
libraries. This is the code I've got so far:
profile = cProfile.Profile()
profile.runcall(gillespie_tau_leaping(propensity_calc, popul_num, LHS, stoch_rate, popul_num_all, tao_all, rxn_vector, delta_t, tao, epsi))
ps = pstats.Stats(profile)
ps.print_stats()
I'm trying to benchmark the gillespie_tau_leaping
function whose inputs are all arrays except for propensity_calc
which is an function, epsi
and delta_t
which are constants.
Only at the moment I'm getting the following error:
File "c:/Users/Mike/visual studio code project/MSc dissertation code/tau_leaping_variant_ssa.py", line 190, in <module>
profile.runcall(gillespie_tau_leaping(propensity_calc, popul_num, LHS, stoch_rate, popul_num_all, tao_all, rxn_vector, delta_t, tao, epsi))
TypeError: 'tuple' object is not callable
On the line profile.runcall(gillespie_tau_leaping(propensity_calc, popul_num, LHS, stoch_rate, popul_num_all, tao_all, rxn_vector, delta_t, tao, epsi))
I've had a similar problem before where I wasn't actually passing the function as an argument instead I was calling the function and passing the results (which was a tuple) to the built-in function, which according to the documentation requires a function to be passed to it.
Is it the same problem here, and if so how do I fix it (I never figured it out last time)
Cheers