Loading observation_sim/mock_objects/Galaxy.py +12 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,18 @@ class Galaxy(MockObject): self.logger.error(e) return 2, None pos_shear = None if not np.isfinite(full) or full <= 0: msg = "obj %s has invalid SED flux in band %s (full=%.6g)" % ( self.id, filt.filter_type, full, ) print(msg) if self.logger: self.logger.error(msg) return 2, pos_shear # # [C6 TEST] # print('hlr_disk = %.4f, hlr_bulge = %.4f'%(self.hlr_disk, self.hlr_bulge)) # tracemalloc.start() Loading observation_sim/mock_objects/MockObject.py +13 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,19 @@ class MockObject(object): if self.logger: self.logger.error(e) return 2, None pos_shear = None if not np.isfinite(full) or full <= 0: msg = "obj %s has invalid SED flux in band %s (full=%.6g)" % ( self.id, filt.filter_type, full, ) print(msg) if self.logger: self.logger.error(msg) return 2, pos_shear # Set Galsim Parameters if self.getMagFilter(filt) <= 15: folding_threshold = 5.0e-8 Loading observation_sim/mock_objects/Stamp.py +13 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,19 @@ class Stamp(MockObject): except Exception as e: print(e) self.logger.error(e) return False return 2, None pos_shear = None if not np.isfinite(full) or full <= 0: msg = "obj %s has invalid SED flux in band %s (full=%.6g)" % ( self.id, filt.filter_type, full, ) print(msg) if self.logger: self.logger.error(msg) return 2, pos_shear # nphotons_sum = 0 # photons_list = [] Loading observation_sim/mock_objects/_util.py +6 −0 Original line number Diff line number Diff line Loading @@ -659,7 +659,13 @@ def getABMAG(interFlux, bandpass): ABMAG_zero = getABMagAverageVal( ABmag=0, norm_thr=throughtput, sWave=sWave, eWave=eWave ) if not np.isfinite(ABMAG_zero) or ABMAG_zero <= 0: return np.nan flux_ave = interFlux / (eWave - sWave) if not np.isfinite(flux_ave): return np.nan if flux_ave <= 0: return np.inf ABMAG_spec = -2.5 * np.log10(flux_ave / ABMAG_zero) return ABMAG_spec Loading observation_sim/sim_steps/add_objects.py +26 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): missed_obj = 0 bright_obj = 0 dim_obj = 0 invalid_obj = 0 draw_error_obj = 0 for j in range(nobj): # # [DEBUG] [TODO] # if j >= 10: Loading Loading @@ -164,6 +166,23 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): # [TODO] Testing # self.chip_output.Log_info("mag_%s = %.3f"%(filt.filter_type.lower(), obj.param["mag_%s"%filt.filter_type.lower()])) mag_keys = [ "mag_%s" % filt.filter_type.lower(), "mag_%s" % cut_filter.filter_type.lower(), ] bad_mags = [ "%s=%s" % (key, obj.param[key]) for key in mag_keys if not np.isfinite(obj.param[key]) ] if bad_mags: self.chip_output.Log_error( "obj %s has invalid magnitude: %s" % (obj.id, ", ".join(bad_mags)) ) invalid_obj += 1 obj.unload_SED() continue # Exclude very bright/dim objects (for now) if cut_filter.is_too_bright( mag=obj.param[ Loading Loading @@ -296,8 +315,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): missed_obj += 1 self.chip_output.Log_error("Object missed-999: %s" % (obj.id)) else: draw_error_obj += 1 self.chip_output.Log_error("Draw error, object omitted: %s" % (obj.id)) continue except Exception as e: traceback.print_exc() self.chip_output.Log_error(e) Loading Loading @@ -367,6 +386,12 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): self.chip_output.Log_info( "# objects that are too dim %d out of %d" % (dim_obj, nobj) ) self.chip_output.Log_info( "# objects with invalid (nan/inf) magnitude %d out of %d" % (invalid_obj, nobj) ) self.chip_output.Log_info( "# objects with drawing errors %d out of %d" % (draw_error_obj, nobj) ) self.chip_output.Log_info( "# objects that are missed %d out of %d" % (missed_obj, nobj) ) Loading Loading
observation_sim/mock_objects/Galaxy.py +12 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,18 @@ class Galaxy(MockObject): self.logger.error(e) return 2, None pos_shear = None if not np.isfinite(full) or full <= 0: msg = "obj %s has invalid SED flux in band %s (full=%.6g)" % ( self.id, filt.filter_type, full, ) print(msg) if self.logger: self.logger.error(msg) return 2, pos_shear # # [C6 TEST] # print('hlr_disk = %.4f, hlr_bulge = %.4f'%(self.hlr_disk, self.hlr_bulge)) # tracemalloc.start() Loading
observation_sim/mock_objects/MockObject.py +13 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,19 @@ class MockObject(object): if self.logger: self.logger.error(e) return 2, None pos_shear = None if not np.isfinite(full) or full <= 0: msg = "obj %s has invalid SED flux in band %s (full=%.6g)" % ( self.id, filt.filter_type, full, ) print(msg) if self.logger: self.logger.error(msg) return 2, pos_shear # Set Galsim Parameters if self.getMagFilter(filt) <= 15: folding_threshold = 5.0e-8 Loading
observation_sim/mock_objects/Stamp.py +13 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,19 @@ class Stamp(MockObject): except Exception as e: print(e) self.logger.error(e) return False return 2, None pos_shear = None if not np.isfinite(full) or full <= 0: msg = "obj %s has invalid SED flux in band %s (full=%.6g)" % ( self.id, filt.filter_type, full, ) print(msg) if self.logger: self.logger.error(msg) return 2, pos_shear # nphotons_sum = 0 # photons_list = [] Loading
observation_sim/mock_objects/_util.py +6 −0 Original line number Diff line number Diff line Loading @@ -659,7 +659,13 @@ def getABMAG(interFlux, bandpass): ABMAG_zero = getABMagAverageVal( ABmag=0, norm_thr=throughtput, sWave=sWave, eWave=eWave ) if not np.isfinite(ABMAG_zero) or ABMAG_zero <= 0: return np.nan flux_ave = interFlux / (eWave - sWave) if not np.isfinite(flux_ave): return np.nan if flux_ave <= 0: return np.inf ABMAG_spec = -2.5 * np.log10(flux_ave / ABMAG_zero) return ABMAG_spec Loading
observation_sim/sim_steps/add_objects.py +26 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): missed_obj = 0 bright_obj = 0 dim_obj = 0 invalid_obj = 0 draw_error_obj = 0 for j in range(nobj): # # [DEBUG] [TODO] # if j >= 10: Loading Loading @@ -164,6 +166,23 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): # [TODO] Testing # self.chip_output.Log_info("mag_%s = %.3f"%(filt.filter_type.lower(), obj.param["mag_%s"%filt.filter_type.lower()])) mag_keys = [ "mag_%s" % filt.filter_type.lower(), "mag_%s" % cut_filter.filter_type.lower(), ] bad_mags = [ "%s=%s" % (key, obj.param[key]) for key in mag_keys if not np.isfinite(obj.param[key]) ] if bad_mags: self.chip_output.Log_error( "obj %s has invalid magnitude: %s" % (obj.id, ", ".join(bad_mags)) ) invalid_obj += 1 obj.unload_SED() continue # Exclude very bright/dim objects (for now) if cut_filter.is_too_bright( mag=obj.param[ Loading Loading @@ -296,8 +315,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): missed_obj += 1 self.chip_output.Log_error("Object missed-999: %s" % (obj.id)) else: draw_error_obj += 1 self.chip_output.Log_error("Draw error, object omitted: %s" % (obj.id)) continue except Exception as e: traceback.print_exc() self.chip_output.Log_error(e) Loading Loading @@ -367,6 +386,12 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): self.chip_output.Log_info( "# objects that are too dim %d out of %d" % (dim_obj, nobj) ) self.chip_output.Log_info( "# objects with invalid (nan/inf) magnitude %d out of %d" % (invalid_obj, nobj) ) self.chip_output.Log_info( "# objects with drawing errors %d out of %d" % (draw_error_obj, nobj) ) self.chip_output.Log_info( "# objects that are missed %d out of %d" % (missed_obj, nobj) ) Loading