Skip to content

Commit

Permalink
Update main feature imports
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasKristensen committed Apr 26, 2023
1 parent c6c34cc commit f079d9f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Zoom Animation/mandelbrot_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
20 changes: 19 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import mandelbrot_dask
import mandelbrot_opencl
import pyopencl
import mandelbrot_navigator


def mini_project_part_1():
Expand Down Expand Up @@ -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!")


7 changes: 5 additions & 2 deletions mandelbrot_navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -102,5 +106,4 @@ def main():


if __name__ == '__main__':
context, queue, device, name = mandelbrot_opencl.create_opencl_context(pyopencl.get_platforms()[0])
main()

0 comments on commit f079d9f

Please sign in to comment.