Skip to content

Commit

Permalink
parameter name depends on lstchain version
Browse files Browse the repository at this point in the history
  • Loading branch information
vuillaut committed Oct 16, 2024
1 parent 79488d5 commit afd5c3a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lstmcpipe/scripts/generate_nsb_levels_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import json
import logging
import argparse
from lstchain.io.config import get_mc_config
from pathlib import Path
from packaging import version
from lstchain.io.config import get_mc_config
from lstchain import __version__ as lstchain_version

BASE_LSTCHAIN_MC_CONFIG = get_mc_config()

Expand Down Expand Up @@ -78,7 +80,9 @@ def dump_lstchain_nsb_config(nsb_tuning, outdir="."):
new_config["waveform_nsb_tuning"]["nsb_tuning"] = False
else:
new_config["waveform_nsb_tuning"]["nsb_tuning"] = True
new_config["waveform_nsb_tuning"]["nsb_tuning_rate_GHz"] = nsb_tuning
# The parameter name changed in lstchain v0.10.12 !
parameter_name = "nsb_tuning_rate_GHz" if version.parse(lstchain_version) >= version.parse("0.10.12") else "nsb_tuning_ratio"
new_config["waveform_nsb_tuning"][parameter_name] = nsb_tuning
json_filename = Path(outdir) / lstchain_config_name(nsb_tuning)
with open(json_filename, 'w') as f:
json.dump(new_config, f, indent=4)
Expand Down

0 comments on commit afd5c3a

Please sign in to comment.