Skip to content

Commit

Permalink
write the dl2 files in tailcutXY/nsb_tuning_x.xx directories
Browse files Browse the repository at this point in the history
  • Loading branch information
marialainez committed Feb 11, 2025
1 parent 309968b commit 8b005ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/osa/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
import re
import sys
from datetime import datetime
from pathlib import Path
from typing import List
Expand Down Expand Up @@ -425,4 +426,13 @@ def get_dl1_prod_id(config_filename):
picture_thresh = data["tailcuts_clean_with_pedestal_threshold"]["picture_thresh"]
boundary_thresh = data["tailcuts_clean_with_pedestal_threshold"]["boundary_thresh"]

return f"tailcut{picture_thresh}{boundary_thresh}"
return f"tailcut{picture_thresh}{boundary_thresh}"


def get_dl2_nsb_prod_id(rf_model: Path) -> str:
match = re.search(r'nsb_tuning_\d+\.\d+', str(rf_model))
if not match:
log.warning(f"No 'nsb_tuning_X.XX' pattern found in the path:\n{rf_model}")
sys.exit(1)
else:
return match.group(0)
5 changes: 3 additions & 2 deletions src/osa/scripts/datasequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from osa.utils.cliopts import data_sequence_cli_parsing
from osa.utils.logging import myLogger
from osa.utils.utils import date_to_dir
from osa.paths import catB_closed_file_exists, get_dl1_prod_id
from osa.paths import catB_closed_file_exists, get_dl1_prod_id, get_dl2_nsb_prod_id


__all__ = ["data_sequence", "r0_to_dl1", "dl1_to_dl2", "dl1ab", "dl1_datacheck"]
Expand Down Expand Up @@ -295,8 +295,9 @@ def dl1_to_dl2(run_str: str, rf_model_path: Path) -> int:
-------
rc: int
"""
options.dl2_prod_id = get_dl2_nsb_prod_id(rf_model_path)
dl1ab_subdirectory = Path(options.directory) / options.dl1_prod_id
dl2_subdirectory = Path(options.directory) / options.dl2_prod_id
dl2_subdirectory = Path(options.directory) / options.dl1_prod_id / options.dl2_prod_id
dl2_config = Path(cfg.get("lstchain", "dl2_config"))
dl1_file = dl1ab_subdirectory / f"dl1_LST-1.Run{run_str}.h5"

Expand Down

0 comments on commit 8b005ba

Please sign in to comment.