@@ -251,10 +251,10 @@ def apply_sparse_operator(
251251
252252 The default builder (`method="nufft"`) computes the precision operator as a type-1 NUFFT, so
253253 it costs `O(N_vis * nspread^2 + M log M)` for `M = 4 * Ny * Nx` — seconds even at a million
254- visibilities. The brute-force builders (`method="numpy"` / `"jax"`, and the `use_jax` kwarg)
255- are `O(N_vis * N_pix)` and can take minutes to hours; they are kept as the reference the
256- NUFFT builder is pinned against. Either way the result can be cached to disk and reloaded
257- via `nufft_precision_operator=`.
254+ visibilities. The brute-force builders (`method="numpy"` / `"jax"`) are `O(N_vis * N_pix)`
255+ and can take minutes to hours; they are kept as the reference the NUFFT builder is pinned
256+ against. Either way the result can be cached to disk and reloaded via
257+ `nufft_precision_operator=`.
258258
259259 Parameters
260260 ----------
@@ -284,15 +284,21 @@ def apply_sparse_operator(
284284 show_memory
285285 If `True`, memory usage statistics are printed while computing the NUFFT precision matrix.
286286 use_jax
287- If `True`, JAX is used to accelerate the NUFFT precision matrix computation.
287+ Only honoured when a brute-force builder is selected: `method="numpy"` with
288+ `use_jax=True` runs the JAX brute force (equivalent to `method="jax"`). Under the
289+ default `method="nufft"` it is ignored, because the NUFFT already runs on JAX --
290+ so an existing `use_jax=True` call keeps the fast path rather than being demoted
291+ to the `O(N_vis * N_pix)` brute force.
288292
289293 `PYAUTO_DISABLE_JAX=1` overrides this to `False`. That variable is a
290294 harness-level switch, not a preference: it is the documented way to force the
291295 NumPy path (the workspace `start_here` guides name it beside `use_jax=False`),
292296 and the smoke profiles set it so a fast run does not pay a JIT compile. An
293297 explicit `use_jax=True` in a script -- which is the right thing for a script
294298 demonstrating the production path to say -- must therefore not defeat it, or
295- the harness pays 2.3-3.2 s of compile for a backend it asked to disable.
299+ the harness pays 2.3-3.2 s of compile for a backend it asked to disable. (The
300+ same switch demotes the `"nufft"` builder to the NumPy brute force inside
301+ `nufft_precision_operator_from`.)
296302
297303 Precondition
298304 ------------
@@ -317,6 +323,9 @@ def apply_sparse_operator(
317323 If any visibility has unequal real and imaginary noise sigma.
318324 """
319325
326+ # `use_jax` now only selects between the two brute forces (the `"nufft"` builder
327+ # runs on JAX whatever it says), so this clears it before it can upgrade
328+ # `method="numpy"` to the JAX brute force under the kill switch.
320329 if disable_jax ():
321330 use_jax = False
322331
@@ -357,7 +366,7 @@ def apply_sparse_operator(
357366 n_vis = self .uv_wavelengths .shape [0 ]
358367 n_pix = self .real_space_mask .pixels_in_mask
359368
360- if method != "nufft" or use_jax :
369+ if method != "nufft" :
361370 logger .info (
362371 f"INTERFEROMETER - The precision operator is being built by a brute-force "
363372 f"builder, which is O(N_vis x N_pix) = O({ n_vis * n_pix :.1e} ) and can take "
@@ -432,9 +441,9 @@ def psf_precision_operator_from(
432441
433442 The default builder (`method="nufft"`) computes this as a type-1 (adjoint) NUFFT, which is
434443 `O(N_vis * nspread^2 + M log M)` for `M = 4 * Ny * Nx` — seconds even at a million
435- visibilities. The brute-force builders (`method="numpy"` / `"jax"`, and the `use_jax`
436- kwarg) are `O(N_vis * N_pix)` and can take minutes to hours on a CPU for a
437- high-resolution mask; they are kept as the reference the NUFFT builder is pinned against.
444+ visibilities. The brute-force builders (`method="numpy"` / `"jax"`) are
445+ `O(N_vis * N_pix)` and can take minutes to hours on a CPU for a high-resolution mask;
446+ they are kept as the reference the NUFFT builder is pinned against.
438447 The result can still be saved to disk and reloaded rather than recomputed on each run —
439448 use `apply_sparse_operator(nufft_precision_operator=...)` to attach a cached result.
440449
@@ -448,7 +457,9 @@ def psf_precision_operator_from(
448457 show_memory
449458 If `True`, memory usage statistics are printed during computation.
450459 use_jax
451- If `True`, the JAX brute-force builder is used (equivalent to `method="jax"`).
460+ Only honoured when a brute-force builder is selected: `method="numpy"` with
461+ `use_jax=True` runs the JAX brute force (equivalent to `method="jax"`). It is
462+ ignored under the default `method="nufft"`, which already runs on JAX.
452463 method
453464 Which builder computes the operator: `"nufft"` (default), `"numpy"` or `"jax"`.
454465 eps
0 commit comments