Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated bright star treatment and addition of saturation #90

Merged
merged 11 commits into from
Sep 27, 2024
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/#:~:text=VIS%20pixels%20are%20saturated%20at,IE(AB)%3D16.0.
FedericoBerlfein marked this conversation as resolved.
Show resolved Hide resolved
n_dithers = 4
n_ccd = 36
n_ccd_row = 6
Expand Down
8 changes: 6 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 @@ -199,7 +199,11 @@ 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)
image.array[image.array > saturation_ADU] = saturation_ADU
FedericoBerlfein marked this conversation as resolved.
Show resolved Hide resolved

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
Loading