32
32
yukawa_coeff = 1.5e15 , # Yukawa potential coefficient
33
33
plot_orbits = True , # plot the orbits
34
34
project_orbits_2d = True , # plot the orbits on the bottom
35
- project_2d = True # project on the bottom of the grid
35
+ project_2d = True , # project on the bottom of the grid
36
+ high_res_plot = True , # enable high resolution simulation plot
37
+ fig_4k = True # use 4k resolution
36
38
)
37
39
38
40
@@ -166,26 +168,26 @@ def compute(self):
166
168
self ._positions = y [:num_bodies * 3 ].reshape ((num_bodies , 3 , - 1 ))
167
169
self ._velocities = y [num_bodies * 3 :].reshape ((num_bodies , 3 , - 1 ))
168
170
169
- def create_axes (self , ax ):
171
+ def create_axes (self , ax , scale ):
170
172
ax .grid (True )
171
173
ax .set_facecolor ((1.0 , 1.0 , 1.0 , 0.0 ))
172
174
ax .xaxis .set_pane_color ((1.0 , 1.0 , 1.0 , 0.0 ))
173
175
ax .yaxis .set_pane_color ((1.0 , 1.0 , 1.0 , 0.0 ))
174
176
ax .zaxis .set_pane_color ((1.0 , 1.0 , 1.0 , 0.0 ))
175
177
plt .rcParams ['lines.dashed_pattern' ] = [20 , 20 ]
176
178
ax .xaxis ._axinfo ['grid' ].update (
177
- {"linewidth" : 0.1 , "color" : (0 , 0 , 0 ), 'linestyle' : '--' })
179
+ {"linewidth" : scale * 0.5 , "color" : (0 , 0 , 0 ), 'linestyle' : '--' })
178
180
ax .yaxis ._axinfo ['grid' ].update (
179
- {"linewidth" : 0.1 , "color" : (0 , 0 , 0 ), 'linestyle' : '--' })
181
+ {"linewidth" : scale * 0.5 , "color" : (0 , 0 , 0 ), 'linestyle' : '--' })
180
182
ax .zaxis ._axinfo ['grid' ].update (
181
- {"linewidth" : 0.1 , "color" : (0 , 0 , 0 ), 'linestyle' : '--' })
183
+ {"linewidth" : scale * 0.5 , "color" : (0 , 0 , 0 ), 'linestyle' : '--' })
182
184
183
185
ax .xaxis .line .set_color ((0.0 , 0.0 , 0.0 , 1.0 ))
184
- ax .xaxis .line .set_linewidth (1.0 )
186
+ ax .xaxis .line .set_linewidth (scale * 1.0 )
185
187
ax .yaxis .line .set_color ((0.0 , 0.0 , 0.0 , 1.0 ))
186
- ax .yaxis .line .set_linewidth (1.0 )
188
+ ax .yaxis .line .set_linewidth (scale * 1.0 )
187
189
ax .zaxis .line .set_color ((0.0 , 0.0 , 0.0 , 1.0 ))
188
- ax .zaxis .line .set_linewidth (1.0 )
190
+ ax .zaxis .line .set_linewidth (scale * 1.0 )
189
191
ax .set_xlabel ('' , fontsize = 10 )
190
192
ax .set_ylabel ('' , fontsize = 10 )
191
193
ax .set_zlabel ('' , fontsize = 10 )
@@ -211,12 +213,18 @@ def format_func(value, tick_number):
211
213
212
214
def animate (self ):
213
215
self ._perc = 0
214
- if cfg .save_anim :
215
- fig = plt .figure (figsize = (12 , 8 ), dpi = 300 )
216
+ dpi = 300 if (cfg .high_res_plot and not cfg .save_anim ) else 100
217
+ if cfg .fig_4k :
218
+ figsize = (3840 / dpi , 2160 / dpi )
219
+ scale1 = 4.0
220
+ scale2 = 20.0
216
221
else :
217
- fig = plt .figure (figsize = (12 , 8 ))
222
+ figsize = (1920 / dpi , 1080 / dpi )
223
+ scale1 = 1.0
224
+ scale2 = 1.0
225
+ fig = plt .figure (figsize = figsize )
218
226
ax = fig .add_subplot (111 , projection = '3d' )
219
- self .create_axes (ax )
227
+ self .create_axes (ax , scale1 )
220
228
self ._scat = []
221
229
self ._scat2 = []
222
230
distances = [np .linalg .norm (body .position ) for body in self ._bodies ]
@@ -225,13 +233,13 @@ def animate(self):
225
233
self ._scat .append (
226
234
ax .scatter ([body .position [0 ]], [body .position [1 ]],
227
235
[body .position [2 ]],
228
- color = body .color , s = body .mass_plot ,
236
+ color = body .color , s = scale2 * body .mass_plot ,
229
237
label = body .name , marker = 'o' , zorder = index ))
230
238
if cfg .project_2d :
231
239
self ._scat2 .append (
232
240
ax .scatter ([body .position [0 ]], [body .position [1 ]],
233
241
- self .axs_limit ,
234
- color = (.5 , .5 , .5 ), s = body .mass_plot ,
242
+ color = (.5 , .5 , .5 ), s = scale2 * body .mass_plot ,
235
243
label = body .name , marker = 'o' , zorder = index ))
236
244
if cfg .plot_orbits :
237
245
x_positions = self ._positions [index , 0 , :]
@@ -242,13 +250,13 @@ def animate(self):
242
250
z_positions = self ._positions [index , 2 , :]
243
251
ax .plot (
244
252
x_positions , y_positions , z_positions ,
245
- color = (.5 , .5 , .5 ), linewidth = 0.8 )
253
+ color = (.5 , .5 , .5 ), linewidth = scale1 * 0.8 )
246
254
ax .set_xlim (- self .axs_limit , self .axs_limit )
247
255
ax .set_ylim (- self .axs_limit , self .axs_limit )
248
256
ax .set_zlim (- self .axs_limit , self .axs_limit )
249
257
scat_legend_handles = [scatter for scatter in self ._scat ]
250
- ax .legend (handles = scat_legend_handles , fontsize = 20 , loc = 'upper right' ,
251
- bbox_to_anchor = (1.2 , 1 ), frameon = False )
258
+ ax .legend (handles = scat_legend_handles , fontsize = scale1 * 20 ,
259
+ loc = 'upper right' , bbox_to_anchor = (1.2 , 1 ), frameon = False )
252
260
253
261
def animate_frame (frame ):
254
262
if cfg .verbose :
0 commit comments