Commit History

Updated lines 353-379 with: indentation in the update function found within the body of the method animate_particles
80c7e4e
verified

TroglodyteDerivations commited on

Updated lines 351-381 with: # Initialize a list to hold the PIL Image objects pil_images = [] # Inside the update function def update(frame): # ... existing update function ... # Save the current frame as an image pil_image = Image.fromarray(image_data) # Assuming image_data is the NumPy array representing the image pil_images.append(pil_image) # After the animation loop # Save each frame as an image to a temporary directory temp_dir = "temp_frames" os.makedirs(temp_dir, exist_ok=True) image_paths = [] for i, pil_image in enumerate(pil_images): image_path = os.path.join(temp_dir, f"frame_{i:03d}.png") pil_image.save(image_path) image_paths.append(image_path) # After generating the images, create a video from them frames_per_second = 30 # Adjust this to your desired frame rate video_path = "animation.mp4" clip = ImageSequenceClip(image_paths, fps=frames_per_second) clip.write_videofile(video_path, codec='libx264', audio=False) # Clean up the temporary directory for image_path in image_paths: os.remove(image_path) os.rmdir(temp_dir) return video_path
6b97254
verified

TroglodyteDerivations commited on

Updated line 370 with: for i, image in enumerate(image_paths):
029fbaa
verified

TroglodyteDerivations commited on

Updated lines 365-384 with: # Save each frame as an image to a temporary directory temp_dir = "temp_frames" os.makedirs(temp_dir, exist_ok=True) image_paths = [] for i, image in enumerate(pil_images): image_path = os.path.join(temp_dir, f"frame_{i:03d}.png") image.save(image_path) image_paths.append(image_path) # After generating the images, create a video from them frames_per_second = 30 # Adjust this to your desired frame rate video_path = "animation.mp4" clip = ImageSequenceClip(image_paths, fps=frames_per_second) clip.write_videofile(video_path, codec='libx264', audio=False) # Clean up the temporary directory for image_path in image_paths: os.remove(image_path) os.rmdir(temp_dir) return video_path
40670f5
verified

TroglodyteDerivations commited on

Updated line 8 with: from moviepy.editor import ImageSequenceClip and Update requirements.txt with: moviepy
48c41b0
verified

TroglodyteDerivations commited on

Updated lines 381-383 with: frames_per_second = 30 # Adjust this to your desired frame rate clip = ImageSequenceClip(pil_images, fps=frames_per_second) clip.write_videofile(video_path, codec='libx264', audio=False)
4c90a6a
verified

TroglodyteDerivations commited on

Updated line 408 with: video_path = gwo.animate_particles(obj=obj, goal=goal, frames=frames, interval=interval)
2a146f9
verified

TroglodyteDerivations commited on

Updated optimize function and iface interface lines 389 - 430
ce5727d
verified

TroglodyteDerivations commited on

Updated optimize function line 391-392 with: if not isinstance(goal, (tuple, list)): raise ValueError("Goal must be a tuple or a list with two elements.")
b43ce29
verified

TroglodyteDerivations commited on

Updated line 404 with: video_path = gwo.animate_particles(obj=obj,goal=goal, frames=frames, interval=interval)
1d6c8fd
verified

TroglodyteDerivations commited on

Updated line 404 with: video_path = gwo.animate_particles(goal=goal, frames=frames, interval=interval) and lines 418,419,420 with: gr.components.Slider()
3b23b1a
verified

TroglodyteDerivations commited on

Updated line 386 with: goal = (-2.2, 4.3) (Pair of Gaussians permeation = -5.0) leveraging functionality deriving from method def animate_particles(self, obj, **goal**, frames=100, interval=50): inside the underlying anatomy of class with name GWO. Then, leveraging that functionality inside the function optimize honing-in specifically on: def optimize(npart, ndim, max_iter, goal, frames, interval): *** video_path = gwo.animate_particles(goal, frames=frames, interval=interval) ***
8a812b2
verified

TroglodyteDerivations commited on

Updated lines 385,415, 416, and 417 with: def optimize(npart, ndim, max_iter, goal, frames, interval): , gr.components.Number(-5,-5,-5, step=1, label="Permeation of x and y coordinates”), gr.components.Number(100,100,100, step=1, label="Frames"), gr.components.Number(50,50,50, step=1, label="Interval")
e4441d7
verified

TroglodyteDerivations commited on

Updated optimize function with: video_path = gwo.animate_particles(goal, frames=frames, interval=interval) and iface = gr.Interface() line 415 gr.components.Number(-5,-5,-5, step=1, label="Permeation of x and y coordinates")
5d5fc37
verified

TroglodyteDerivations commited on

Updated optimize function with: goal (fourth parameter added in (-2.2 x-position, 4.3 y-position). Also, modified iface = gr.Interface with x,y goal position settings
059d8cc
verified

TroglodyteDerivations commited on

Updated optimize function reverting the constructor back into three original arguments (npart, ndim, max_iter) and updated iface = gr.Interface() by removing the additional parameters
630ae70
verified

TroglodyteDerivations commited on

Updated lines 385-424 with: new parameters in the optimize constructor and modifications in the iface = gr.Interface()
187a26b
verified

TroglodyteDerivations commited on

Updated obverse amalgamating the optimize & animate_gwo functions (spawning new mutation from original nascent bifurcating function variations)
6ea5af2
verified

TroglodyteDerivations commited on

Updated lines 419 & 420 with: #gr.components.Image(type="pil", label="Best Fitness Plot"), #gr.components.Image(type="pil", label="Best Positions Plot"),
bfe20d6
verified

TroglodyteDerivations commited on

Updated lines 401 , 404, and 407 with: #best_fitness_plot = gwo.plot_best_fitness(), #best_fitness_plot = gwo.plot_best_position(), return best_fitness_text, best_positions_text
f9289bc
verified

TroglodyteDerivations commited on

Updated line 456 with: outputs=gr.components.Video(format="mp4”) [removing type declaration]
3861218
verified

TroglodyteDerivations commited on

Updated line 452 with: gr.components.Slider(4.3,4.3,4.3, step=1, label="Goal Position Y"),
10d6e89
verified

TroglodyteDerivations commited on

Updated lines 447-454 with: gr.components.Slider(Modifying each unique instantiation [functionality being performed] vis-a-vis each Slider) promoting desired output
4668d5f
verified

TroglodyteDerivations commited on

Updated with a Function to create an instance of GWO and animate the particles (lines 430-441). Also, line 445 fn=animate_gwo (updated)
b6e9457
verified

TroglodyteDerivations commited on