Skip to content

Commit f1498e2

Browse files
committed
fix: enable exceptions for WCS
1 parent 6d970a3 commit f1498e2

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

jax_galsim/fitswcs.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import os
33

4+
import equinox
45
import galsim as _galsim
56
import jax
67
import jax.numpy as jnp
@@ -1094,12 +1095,10 @@ def _step(i, args):
10941095
unroll=True,
10951096
)[0:4]
10961097

1097-
x, y = jax.lax.cond(
1098-
jnp.maximum(jnp.max(jnp.abs(dx)), jnp.max(jnp.abs(dy))) > 2e-12,
1099-
lambda x, y: (x * jnp.nan, y * jnp.nan),
1100-
lambda x, y: (x, y),
1101-
x,
1102-
y,
1098+
x, y = equinox.error_if(
1099+
(x, y),
1100+
jnp.any(jnp.maximum(jnp.max(jnp.abs(dx)), jnp.max(jnp.abs(dy))) > 2e-12),
1101+
"Unable to solve for image_pos (max iter reached).",
11031102
)
11041103

11051104
return x, y

tests/GalSim

0 commit comments

Comments
 (0)