summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Anderson <jandew+dev@gmail.com>2011-11-01 12:11:24 -0500
committerJoe Anderson <jandew+dev@gmail.com>2011-11-01 12:11:24 -0500
commit66d60af7c93dbbada811b20c5979f1d64fb53900 (patch)
treec66b8cb4993985bda99d1e6502cbcc20e91245a1
parent7c287638c316b285b3dbcdaf56c650164828a42c (diff)
downloadtoss-66d60af7c93dbbada811b20c5979f1d64fb53900.tar.gz
toss-66d60af7c93dbbada811b20c5979f1d64fb53900.zip
added heirarchical timing
-rw-r--r--throw.py5
1 files changed, 4 insertions, 1 deletions
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)