From d99b1c0a6ae97e3d7612948908b1e24026e20d51 Mon Sep 17 00:00:00 2001 From: Maria Lainez <98marialainez@gmail.com> Date: Mon, 18 Sep 2023 10:04:21 +0200 Subject: [PATCH] place interleaved and muons files in a subdirector --- osa/paths.py | 14 +++++++++----- osa/utils/register.py | 11 ++++++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/osa/paths.py b/osa/paths.py index da9f02b9..62f5ebee 100644 --- a/osa/paths.py +++ b/osa/paths.py @@ -219,7 +219,7 @@ def destination_dir(concept: str, create_dir: bool = True) -> Path: Parameters ---------- concept : str - Expected: MUON, DL1AB, DATACHECK, DL2, PEDESTAL, CALIB, TIMECALIB + Expected: MUON, DL1AB, DATACHECK, INTERLEAVED, DL2, PEDESTAL, CALIB, TIMECALIB create_dir : bool Set it to True (default) if you want to create the directory. Otherwise, it just returns the path @@ -231,11 +231,15 @@ def destination_dir(concept: str, create_dir: bool = True) -> Path: """ nightdir = utils.date_to_dir(options.date) - if concept in {"MUON", "INTERLEAVED"}: - directory = Path(cfg.get(options.tel_id, concept + "_DIR")) / nightdir / options.prod_id - elif concept in {"DL1AB", "DATACHECK"}: + if concept == "MUON": + directory = Path(cfg.get(options.tel_id, "DL1_DIR")) / nightdir / options.prod_id / "muons" + elif concept == "INTERLEAVED": + directory = Path(cfg.get(options.tel_id, "DL1_DIR")) / nightdir / options.prod_id / "interleaved" + elif concept == "DATACHECK": + directory = Path(cfg.get(options.tel_id, "DL1_DIR")) / nightdir / options.prod_id / "datacheck" + elif concept == "DL1AB": directory = ( - Path(cfg.get(options.tel_id, concept + "_DIR")) + Path(cfg.get(options.tel_id, "DL1_DIR")) / nightdir / options.prod_id / options.dl1_prod_id diff --git a/osa/utils/register.py b/osa/utils/register.py index 56a3ab7d..6f59b51a 100644 --- a/osa/utils/register.py +++ b/osa/utils/register.py @@ -98,9 +98,18 @@ def register_run_concept_files(run_string, concept): if concept == "DL2": initial_dir = initial_dir / options.dl2_prod_id - elif concept in ["DL1AB", "DATACHECK"]: + elif concept == "DL1AB": initial_dir = initial_dir / options.dl1_prod_id + elif concept == "DATACHECK": + initial_dir = initial_dir / "datacheck" + + elif concept == "MUON": + initial_dir = initial_dir / "muons" + + elif concept == "INTERLEAVED": + initial_dir = initial_dir / "interleaved" + output_dir = destination_dir(concept, create_dir=False) data_level = cfg.get("PATTERN", f"{concept}TYPE") prefix = cfg.get("PATTERN", f"{concept}PREFIX")