############################################################################################################### #Simulation settings # ############################################################################################################### #This section is used to store simulation specific parameter settings, e.g. plot colors or simlation bounds ############################################################################################################### #Simulation itself # ############################################################################################################### #In this section the simulation itself is placed. #This part with save figure is necessary, as this saves the plots to the specific directory, in order to generate a GIF later on. if SAVE_FIGURE: short_save_name = make_name(IMAGE_COUNTER, TOTAL_IMAGES, SAVE_FIGURE_FORMAT) save_name = os.path.join(SAVE_FIGURE_LOCATION, short_save_name) plt.savefig(save_name, bbox_inches='tight', quality=PLOT_QUALITY) IMAGE_COUNTER += 1 ############################################################################################################### #End of simulation and wrapping up # ############################################################################################################### #This last part is a small section, closing the plot canvas and making the gif image and cleaning up the directory if PLOT_FIGURE: plt.close() print "FINISHED" if MAKE_GIFS:
circle=plt.Circle((x[i_particle],y[i_particle]),r[i_particle],fc=color_ball_special,ec=color_ball_edge) plt.gcf().gca().add_artist(circle) else: circle=plt.Circle((x[i_particle],y[i_particle]),r[i_particle],fc=color_ball,ec=color_ball_edge) plt.gcf().gca().add_artist(circle) # Draw textbox and text if start_colliding: if PLOT_FIGURE: plt.draw() plt.pause(PLOT_PAUSE_TIME) if start_colliding: if SAVE_FIGURE: short_save_name = make_name(IMAGE_COUNTER,max_steps,SAVE_FIGURE_FORMAT) save_name = os.path.join(SAVE_FIGURE_LOCATION,short_save_name) plt.savefig(save_name,bbox_inches='tight', quality = PLOT_QUALITY) IMAGE_COUNTER += 1 if start_colliding: #Clear canvas plt.clf() #Only really increase time if the 'start_colliding' settings is True, else increase the time for which there are overlaps if start_colliding: i_time += 1 else: i_time_overlapping += 1 ###############################################################################################################