diff --git a/config/imsim-config.yaml b/config/imsim-config.yaml index e5089b76..37a44b4f 100644 --- a/config/imsim-config.yaml +++ b/config/imsim-config.yaml @@ -287,8 +287,8 @@ stamp: HA: type: Degrees theta: { type: OpsimData, field: HA } - # - - # type: Shift + - + type: Shift - type: RubinDiffractionOptics det_name: $det_name diff --git a/imsim/lsst_image.py b/imsim/lsst_image.py index 3be2ea02..4d83b881 100644 --- a/imsim/lsst_image.py +++ b/imsim/lsst_image.py @@ -252,14 +252,14 @@ def buildImage(self, config, base, image_num, obj_num, logger): # Add the Shift photon operator if it isn't already being used. # Place it before RubinDiffractionOptics if present, otherwise append. - photon_ops = base["stamp"]["photon_ops"] - shift_op = {'type': 'Shift'} - if shift_op not in photon_ops: - rubin_diffraction_optics_index = next((index for (index, d) in enumerate(photon_ops) if d["type"] == "RubinDiffractionOptics" or d["type"] == "RubinOptics"), None) - if rubin_diffraction_optics_index is not None: - photon_ops.insert(rubin_diffraction_optics_index, shift_op) - else: - photon_ops.append(shift_op) + # photon_ops = base["stamp"]["photon_ops"] + # shift_op = {'type': 'Shift'} + # if shift_op not in photon_ops: + # rubin_diffraction_optics_index = next((index for (index, d) in enumerate(photon_ops) if d["type"] == "RubinDiffractionOptics" or d["type"] == "RubinOptics"), None) + # if rubin_diffraction_optics_index is not None: + # photon_ops.insert(rubin_diffraction_optics_index, shift_op) + # else: + # photon_ops.append(shift_op) if full_image is None: full_image = create_full_image(config, base) diff --git a/imsim/stamp.py b/imsim/stamp.py index fda2d629..f951c774 100644 --- a/imsim/stamp.py +++ b/imsim/stamp.py @@ -470,12 +470,12 @@ def buildPSF(self, config, base, gsparams, logger): else: fft_sb_thresh = 0. - # if self.nominal_flux < 1.e6 or not fft_sb_thresh or self.nominal_flux < fft_sb_thresh: - # self.use_fft = False - # logger.info('Use photon shooting for object %d. ' - # 'nominal flux = %.0f, FFT threshold %.0f', - # base.get('obj_num'), self.nominal_flux, fft_sb_thresh) - # return psf + if self.nominal_flux < 1.e6 or not fft_sb_thresh or self.nominal_flux < fft_sb_thresh: + self.use_fft = False + logger.info('Use photon shooting for object %d. ' + 'nominal flux = %.0f, FFT threshold %.0f', + base.get('obj_num'), self.nominal_flux, fft_sb_thresh) + return psf dm_detector = None if not hasattr(self, 'det') else self.det fft_psf, draw_method, self.fft_flux = get_fft_psf_maybe( diff --git a/tests/test_image.py b/tests/test_image.py index 307dce4f..d1c803be 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -153,6 +153,7 @@ def create_test_config( "photon_ops": [ {"type": "TimeSampler", "t0": 0.0, "exptime": exptime}, {"type": "PupilAnnulusSampler", "R_outer": 4.18, "R_inner": 2.55}, + {"type": "Shift"}, { **optics_args, "boresight": boresight, @@ -256,5 +257,6 @@ def test_lsst_image_batches_photon_pooling(): testfns = [ v for k, v in vars().items() if k.startswith(args.test_prefix) and callable(v) ] - for testfn in testfns: - testfn() + # for testfn in testfns: + # testfn() + test_lsst_image_individual_objects()