Skip to content

Commit

Permalink
catch if no science files found in read_sgd_files()
Browse files Browse the repository at this point in the history
  • Loading branch information
JarronL committed Sep 11, 2024
1 parent 719180b commit e891f13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion webbpsf_ext/imreg_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def read_sgd_files(indir, pid, obsid, filter, sca, bpfix=False,
files = get_files(indir, pid, obsid=obsid, sca=sca, filt=filter,
file_type=file_type, exp_type=exp_type, vst_grp_act=vst_grp_act,
apername=apername, apername_pps=apername_pps)

if len(files)==0:
_log.warning(f'No files found for PID {pid}, Obs {obsid}, {sca} with filter {filter}')
_log.warning(f'file_type={file_type}, exp_type={exp_type}, vst_grp_act={vst_grp_act}, apername={apername}, apername_pps={apername_pps}')
Expand All @@ -767,6 +767,12 @@ def read_sgd_files(indir, pid, obsid, filter, sca, bpfix=False,

files = files[ikeep]

if len(files)==0:
_log.warning(f'No science files found for PID {pid}, Obs {obsid}, {sca} with filter {filter}')
_log.warning(f'file_type={file_type}, exp_type={exp_type}, vst_grp_act={vst_grp_act}, apername={apername}, apername_pps={apername_pps}')
_log.warning(f'Input directory: {indir}')
return {}

sgd_dict = {}
for i, f in enumerate(files):
fpath = os.path.join(indir, f)
Expand Down

0 comments on commit e891f13

Please sign in to comment.