Commit 3b6d3d86 authored by Wouter Kessels's avatar Wouter Kessels
Browse files

Time elapsed

parent fff77f8e
This diff is collapsed.
......@@ -8,6 +8,7 @@ Takes input parameters from execute.ipynb.
import os
import pickle
import shutil
import time
from datetime import datetime
from glob import glob
from objects import *
......@@ -38,6 +39,8 @@ def pipeline(bodies, settings):
Used settings for the interacting system
start = time.time()
# Check whether all bodies have unique ID
if not check_ids(bodies):
raise ValueError("Two or more bodies have the same ID.")
......@@ -59,13 +62,18 @@ def pipeline(bodies, settings):
bodies = calc(bodies, settings)
print("Calculations completed!\n\n")
# Save output data to temporary file
temp_name_file, temp_name_folder = save_results(bodies, info, settings, overwrite=False, name=None, folder=temp_folder)
print("Temporary data saved\n\n")
# Execution time
end = time.time()
if isinstance(bodies[-1], Asteroids):
print("Time elapsed: {} minutes, for {} bodies and {} asteroids".format(round((end-start)/60, 1), len(bodies)-1, bodies[-1].N))
print("Time elapsed: {} minutes, for {} bodies (no asteroids)".format(round((end-start)/60, 1), len(bodies)))
return bodies, info, temp_name_file, temp_name_folder
......@@ -81,7 +81,7 @@ def trajectory(bodies, settings, inds='all'):
plt.title("Trajectories during $T = {} [y]$".format(np.max(bodies[inds[0]].times)))
plt.title("Trajectories during $T = {} [y_J]$".format(np.max(bodies[inds[0]].times)))
plt.legend(loc='lower right')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment