Created
January 20, 2023 16:30
-
-
Save nbecker/18006c9a478d1a53e7210c4969c38f3f to your computer and use it in GitHub Desktop.
_array2.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
#pythran export getArrayFactor (complex[:], float[:], float[:], float[:,:], float[:,:], float) | |
#pythran export getArrayFactor (complex[:], float[:], float[:], float, float, float) | |
def getArrayFactor(W, px, py, theta, phi, L): | |
theta = np.array (theta) | |
phi = np.array (phi) | |
N = px.shape[0] | |
AF = np.zeros(theta.shape, dtype=complex) | |
kx = np.sin(theta) * np.cos(phi) * 2.0 * np.pi / L | |
ky = np.sin(theta) * np.sin(phi) * 2.0 * np.pi / L | |
for n in range(N): | |
AF += W[n] * np.exp(-1j * (kx * px[n] + ky * py[n])) | |
magAF = np.abs(AF) | |
return magAF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment