Quick sampling diagnostics for Collins LCT on separable grids.
Returns Nyquist ratios (>=1 is safe-ish):
- p_kernel: sampling of exp(-i 2π x x' /(λ b)) kernel
- p_pre: sampling of input chirp exp(i π a x^2 /(λ b))
- p_post: sampling of output chirp exp(i π d x'^2 /(λ b))
Source code in abcdlux_patch.py
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291 | def lct_sampling_quick(x_in, x_out, lam, ABCD, eps=1e-30):
"""
Quick sampling diagnostics for Collins LCT on separable grids.
Returns Nyquist ratios (>=1 is safe-ish):
- p_kernel: sampling of exp(-i 2π x x' /(λ b)) kernel
- p_pre: sampling of input chirp exp(i π a x^2 /(λ b))
- p_post: sampling of output chirp exp(i π d x'^2 /(λ b))
"""
a, b, c, d = [ABCD.reshape(-1)[i] for i in range(4)]
dx_in = x_in[1] - x_in[0]
dx_out = x_out[1] - x_out[0]
X_in = 0.5 * (x_in[-1] - x_in[0])
X_out = 0.5 * (x_out[-1] - x_out[0])
# Kernel phase: exp(-i 2π x x' /(λ b))
# worst phase slope in x is at max |x'|
dphi_in_max = (2 * jnp.pi / (lam * jnp.abs(b) + eps)) * X_out * dx_in
dphi_out_max = (2 * jnp.pi / (lam * jnp.abs(b) + eps)) * X_in * dx_out
p_kernel = jnp.pi / (jnp.maximum(dphi_in_max, dphi_out_max) + eps)
# Pre/post chirps: phase ~ π a x^2 /(λ b), slope ~ 2π a x /(λ b)
dphi_pre_max = (2 * jnp.pi * jnp.abs(a) / (lam * jnp.abs(b) + eps)) * X_in * dx_in
dphi_post_max = (
(2 * jnp.pi * jnp.abs(d) / (lam * jnp.abs(b) + eps)) * X_out * dx_out
)
p_pre = jnp.pi / (dphi_pre_max + eps)
p_post = jnp.pi / (dphi_post_max + eps)
return {"p_kernel": p_kernel, "p_pre": p_pre, "p_post": p_post}
|