From 66d60af7c93dbbada811b20c5979f1d64fb53900 Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Tue, 1 Nov 2011 12:11:24 -0500 Subject: added heirarchical timing --- throw.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'throw.py') diff --git a/throw.py b/throw.py index fecc93d..4c7d691 100644 --- a/throw.py +++ b/throw.py @@ -120,7 +120,7 @@ def solve_fun(func, init_vars, timespace): time0 = current_time() time = numpy.linspace(*timespace) soln = odeint(func, init_vars, time) - print "took %s seconds to solve" % (current_time() - time0) + print " :: took %s seconds" % (current_time() - time0) return time, soln TimespaceTooSmall = Warning(" *** Requires larger timespace!!! *** ") @@ -145,6 +145,7 @@ def interpret(soln, max_tension): def solver(func, init_vars, timespace=(0,600,10**5), max_tension=max_tension, returns=['time', 'variables', 'slices', 'maxes']): + time0 = current_time() for n in itertools.count(1): time, soln = solve_fun(func, init_vars, timespace) @@ -159,6 +160,8 @@ def solver(func, init_vars, timespace=(0,600,10**5), max_tension=max_tension, slices = map(getslice, (time,) + variables) maxes = map(getmax, (time,) + variables) + print ": took %s seconds to solve" % (current_time() - time0) + out = [] for item in returns: out.append(vars()[item]) return tuple(out) -- cgit v1.2.3-70-g09d2