@@ -143,6 +143,8 @@ def objects(self):
143143 self ._objects = sky_cat .get_objects_by_region (region , obj_type_set = self .obj_types , mjd = self .mjd )
144144 if not self ._objects :
145145 self .logger .warning ("No objects found on image." )
146+ else :
147+ self ._build_dtype_dict ()
146148 return self ._objects
147149
148150 def _build_dtype_dict (self ):
@@ -157,7 +159,7 @@ def _build_dtype_dict(self):
157159 try :
158160 # Some columns cannot be read in snana
159161 np_type = coll .get_native_attribute (col_name ).dtype .type ()
160- except Exception as e :
162+ except ValueError :
161163 self .logger .warning (f"The column { col_name } could not be read from skyCatalog." )
162164 continue
163165 if np_type is None :
@@ -293,8 +295,8 @@ def getValue(self, index, field):
293295 return None
294296 elif field not in skycat_obj .native_columns :
295297 if self ._dtype_dict [field ] is int :
296- # There are no "special value" for integer so we default to
297- # hopefully something completely off
298+ # There are no "special value" for integer so we default to hopefully something completely off
299+ # np.nan is a float and None is a string, so we use -9999 for int
298300 return - 9999
299301 elif self ._dtype_dict [field ] is float :
300302 return np .nan
@@ -497,17 +499,9 @@ def SkyCatValue(config, base, value_type):
497499 params , safe = galsim .config .GetAllParams (config , base , req = req , opt = opt )
498500 field = params ["field" ]
499501 index = params ["index" ]
500- obs_kind = params .get ("obs_kind" , None )
501502
502503 if field == "flux" :
503- if obs_kind is None :
504- val = skycat .getFlux (index )
505- else :
506- pointing = galsim .config .GetInputObj ("obseq_data" , config , base , "OpSeqDataLoader" )
507- filter = pointing .get ("filter" , obs_kind = obs_kind )
508- exptime = pointing .get ("exptime" , obs_kind = obs_kind )
509- mjd = pointing .get ("mjd" , obs_kind = obs_kind )
510- val = skycat .getFlux (index , filter = filter , exptime = exptime , mjd = mjd )
504+ val = skycat .getFlux (index = index )
511505 else :
512506 val = skycat .getValue (index , field )
513507
0 commit comments