From b196e2ef238d0e66431d74df642b041e4be12599 Mon Sep 17 00:00:00 2001 From: Paul Hansel Date: Tue, 29 Oct 2024 00:18:43 -0700 Subject: [PATCH] change bd.random to np.random fixes non-functional JAX backend for simulations using spatial noise sources --- diffractsim/light_sources/spatial_noise.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffractsim/light_sources/spatial_noise.py b/diffractsim/light_sources/spatial_noise.py index 02feaf7..93b86c0 100644 --- a/diffractsim/light_sources/spatial_noise.py +++ b/diffractsim/light_sources/spatial_noise.py @@ -41,7 +41,7 @@ def get_E(self, E, xx, yy, λ): fy = dfy*(bd.arange(Ny)-Ny//2) fxx, fyy = bd.meshgrid(fx, fy) - phase = bd.random.rand(Ny, Nx)*2*bd.pi + phase = np.random.rand(Ny, Nx)*2*bd.pi fp = bd.sqrt(fxx**2 + fyy**2) spatial_noise_freq = bd.exp(- 1/2 * ( (fp - self.f_mean)/ (self.f_spread))**2) * bd.exp(-1j*phase)