Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
rev: v0.15.4
hooks:
- id: ruff-check
args: [ --fix ]
Expand Down
11 changes: 4 additions & 7 deletions jax_galsim/core/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,10 @@ def _sample_zero(n_photons_data):
1.0,
rng,
),
lambda flux,
eta_factor,
max_sb,
poisson_flux,
max_extra_noise,
rng: _calculate_n_photons_flux_nonzero(
flux, eta_factor, max_sb, poisson_flux, max_extra_noise, rng
lambda flux, eta_factor, max_sb, poisson_flux, max_extra_noise, rng: (
_calculate_n_photons_flux_nonzero(
flux, eta_factor, max_sb, poisson_flux, max_extra_noise, rng
)
),
n_photons_data.flux,
n_photons_data.flux_per_photon,
Expand Down
5 changes: 3 additions & 2 deletions jax_galsim/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,9 @@ def _applyTo(self, image):
def _getVariance(self):
return jax.lax.cond(
self.gain > 0.0,
lambda gain, sky_level, read_noise: sky_level / gain
+ (read_noise / gain) ** 2,
lambda gain, sky_level, read_noise: (
sky_level / gain + (read_noise / gain) ** 2
),
lambda gain, sky_level, read_noise: read_noise**2,
self.gain,
self.sky_level,
Expand Down
14 changes: 8 additions & 6 deletions tests/jax/test_interpolant_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ def _timeit(lz, ntest=10, jit=False, dox=False):
]
+ [galsim.Lanczos(i, conserve_dc=False) for i in range(1, 31)]
+ [galsim.Lanczos(i, conserve_dc=True) for i in range(1, 31)],
ids=lambda x: str(x)
.replace("galsim.", "")
.replace("(", "")
.replace(")", "")
.replace(", ", "-")
+ ("" if not isinstance(x, galsim.Lanczos) else f"-{x.conserve_dc}"),
ids=lambda x: (
str(x)
.replace("galsim.", "")
.replace("(", "")
.replace(")", "")
.replace(", ", "-")
+ ("" if not isinstance(x, galsim.Lanczos) else f"-{x.conserve_dc}")
),
)
@pytest.mark.parametrize("kind", ["fluxes", "ranges", "xval", "kval"])
def test_interpolant_jax_same_as_galsim(interp, kind):
Expand Down