Skip to content

Commit

Permalink
header: store multiple ToO files in different keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
araichoor committed Nov 1, 2022
1 parent a393145 commit 11b8453
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bin/fba_launch
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,13 @@ def main():
# AR 20210902: setting mjd_min = mjd_max = mjd_now
# AR so that we select: (d["MJD_BEGIN"] < mjd_now) & (d["MJD_END"] > mjd_now)
if "too" in steps:
toofns = mydirs["too"]
for key in sorted(list(mydirs.keys())):
if (key[:3] == "too") & (key != "too"):
toofns += "," + mydirs[key]
expected_files["too"] = create_too(
mytmpouts["tiles"],
mydirs["too"],
toofns,
mjd_now,
mjd_now,
args.survey,
Expand Down
15 changes: 14 additions & 1 deletion py/fiberassign/fba_launch_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ def get_desitarget_paths(
20220318 : add custom_too_file optional argument
20220421 : add too_tile optional argument
20221004 : add custom_too_development optional argument
20221031 : if multiple files provided in custom_too_file, then several keys: too, too2, too3, etc
"""
# AR expected survey, program?
exp_surveys = ["sv1", "sv2", "sv3", "main"]
Expand Down Expand Up @@ -982,12 +983,22 @@ def get_desitarget_paths(
mydirs["scndmtl"] = scndmtl
# AR custom ToO file?
if custom_too_file is not None:
mydirs["too"] = custom_too_file
log.warning(
"{:.1f}s\t{}\tusing custom ToO file {} -> this is for tertiary program or development only!".format(
time() - start, step, custom_too_file,
)
)
for i, fn in enumerate(custom_too_file.split(",")):
if i == 0:
key = "too"
else:
key = "too{}".format(i + 1)
mydirs[key] = fn
log.info(
"{:.1f}s\t{}\tdirectory for {}: {}".format(
time() - start, step, key, fn,
)
)
# AR check custom ToO file(s) exist + are in $DESI_SURVEYOPS, if not custom_too_development
if custom_too_development:
log.info("{:.1f}s\t{}\tcustom_too_development=True, no check that custom_too_file(s) are in $DESI_SURVEYOPS".format(
Expand Down Expand Up @@ -1614,6 +1625,7 @@ def create_too(
# AR purposefully keep all the operations per file
# AR (instead of stacking first), to have the detailed log messages
# AR for each file
print("toofns = {}".format(toofns))
for toofn in toofns.split(","):

log.info(
Expand Down Expand Up @@ -2077,6 +2089,7 @@ def update_fiberassign_header(
20210917 : keywords scnd2, scnd3, etc could be automatically added (see get_desitarget_paths())
20211119 : added lookup_sky_source keyword
20211227 : use newly defined args.goaltype (instead of args.program previously)
20221031 : keywords too2, too3, etc could be automatically added (see get_desitarget_paths())
"""
# AR sanity check on faflavor
if faflavor != "{}{}".format(hdr_survey, hdr_faprgrm):
Expand Down

0 comments on commit 11b8453

Please sign in to comment.