Skip to content

Commit beb692a

Browse files
committed
fix bad values for high (abs) eta
1 parent 0b9bf7e commit beb692a

File tree

1 file changed

+2
-6
lines changed
  • src/vector/_compute/spatial

1 file changed

+2
-6
lines changed

src/vector/_compute/spatial/eta.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828

2929

3030
def xy_z(lib, x, y, z):
31-
return lib.nan_to_num(
32-
lib.arctanh(z / lib.sqrt(x**2 + y**2 + z**2)), nan=0.0
33-
) * lib.absolute(lib.sign(z))
31+
return lib.where(z, lib.arcsinh(z / lib.sqrt(x**2 + y**2)), z)
3432

3533

3634
def xy_theta(lib, x, y, theta):
@@ -42,9 +40,7 @@ def xy_eta(lib, x, y, eta):
4240

4341

4442
def rhophi_z(lib, rho, phi, z):
45-
return lib.nan_to_num(
46-
lib.arctanh(z / lib.sqrt(rho**2 + z**2)), nan=0.0
47-
) * lib.absolute(lib.sign(z))
43+
return lib.where(z, lib.arcsinh(z / rho), z)
4844

4945

5046
def rhophi_theta(lib, rho, phi, theta):

0 commit comments

Comments
 (0)