Commit f058808a authored by Fang Yuedong's avatar Fang Yuedong
Browse files

add crosstalk step. add validation for objects parameters

parent 2eb4e6b5
Pipeline #7206 failed with stage
in 0 seconds
...@@ -74,6 +74,8 @@ call_sequence: ...@@ -74,6 +74,8 @@ call_sequence:
# Add bias # Add bias
bias: bias:
bias_16channel: YES bias_16channel: YES
# Add cross-talk
cross_talk: {}
# Add readout noise # Add readout noise
readout_noise: {} readout_noise: {}
# Apply gain # Apply gain
......
...@@ -29,8 +29,8 @@ class CatalogBase(metaclass=ABCMeta): ...@@ -29,8 +29,8 @@ class CatalogBase(metaclass=ABCMeta):
param = { param = {
"star": -1, "star": -1,
"id": -1, "id": -1,
"ra": 0, "ra": -999.,
"dec": 0., "dec": -999.,
"ra_orig": 0., "ra_orig": 0.,
"dec_orig": 0., "dec_orig": 0.,
"z": 0., "z": 0.,
...@@ -44,15 +44,15 @@ class CatalogBase(metaclass=ABCMeta): ...@@ -44,15 +44,15 @@ class CatalogBase(metaclass=ABCMeta):
"bfrac": 0., "bfrac": 0.,
"av": 0., "av": 0.,
"redden": 0., "redden": 0.,
"hlr_bulge": 0., "hlr_bulge": -999.,
"hlr_disk": 0., "hlr_disk": -999.,
"ell_bulge": 0., "ell_bulge": 0.,
"ell_disk": 0., "ell_disk": 0.,
"ell_tot": 0., "ell_tot": 0.,
"e1_disk": 0., "e1_disk": -999.,
"e2_disk": 0., "e2_disk": -999.,
"e1_bulge": 0., "e1_bulge": -999.,
"e2_bulge": 0., "e2_bulge": -999.,
"teff": 0., "teff": 0.,
"logg": 0., "logg": 0.,
"feh": 0., "feh": 0.,
......
...@@ -11,11 +11,11 @@ class SimSteps: ...@@ -11,11 +11,11 @@ class SimSteps:
from .prepare_headers import prepare_headers, updateHeaderInfo from .prepare_headers import prepare_headers, updateHeaderInfo
from .add_sky_background import add_sky_background_sci, add_sky_flat_calibration, add_sky_background from .add_sky_background import add_sky_background_sci, add_sky_flat_calibration, add_sky_background
from .add_objects import add_objects from .add_objects import add_objects, _is_obj_valid
from .add_cosmic_rays import add_cosmic_rays from .add_cosmic_rays import add_cosmic_rays
from .add_pattern_noise import apply_PRNU, add_poisson_and_dark, add_detector_defects, add_nonlinearity, add_blooming, add_bias from .add_pattern_noise import apply_PRNU, add_poisson_and_dark, add_detector_defects, add_nonlinearity, add_blooming, add_bias
from .add_brighter_fatter_CTE import add_brighter_fatter, apply_CTE from .add_brighter_fatter_CTE import add_brighter_fatter, apply_CTE
from .readout_output import add_prescan_overscan, add_readout_noise, apply_gain, quantization_and_output from .readout_output import add_prescan_overscan, add_readout_noise, apply_gain, quantization_and_output, add_crosstalk
from .add_LED_flat import add_LED_Flat from .add_LED_flat import add_LED_Flat
...@@ -37,4 +37,5 @@ SIM_STEP_TYPES = { ...@@ -37,4 +37,5 @@ SIM_STEP_TYPES = {
"quantization_and_output": "quantization_and_output", "quantization_and_output": "quantization_and_output",
"led_calib_model": "add_LED_Flat", "led_calib_model": "add_LED_Flat",
"sky_flatField": "add_sky_flat_calibration", "sky_flatField": "add_sky_flat_calibration",
"cross_talk": "add_crosstalk"
} }
...@@ -10,6 +10,22 @@ from observation_sim.psf import PSFGauss, FieldDistortion, PSFInterp, PSFInterpS ...@@ -10,6 +10,22 @@ from observation_sim.psf import PSFGauss, FieldDistortion, PSFInterp, PSFInterpS
from astropy.time import Time from astropy.time import Time
from datetime import datetime, timezone from datetime import datetime, timezone
def _is_obj_valid(self, obj):
if obj.param['star'] == 4:
# Currently there's no parameter checks for 'calib' type
return True
pos_keys = ['ra', 'dec']
shape_keys = ['hlr_bulge', 'hlr_disk', 'e1_disk', 'e2_disk', 'e1_bulge', 'e2_bulge']
if any(obj.param[key] == -999. for key in pos_keys):
msg = 'One or more positional information (ra, dec) is missing'
self.chip_output.Log_error(msg)
return False
if obj.param['star'] == 0 and any(obj.param[key] == -999. for key in shape_keys):
msg = 'One or more shape information (hlr_bulge, hlr_disk, e1_disk, e2_disk, e1_bulge, e2_bulge) is missing'
self.chip_output.Log_error(msg)
return False
return True
def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
...@@ -85,6 +101,9 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -85,6 +101,9 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
# break # break
obj = cat.objs[j] obj = cat.objs[j]
if not self._is_obj_valid(obj):
continue
# load and convert SED; also caculate object's magnitude in all CSST bands # load and convert SED; also caculate object's magnitude in all CSST bands
try: try:
sed_data = cat.load_sed(obj) sed_data = cat.load_sed(obj)
...@@ -153,7 +172,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -153,7 +172,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
if pos_img.x == -1 or pos_img.y == -1: if pos_img.x == -1 or pos_img.y == -1:
self.chip_output.Log_info('obj_ra = %.6f, obj_dec = %.6f, obj_ra_orig = %.6f, obj_dec_orig = %.6f' % ( self.chip_output.Log_info('obj_ra = %.6f, obj_dec = %.6f, obj_ra_orig = %.6f, obj_dec_orig = %.6f' % (
obj.ra, obj.dec, obj.ra_orig, obj.dec_orig)) obj.ra, obj.dec, obj.ra_orig, obj.dec_orig))
self.chip_output.Log_error("Objected missed: %s" % (obj.id)) self.chip_output.Log_error("Object missed: %s" % (obj.id))
missed_obj += 1 missed_obj += 1
obj.unload_SED() obj.unload_SED()
continue continue
...@@ -199,7 +218,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -199,7 +218,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
pass pass
elif isUpdated == 0: elif isUpdated == 0:
missed_obj += 1 missed_obj += 1
self.chip_output.Log_error("Objected missed: %s" % (obj.id)) self.chip_output.Log_error("Object missed: %s" % (obj.id))
else: else:
self.chip_output.Log_error( self.chip_output.Log_error(
"Draw error, object omitted: %s" % (obj.id)) "Draw error, object omitted: %s" % (obj.id))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment