Commit 30382120 authored by Olaf's avatar Olaf

-

parents 2d2b58c8 a45c410b
This diff is collapsed.
......@@ -176,6 +176,8 @@ def save_results(source, name, description, rm_temp_name):
# TODO: implement a way to always include the initial positions of all bodies (including the asteroids)
# Check whether new file path is unique
if name[-4:] != ".pkl":
name += ".pkl"
if os.path.isfile(name):
raise ValueError("File path {} already exists. Define a unique file name".format(name))
......
......@@ -424,6 +424,27 @@ class Plot:
except:
self.traj_style = 'line'
# Figure properties
try:
self.fontsize_title = sets['fontsize_title']
except:
self.fontsize_title = 15
try:
self.fontsize_axislabel = sets['fontsize_axislabel']
except:
self.fontsize_axislabel = 12
try:
self.fontsize_axisticks = sets['fontsize_axisticks']
except:
self.fontsize_axisticks = 10
try:
self.fontsize_legend = sets['fontsize_legend']
except:
self.fontsize_legend = 10
class Settings:
......@@ -485,9 +506,8 @@ class Settings:
self.plot = sets['plot']
except:
raise IOError("Plot settings not given")
# System settings
# System settings
try:
self.time = sets['time']
except:
......
......@@ -17,6 +17,10 @@ def plots(file, settings_passed):
Settings for the interacting system and visual output
"""
# Check whether file extension is given
if file[-4:] != ".pkl":
file += ".pkl"
with open(file, 'rb') as f:
data = pickle.load(f)
f.close()
......@@ -78,11 +82,13 @@ def trajectory(bodies, settings, inds='all'):
plt.plot(x, y, color=col, lw=1)
plt.scatter(x[0], y[0], color=col, s=size(bodies[i].masses[num]))
plt.xlabel("$x$")
plt.ylabel("$y$")
plt.xlabel("$x$", fontsize = settings.plot.fontsize_axislabel)
plt.ylabel("$y$", fontsize = settings.plot.fontsize_axislabel)
plt.axis("equal")
plt.title("Trajectories during $T = {} [y_J]$".format(np.max(bodies[inds[0]].times)))
plt.legend(loc='lower right')
plt.title("Trajectories during $T = {} [y_J]$".format(np.max(bodies[inds[0]].times)),
fontsize = settings.plot.fontsize_title)
plt.legend(loc='lower right', fontsize = settings.plot.fontsize_legend)
plt.tick_params(labelsize = settings.plot.fontsize_axisticks)
plt.show()
......@@ -93,8 +99,10 @@ def trajectory(bodies, settings, inds='all'):
def plot_eccentricity(semi_major_axis,e):
# plot eccentricty to semi_major_axis
plt.plot(semi_major_axis,e,'b.')
plt.title('Astroid distribution')
plt.xlabel('Semi-major Axis [AU]'); plt.ylabel('Eccentricity [-]')
plt.title('Astroid distribution', fontsize = settings.plot.fontsize_title)
plt.xlabel('Semi-major Axis [AU]', fontsize = settings.plot.fontsize_axislabel)
plt.ylabel('Eccentricity [-]', fontsize = settings.plot.fontsize_axislabel)
plt.tick_params(labelsize = settings.plot.fontsize_axisticks)
plt.show()
def save_figure(figure, name):
......
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