Skip to content

Commit

Permalink
ENH add keyword for PSF noise (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr authored Oct 26, 2023
1 parent 743be9b commit 76c5561
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions montara/eastlake_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ def update_stash(self, config, stash):
_psf, safe = galsim.config.BuildGSObject({'blah': copy.deepcopy(config["psf"])}, 'blah')
assert safe, "PSF model must be reusable (safe) to use as an InterpolatedImage"
_psf = _psf.withFlux(1.0).drawImage(nx=25, ny=25, scale=0.263)

if config["output"].get("analyze_with_interpimage_psf_s2n", None) is not None:
nse = (
np.sum(_psf.array)
/ config["output"]["analyze_with_interpimage_psf_s2n"]
/ np.sqrt(np.prod(_psf.array.shape))
)
rng = np.random.RandomState(stash["step_primary_seed"])
_psf_arr = _psf.array + rng.normal(scale=nse, size=_psf.array.shape)
_psf = galsim.Image(_psf_arr, scale=_psf.scale)

_psf = galsim.InterpolatedImage(_psf, x_interpolant='lanczos15')
with np.printoptions(threshold=np.inf, precision=32):
_psf = repr(_psf)
Expand Down

0 comments on commit 76c5561

Please sign in to comment.