staghado commited on
Commit
7d6a2fc
·
1 Parent(s): c371552

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -39,7 +39,7 @@ def calculate_fourier_coefficients(xs, ys, num_points, coefficients):
39
  N = coefficients
40
  indices = [0] + [j for i in range(1, N + 1) for j in (i, -i)]
41
  with ThreadPoolExecutor(max_workers=8) as executor:
42
- coefs = list(executor.map(lambda n: compute_cn(f_precomputed, n, t_values), indices))
43
 
44
  return coefs
45
 
@@ -81,9 +81,10 @@ def animate(frame, coefs, time, fig, ax, background, circles, circle_lines, draw
81
  ax.draw_artist(drawing)
82
 
83
  fig.canvas.blit(ax.bbox)
84
-
85
  def generate_animation(frames, coefs, img_size, desired_range, theta_points, coefficients):
86
  fig, ax, background, circles, circle_lines, drawing = setup_animation_env(img_size, desired_range, coefficients)
 
87
  coefs_static = [(np.linalg.norm(c), fr) for c, fr in coefs]
88
  time = np.linspace(0, 1, num=frames)
89
  theta = np.linspace(0, tau, theta_points)
@@ -92,7 +93,7 @@ def generate_animation(frames, coefs, img_size, desired_range, theta_points, coe
92
  anim = animation.FuncAnimation(fig, animate, frames=frames, interval=5, fargs=(coefs, time, fig, ax, background, circles, circle_lines, drawing, draw_x, draw_y, coefs_static, theta))
93
 
94
  return anim
95
-
96
  def fourier_transform_drawing(input_image, frames, coefficients, img_size, blur_kernel_size, desired_range, num_points, theta_points):
97
  xs, ys = process_image(input_image, img_size, blur_kernel_size, desired_range)
98
  coefs = calculate_fourier_coefficients(xs, ys, num_points, coefficients)
 
39
  N = coefficients
40
  indices = [0] + [j for i in range(1, N + 1) for j in (i, -i)]
41
  with ThreadPoolExecutor(max_workers=8) as executor:
42
+ coefs = list(executor.map(lambda n: (compute_cn(f_precomputed, n, t_values), n), indices))
43
 
44
  return coefs
45
 
 
81
  ax.draw_artist(drawing)
82
 
83
  fig.canvas.blit(ax.bbox)
84
+
85
  def generate_animation(frames, coefs, img_size, desired_range, theta_points, coefficients):
86
  fig, ax, background, circles, circle_lines, drawing = setup_animation_env(img_size, desired_range, coefficients)
87
+ print(coefs)
88
  coefs_static = [(np.linalg.norm(c), fr) for c, fr in coefs]
89
  time = np.linspace(0, 1, num=frames)
90
  theta = np.linspace(0, tau, theta_points)
 
93
  anim = animation.FuncAnimation(fig, animate, frames=frames, interval=5, fargs=(coefs, time, fig, ax, background, circles, circle_lines, drawing, draw_x, draw_y, coefs_static, theta))
94
 
95
  return anim
96
+
97
  def fourier_transform_drawing(input_image, frames, coefficients, img_size, blur_kernel_size, desired_range, num_points, theta_points):
98
  xs, ys = process_image(input_image, img_size, blur_kernel_size, desired_range)
99
  coefs = calculate_fourier_coefficients(xs, ys, num_points, coefficients)