Fix missing noise in simple_sim_2 and add output validation#9
Open
OfficialAbhinavSingh wants to merge 1 commit into
Open
Conversation
DeepLens.simple_sim_2 computed Poisson noise but never added it to the returned image (self.image_real = self.image_model + self.image_model, doubling the noiseless model instead of using self.poisson). This silently produced noiseless training/validation images for every Model_II/III/IV run using the Euclid/HST-resolution pipeline. Also add deeplense/validation.py to catch NaN/Inf/empty/constant images from failed lens configurations, wired into both simple_sim and simple_sim_2 (replacing a NaN check that had been written and then commented out). Wrap the Model_I-III batch simulation loops so a single failed draw is logged and skipped instead of crashing the entire (multi-thousand-iteration) SLURM job.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
simple_sim_2computedself.poisson = sim.noise_for_model(...)but then setself.image_real = self.image_model + self.image_model— doubling the noiseless model instead of adding the computed noise. This silently produced noiseless images for every pipeline usingsimple_sim_2(Model_II/III/IV, the Euclid/HST-resolution sims). Fixed toself.image_model + self.poisson.deeplense/validation.pywithvalidate_image(), raising on NaN/Inf/empty/constant-image outputs. Wired into bothsimple_simandsimple_sim_2, replacing a NaN check insimple_simthat had been written and then commented out (lens.py:270prior to this PR).Model_I/Model_II/Model_IIIbatch loops (sim_axion.py,sim_cdm.py,sim_no_sub.py, 9 scripts total) in try/except so a single failed draw is logged and skipped instead of crashing the entire multi-thousand-iteration SLURM job.Test plan
lenstronomy==1.9.2,pyHalofrom source,colossus) in a clean venv.simple_sim()andsimple_sim_2()end-to-end; confirmed no NaNs and correct shapes.image_realnow matchesimage_model + poisson(previously matchedimage_model * 2, i.e. no noise applied).validate_image()against NaN, Inf, empty, and constant-image inputs — all correctly raise; a normal random image passes.py_compileon all 9 modified batch scripts.