Skip to content

Commit

Permalink
Merge pull request #90 from GalSim-developers/fb/bright_treatment
Browse files Browse the repository at this point in the history
Updated bright star treatment and addition of saturation
  • Loading branch information
FedericoBerlfein authored Sep 27, 2024
2 parents 00fd82e + c8aac00 commit d673624
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions euclidlike/instrument_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
short_exptime_nisp = 112 # s (for the shorter NISP imaging exposures)
short_exptime_vis = 95 # s (for the shorter exposures with VIS taken in parallel with NISP imaging)
read_noise = 4.4 # e-, https://www.euclid-ec.org/public/mission/vis/
saturation = 200000 # e-, from https://www.euclid-ec.org/public/mission/vis/
n_dithers = 4
n_ccd = 36
n_ccd_row = 6
Expand Down
10 changes: 8 additions & 2 deletions euclidlike_imsim/ccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

import euclidlike
from euclidlike.instrument_params import gain
from euclidlike.instrument_params import gain, saturation
from .noise import cfg_noise_key, parse_noise_config, get_noise


Expand Down Expand Up @@ -200,7 +200,13 @@ def addNoise(self, image, config, base, image_num, obj_num, current_var, logger)
image.quantize()

image += base["noise_image"]


# Apply saturation
saturation_ADU = np.round(saturation/gain)
mask_saturated = image.array > saturation_ADU
base["saturated_mask"] = mask_saturated
image.array[mask_saturated] = saturation_ADU

if self.cfg_noise["sky_subtract"]:
image -= base["sky_image"]

Expand Down
6 changes: 5 additions & 1 deletion euclidlike_imsim/stamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# import os, psutil
# process = psutil.Process()

# Parameter below determines the flux at which we switch from using Euclid-like PSF to the bright star PSF
# This is done to avoid visual artifacts from using the Euclid-like PSF for very bright objects.
# Tests to determine this value can be found here: https://github.com/GalSim-developers/GalSim-Euclid-Like/issues/46
psf_switch_limit = 8e5

class Euclidlike_stamp(StampBuilder):
"""This performs the tasks necessary for building the stamp for a single object.
Expand Down Expand Up @@ -89,7 +93,7 @@ def setup(self, config, base, xsize, ysize, ignore, logger):
gal_achrom = gal.evaluateAtWavelength(bandpass.effective_wavelength)
if (hasattr(gal_achrom, 'original') and isinstance(gal_achrom.original, galsim.DeltaFunction)):
# For bright stars, set the following stamp size limits
if self.flux < 1e6:
if self.flux < psf_switch_limit:
image_size = 500
self.pupil_bin = 8
elif self.flux < 6e6:
Expand Down

0 comments on commit d673624

Please sign in to comment.