-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
ENH: Add to numpy simple functions for transform coordinate systems #5228
Copy link
Copy link
Closed
Description
It would be convenient to have these functions as a part of numpy mathematical routines.
cart2pol -- Transform Cartesian to polar coordinates
def cart2pol(x, y):
theta = np.arctan2(y, x)
rho = np.hypot(x, y)
return theta, rhopol2cart -- Transform polar to Cartesian coordinates
def pol2cart(theta, rho):
x = rho * np.cos(theta)
y = rho * np.sin(theta)
return x, ycart2sph -- Transform Cartesian to spherical coordinates
def cart2sph(x, y, z):
hxy = np.hypot(x, y)
r = np.hypot(hxy, z)
el = np.arctan2(z, hxy)
az = np.arctan2(y, x)
return az, el, rsph2cart -- Transform spherical to Cartesian coordinates
def sph2cart(az, el, r):
rcos_theta = r * np.cos(el)
x = rcos_theta * np.cos(az)
y = rcos_theta * np.sin(az)
z = r * np.sin(el)
return x, y, zReactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
Completed