From 15dc4e518d1ee6f24620f2d798483809b2499d05 Mon Sep 17 00:00:00 2001 From: imedan Date: Wed, 23 Oct 2024 14:09:27 -0500 Subject: [PATCH] add version to rest of files --- bin/replace_RS_designs.py | 9 +++++++-- bin/validate_designs_batches.py | 14 ++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/bin/replace_RS_designs.py b/bin/replace_RS_designs.py index 61833c5..dd2a3ff 100644 --- a/bin/replace_RS_designs.py +++ b/bin/replace_RS_designs.py @@ -31,11 +31,15 @@ parser.add_argument('-f', '--fieldids', dest='fieldids', nargs='+', help='field_ids to replace)', type=int, required=True) + parser.add_argument('-v', '--ver_des', dest='ver_des', + type=str, help='Version of the designs', + required=False, default='') args = parser.parse_args() loc = args.loc plan = args.plan fieldids = args.fieldids + ver_des = args.ver_des if loc == 'local': targetdb.database.connect_from_parameters(user='sdss', @@ -53,9 +57,10 @@ files = [] for fid in fieldids: files += [file for file in glob.glob(replace_path + - '{plan}_{fid}*.fits'.format( + '{plan}_{fid}*{ver_des}.fits'.format( plan=plan, - fid=fid))] + fid=fid, + ver_des=ver_des))] for f in files: if 'validation' in f or 'status' in f: files.remove(f) diff --git a/bin/validate_designs_batches.py b/bin/validate_designs_batches.py index 7545f5a..555f669 100644 --- a/bin/validate_designs_batches.py +++ b/bin/validate_designs_batches.py @@ -446,6 +446,9 @@ def valid_design_func(file, exp, obsTime, field_desmodes, parser.add_argument('-k', '--skip_rm', dest='skip_rm', type=bool, help='whether to skip dark_rm during validation', required=False, default=False) + parser.add_argument('-x', '--ver_des', dest='ver_des', + type=str, help='Version of the designs', + required=False, default='') args = parser.parse_args() vtype = args.type @@ -458,6 +461,7 @@ def valid_design_func(file, exp, obsTime, field_desmodes, cache_bs = args.cache_bs ver_catch = args.ver_catch skip_rm = args.skip_rm + ver_des = args.ver_des if type(skip_rm) is str: if skip_rm == 'True': skip_rm = True @@ -558,14 +562,16 @@ def valid_design_func(file, exp, obsTime, field_desmodes, for fid in fieldids: # try to grab to version with designid_status first files_field = [file for file in glob.glob(replace_path + - '{plan}_{fid}*_designid_status.fits'.format( + '{plan}_{fid}*{ver_des}_designid_status.fits'.format( plan=plan, - fid=fid))] + fid=fid, + ver_des=ver_des))] if len(files_field) == 0: files_field = [file for file in glob.glob(replace_path + - '{plan}_{fid}*.fits'.format( + '{plan}_{fid}*{ver_des}.fits'.format( plan=plan, - fid=fid))] + fid=fid, + ver_des=ver_des))] files += files_field for f in files: if 'validation' in f: