Skip to content

Commit c0c4e3a

Browse files
authored
feat: add benchmark for moffat as PSF (#186)
1 parent 9c26997 commit c0c4e3a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/jax/test_benchmarks.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,24 @@ def test_benchmark_spergel_calcfluxrad(benchmark, kind):
315315
lambda: _run_benchmark_spergel_calcfluxrad().block_until_ready(),
316316
)
317317
print(f"time: {dt:0.4g} ms", end=" ")
318+
319+
320+
def _run_moffat_bench_conv(gsmod):
321+
obj = gsmod.Spergel(nu=-0.6, scale_radius=5)
322+
psf = gsmod.Moffat(beta=2.5, fwhm=0.9)
323+
obj = gsmod.Convolve(
324+
[obj, psf],
325+
gsparams=gsmod.GSParams(minimum_fft_size=2048, maximum_fft_size=2048),
326+
)
327+
return obj.drawImage(nx=50, ny=50, scale=0.2).array
328+
329+
330+
_run_moffat_bench_conv_jit = jax.jit(partial(_run_moffat_bench_conv, jgs))
331+
332+
333+
@pytest.mark.parametrize("kind", ["run"])
334+
def test_benchmark_moffat_conv(benchmark, kind):
335+
dt = _run_benchmarks(
336+
benchmark, kind, lambda: _run_moffat_bench_conv_jit().block_until_ready()
337+
)
338+
print(f"time: {dt:0.4g} ms", end=" ")

0 commit comments

Comments
 (0)