Skip to content

Commit

Permalink
Merge pull request #210 from TheSkyentist/seg-im
Browse files Browse the repository at this point in the history
Added comments on failure
  • Loading branch information
gbrammer committed Mar 7, 2024
2 parents 32975ea + ec435d1 commit 1f3347f
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions grizli/pipeline/auto_script.py
Expand Up @@ -3223,16 +3223,23 @@ def load_GroupFLT(field_root='j142724+334246', PREP_PATH='../Prep', force_ref=No

# Segmentation image
if force_seg is None:
if force_seg is None:
if galfit == 'clean':
_fstr = '{0}-{1}_galfit_orig_seg.fits'
seg_file = _fstr.format(field_root,ref.lower())
elif galfit == 'model':
_fstr = '{0}-{1}_galfit_seg.fits'
seg_file = _fstr.format(field_root, ref.lower())
else:
_fstr = '{0}-*_seg.fits'
seg_file = glob.glob(_fstr.format(field_root))[0]
if galfit == 'clean':
_fstr = '{0}-{1}_galfit_orig_seg.fits'
seg_file = _fstr.format(field_root,ref.lower())
elif galfit == 'model':
_fstr = '{0}-{1}_galfit_seg.fits'
seg_file = _fstr.format(field_root, ref.lower())
else:
_fstr = '{0}-*_seg.fits'
seg_files = glob.glob(_fstr.format(field_root))

# Log that no file is found
if len(seg_files) == 0:
msg = f"auto_script.grism_prep: no segmentation image found for {key}"
msg += "\nThis can be set manually with `force_seg`"
utils.log_comment(utils.LOGFILE, msg, verbose=True)

seg_file = seg_files[0]
else:
seg_file = force_seg

Expand All @@ -3246,8 +3253,15 @@ def load_GroupFLT(field_root='j142724+334246', PREP_PATH='../Prep', force_ref=No
ref_file = _fstr.format(field_root, ref.lower())
else:
_fstr = '{0}-{1}_dr*_sci.fits*'
ref_file = _fstr.format(field_root, ref.lower())
ref_file = glob.glob(ref_file)[0]
ref_files = glob.glob(_fstr.format(field_root, ref.lower()))

# Log that no file is found
if len(ref_files) == 0:
msg = f"auto_script.grism_prep: no reference image found for {key}"
msg += "\nThis can be set manually with `force_ref`"
utils.log_comment(utils.LOGFILE, msg, verbose=True)

ref_file = ref_files[0]
else:
ref_file = force_ref

Expand Down

0 comments on commit 1f3347f

Please sign in to comment.