Create a grid of complex values of size nb_pixels*nb_pixels with real and imaginary parts ranging from -window_size to window_size (inclusive). Returns a numpy array. >>> prepare_grid(1,3) array([[-1.-1.j, -1.+0.j, -1.+1.j], [ 0.-1.j, 0.+0.j, 0.+1.j], [
(window_size: float, nb_pixels: int)
| 65 | |
| 66 | |
| 67 | def prepare_grid(window_size: float, nb_pixels: int) -> np.ndarray: |
| 68 | """ |
| 69 | Create a grid of complex values of size nb_pixels*nb_pixels with real and |
| 70 | imaginary parts ranging from -window_size to window_size (inclusive). |
| 71 | Returns a numpy array. |
| 72 | |
| 73 | >>> prepare_grid(1,3) |
| 74 | array([[-1.-1.j, -1.+0.j, -1.+1.j], |
| 75 | [ 0.-1.j, 0.+0.j, 0.+1.j], |
| 76 | [ 1.-1.j, 1.+0.j, 1.+1.j]]) |
| 77 | """ |
| 78 | x = np.linspace(-window_size, window_size, nb_pixels) |
| 79 | x = x.reshape((nb_pixels, 1)) |
| 80 | y = np.linspace(-window_size, window_size, nb_pixels) |
| 81 | y = y.reshape((1, nb_pixels)) |
| 82 | return x + 1.0j * y |
| 83 | |
| 84 | |
| 85 | def iterate_function( |