diff --git a/Zoom Animation/mandelbrot_animation.py b/Zoom Animation/mandelbrot_animation.py index c20758d..f84e838 100644 --- a/Zoom Animation/mandelbrot_animation.py +++ b/Zoom Animation/mandelbrot_animation.py @@ -31,7 +31,7 @@ def compute_set(x_0, y_0, x_1, y_1): return reshaped_solution -if __name__ == '__main__': +def main(): output_video_destination = f'mandelbrot_animation_{str(datetime.datetime.now()).replace(":", "-").replace(".", "")}.avi' print(f'Video save destination: {os.getcwd()}/{output_video_destination}') start_render_time = time.time() @@ -72,3 +72,6 @@ def compute_set(x_0, y_0, x_1, y_1): print("Video saved to:", os.getcwd() + "/" + output_video_destination) print("Complete! Total render time:", time.time() - start_render_time) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/main.py b/main.py index 4b9891e..514a634 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ import mandelbrot_dask import mandelbrot_opencl import pyopencl +import mandelbrot_navigator def mini_project_part_1(): @@ -54,6 +55,23 @@ def performance_compare(size): mandelbrot_opencl.mandelbrot_opencl(device=device, context=context, queue=queue, width=size, height=size, local_size=25, show_figure=False) +def mandelbrot_explore(): + mandelbrot_navigator.main() + + if __name__ == '__main__': - performance_compare(size=10000) + # performance_compare(size=10000) + print(f'\n {"#"*15} Mandelbrot Set {"#"*15}') + print(f'1) Performance Comparison') + print(f'2) Mandelbrot Navigation Tool') + + choice = input("Enter your choice: ") + if choice == '1': + plot_size = input("\nEnter the size of the plot (e.g. 1000): ") + performance_compare(size=int(plot_size)) + elif choice == '2': + mandelbrot_explore() + else: + print("Invalid choice!") + diff --git a/mandelbrot_navigator.py b/mandelbrot_navigator.py index 5b17dc7..c2b6837 100644 --- a/mandelbrot_navigator.py +++ b/mandelbrot_navigator.py @@ -8,7 +8,7 @@ import pyopencl import time import cv2 as cv -from mandelbrot_approaches import mandelbrot_opencl +import mandelbrot_opencl xmin, xmax, ymin, ymax = -2.3, 0.8, -1.2, 1.2 @@ -63,6 +63,10 @@ def main(): :return: """ global xmin, xmax, ymin, ymax + global context, queue, device, name + + context, queue, device, name = mandelbrot_opencl.create_opencl_context(pyopencl.get_platforms()[0]) + draw_window() while True: @@ -102,5 +106,4 @@ def main(): if __name__ == '__main__': - context, queue, device, name = mandelbrot_opencl.create_opencl_context(pyopencl.get_platforms()[0]) main()