From adb75244becc9263e8e6a05af6074f76f7380bd9 Mon Sep 17 00:00:00 2001 From: Xin Zhang Date: Mon, 25 Oct 2021 17:02:19 +0800 Subject: [PATCH] fix cosmic ray bug -expTime, add output cr number --- ObservationSim/Instrument/Chip/Chip.py | 10 +++++----- ObservationSim/Instrument/Chip/Effects.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ObservationSim/Instrument/Chip/Chip.py b/ObservationSim/Instrument/Chip/Chip.py index 911b29f..5c3bf3c 100755 --- a/ObservationSim/Instrument/Chip/Chip.py +++ b/ObservationSim/Instrument/Chip/Chip.py @@ -355,10 +355,10 @@ class Chip(FocalPlane): # Add cosmic-rays if config["cosmic_ray"].lower() == "y" and pointing_type=='MS': print(" Adding Cosmic-Ray", flush=True) - cr_map = effects.produceCR_Map( + cr_map, cr_event_num = effects.produceCR_Map( xLen=self.npix_x, yLen=self.npix_y, exTime=self.exptime+0.5*self.readout_time, - cr_pixelRatio=0.003*(1+0.5*self.readout_time/self.exptime), + cr_pixelRatio=0.003*(self.exptime+0.5*self.readout_time)/150., gain=self.gain, attachedSizes=self.attachedSizes, seed=SeedCosmicRay+pointing_ID*30+self.chipID) # seed: obj-imaging:+0; bias:+1; dark:+2; flat:+3; @@ -469,7 +469,7 @@ class Chip(FocalPlane): seed=SeedBiasNonuni+self.chipID) if config["cosmic_ray"].lower() == "y": if config["cray_differ"].lower() == "y": - cr_map = effects.produceCR_Map( + cr_map, cr_event_num = effects.produceCR_Map( xLen=self.npix_x, yLen=self.npix_y, exTime=0.01, cr_pixelRatio=0.003*(0.01+0.5*self.readout_time)/(self.exptime+0.5*self.readout_time), @@ -541,7 +541,7 @@ class Chip(FocalPlane): ) if config["cosmic_ray"].lower() == "y": if config["cray_differ"].lower() == "y": - cr_map = effects.produceCR_Map( + cr_map, cr_event_num = effects.produceCR_Map( xLen=self.npix_x, yLen=self.npix_y, exTime=self.flat_exptime+0.5*self.readout_time, cr_pixelRatio=0.003*(self.flat_exptime+0.5*self.readout_time)/(self.exptime+0.5*self.readout_time), @@ -632,7 +632,7 @@ class Chip(FocalPlane): gain=1, seed_bias=SeedBiasNonuni+self.chipID) if config["cosmic_ray"].lower() == "y": if config["cray_differ"].lower() == "y": - cr_map = effects.produceCR_Map( + cr_map, cr_event_num = effects.produceCR_Map( xLen=self.npix_x, yLen=self.npix_y, exTime=self.dark_exptime+0.5*self.readout_time, cr_pixelRatio=0.003*(self.dark_exptime+0.5*self.readout_time)/(self.exptime+0.5*self.readout_time), diff --git a/ObservationSim/Instrument/Chip/Effects.py b/ObservationSim/Instrument/Chip/Effects.py index 441359e..49496ee 100644 --- a/ObservationSim/Instrument/Chip/Effects.py +++ b/ObservationSim/Instrument/Chip/Effects.py @@ -669,7 +669,7 @@ def produceCR_Map(xLen, yLen, exTime, cr_pixelRatio, gain, attachedSizes, seed=2 CRmap[sly, slx] += crMatrix_n[oky,:][:,okx] - return CRmap.astype(np.int32); + return CRmap.astype(np.int32), cr_event_size def ShutterEffectArr(GSImage, t_shutter=1.3, dist_bearing=735, dt=1E-3): -- GitLab