Skip to content

Commit 53a2a20

Browse files
authored
Merge pull request #340 from cta-observatory/overwrite-tailcuts
Add option to overwrite the tailcuts config file
2 parents a7b06bf + 82486e9 commit 53a2a20

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/osa/scripts/sequencer_catB_tailcuts.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
default=False,
5151
help="Simulate launching of the sequencer_catB_tailcuts script.",
5252
)
53+
parser.add_argument(
54+
"--overwrite-tailcuts",
55+
action="store_true",
56+
default=False,
57+
help="Overwrite the tailcuts config file if it already exists.",
58+
)
5359
parser.add_argument(
5460
"tel_id",
5561
choices=["ST", "LST1", "LST2", "all"],
@@ -210,6 +216,7 @@ def main():
210216
opts = parser.parse_args()
211217
options.tel_id = opts.tel_id
212218
options.simulate = opts.simulate
219+
options.overwrite_tailcuts = opts.overwrite_tailcuts
213220
options.date = opts.date
214221
options.date = set_default_date_if_needed()
215222
options.configfile = opts.config.resolve()
@@ -231,8 +238,13 @@ def main():
231238
# launch catB calibration and tailcut finder in parallel
232239
if cfg.getboolean("lstchain", "apply_catB_calibration") and not catB_closed_file_exists(run_id):
233240
launch_catB_calibration(run_id)
234-
if not cfg.getboolean("lstchain", "apply_standard_dl1b_config") and not tailcuts_config_file_exists(run_id):
235-
launch_tailcuts_finder(run_id)
241+
if not cfg.getboolean("lstchain", "apply_standard_dl1b_config"):
242+
if tailcuts_config_file_exists(run_id) and not options.overwrite_tailcuts:
243+
log.debug(
244+
f"Tailcuts config file already exists for run {run_id:05d}. Use --overwrite-tailcuts to overwrite it."
245+
)
246+
else:
247+
launch_tailcuts_finder(run_id)
236248

237249

238250
if __name__ == "__main__":

0 commit comments

Comments
 (0)