-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add try except to catch det_match failures #1077
Conversation
Need to incorporate updates to file cleanup in the demod mapmaking functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this update and the associated testing. Added a couple inline comments but also approved.
policy_dir_init = os.path.dirname(configs_init['archive']['policy']['filename']) + '/temp/' | ||
policy_dir_proc = os.path.dirname(configs_proc['archive']['policy']['filename']) + '/temp_proc/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use os.path.join()
instead of + str
if os.path.exists(policy_dir_init): | ||
found = False | ||
for f in os.listdir(policy_dir_init): | ||
if obs_id in f: | ||
found = True | ||
break | ||
|
||
if found: | ||
error = pp_util.save_group_and_cleanup(obs_id, configs_init, context_init, | ||
subdir='temp', remove=overwrite) | ||
if error is not None: | ||
f = open(errlog, 'a') | ||
f.write(f'\n{time.time()}, cleanup error\n{error[0]}\n{error[2]}\n') | ||
f.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this whole block be a single function that takes in policy_dir
, obs_id
, config
, context
, subdir
, remove
, and errlog
so we can just call that line twice here (and in other places where its needed i.e. preprocess_tod, demod mapmaker)
obs_id = obs['obs_id'] | ||
pp_util.save_group_and_cleanup(obs_id, configs, context, | ||
subdir='temp', remove=overwrite) | ||
policy_dir = os.path.dirname(configs['archive']['policy']['filename']) + '/temp/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
join
Adds some error checking around
preprocess_utils.get_groups
to catch failures related to getting det info.