Skip to content

Commit

Permalink
include lstchain version in prod-id for nsb tuned prods
Browse files Browse the repository at this point in the history
  • Loading branch information
vuillaut committed Sep 18, 2024
1 parent e42054e commit 44679c6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lstmcpipe/scripts/generate_nsb_levels_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def build_argparser():
parser.add_argument("--nsb",
nargs="+", type=float, default=0,
help="List of nsb tuning values in p.e. If not provided, no NSB tuning is applied.")
parser.add_argument("--lstchain_version", "-lv",
type=str, default="",
help="The lstchain version. Optional")

parser.add_argument(
"--dec_list",
Expand Down Expand Up @@ -83,17 +86,17 @@ def dump_lstchain_nsb_config(nsb_tuning, outdir="."):
logger.info(f"Dumped lstchain configuration file: {json_filename}")


def prod_id(nsb_tuning):
def prod_id(nsb_tuning, lstchain_version=""):
"""
Generate the prod ID based on the given nsb_tuning_ratio.
Parameters:
nsb_tuning_ratio (float): The nsb tuning ratio.
lstchain_version (str): The lstchain version.
Returns:
str: The product ID.
"""
return f"{date.today()}_allsky_nsb_tuning_{nsb_tuning:.2f}"
return f"{date.today().strftime('%Y%m%d')}_{lstchain_version}_allsky_nsb_tuning_{nsb_tuning:.2f}"


def lstmcpipe_config_filename(nsb_tuning, outdir="."):
Expand All @@ -118,7 +121,7 @@ def main():

nsb_tuning_values = args.nsb
config_class = args.config_class

lstchain_version = args.lstchain_version
for nsb_tuning in nsb_tuning_values:
logger.info(f"Working on NSB {nsb_tuning}")
outdir = Path(f"NSB-{nsb_tuning:.2f}")
Expand All @@ -129,7 +132,7 @@ def main():
"lstmcpipe_generate_config",
config_class,
"--prod_id",
prod_id(nsb_tuning),
prod_id(nsb_tuning, lstchain_version),
"-o",
lstmcpipe_config_filename(nsb_tuning, outdir),
"--lstchain_conf",
Expand Down

0 comments on commit 44679c6

Please sign in to comment.