Commit 053e6079 authored by Zhang Xin's avatar Zhang Xin
Browse files

merge accuracy skybackground model and set sky background back model

parent 7ef97412
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -109,6 +109,25 @@ class SimSteps:
        return chip, filt, tel, pointing

    def add_sky_background(self, chip, filt, tel, pointing, catalog, obs_param):
        if not hasattr(self, 'h_ext'):
            _, _ = self.prepare_headers(chip=chip, pointing=pointing)
        chip_wcs = galsim.FitsWCS(header = self.h_ext)

        if "flat_level" not in obs_param or "flat_level_filt" not in obs_param:
            chip, filt, tel, pointing = self.add_sky_background_sci(chip, filt, tel, pointing, catalog, obs_param)
        else:
            if obs_param.get('flat_level') is None or obs_param.get('flat_level_filt')is None:
                chip, filt, tel, pointing = self.add_sky_background_sci(chip, filt, tel, pointing, catalog, obs_param)
            else:
                chip, filt, tel, pointing = self.add_sky_flat_calibration(chip, filt, tel, pointing, catalog, obs_param)

    chip, filt, tel, pointing = self.add_sky_background_sci(chip, filt, tel, pointing, catalog, obs_param)
        
        return chip, filt, tel, pointing



    def add_sky_background_sci(self, chip, filt, tel, pointing, catalog, obs_param):
        flat_normal = np.ones_like(chip.img.array)
        if obs_param["flat_fielding"] == True:
            flat_normal = flat_normal * chip.flat_img.array / np.mean(chip.flat_img.array)
@@ -524,5 +543,5 @@ SIM_STEP_TYPES = {
    "gain": "apply_gain",
    "quantization_and_output": "quantization_and_output",
    "led_calib_model":"add_LED_Flat",
    "sky_flatField":"add_sky_flat_calibration",
    # "sky_flatField":"add_sky_flat_calibration",
}
 No newline at end of file
+8 −1
Original line number Diff line number Diff line
@@ -24,12 +24,19 @@ call_sequence:
    LED_TYPE: ['LED5']
    LED_TIME: [1.]
  
  sky_flatField:

  # flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key
  # flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if 
  # none,set null,or delete the key

  sky_background:
    exptime: 150. # [s]
    shutter_effect: YES
    flat_fielding: YES
    enable_straylight_model: YES
    flat_level: 20000
    flat_level_filt: g

  # Apply PRNU to accumulated photons
  PRNU_effect: {}
  # Accumulate photons caused by cosmic rays
+5 −0
Original line number Diff line number Diff line
@@ -23,11 +23,16 @@ call_sequence:
    flat_fielding: YES
    field_dist: YES
  # Accumulate fluxes from sky background
  # flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key
  # flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if 
  # none,set null,or delete the key
  sky_background:
    exptime: 150. # [s]
    shutter_effect: YES
    flat_fielding: YES
    enable_straylight_model: YES
    flat_level: null
    flat_level_filt: null
  # Apply PRNU to accumulated photons
  PRNU_effect: {}
  # Accumulate photons caused by cosmic rays