diff --git a/lstchain/scripts/lstchain_add_source_dependent_parameters.py b/lstchain/scripts/lstchain_add_source_dependent_parameters.py index 6c1936d658..78be5c6c71 100644 --- a/lstchain/scripts/lstchain_add_source_dependent_parameters.py +++ b/lstchain/scripts/lstchain_add_source_dependent_parameters.py @@ -42,10 +42,10 @@ default=None ) -args = parser.parse_args() - def main(): + args = parser.parse_args() + dl1_filename = os.path.abspath(args.input_file) config = get_standard_config() diff --git a/lstchain/scripts/lstchain_check_dl1.py b/lstchain/scripts/lstchain_check_dl1.py index 63f8bead16..35f1614d8c 100755 --- a/lstchain/scripts/lstchain_check_dl1.py +++ b/lstchain/scripts/lstchain_check_dl1.py @@ -73,11 +73,10 @@ help='Run the script without plotting output' ) -args, unknown = parser.parse_known_args() - def main(): - + args, unknown = parser.parse_known_args() + logging.basicConfig(level=logging.INFO, format='%(message)s') logger = logging.getLogger(__name__) diff --git a/lstchain/scripts/lstchain_dl1_muon_analysis.py b/lstchain/scripts/lstchain_dl1_muon_analysis.py index 793ab3ccc0..af8c83be3b 100644 --- a/lstchain/scripts/lstchain_dl1_muon_analysis.py +++ b/lstchain/scripts/lstchain_dl1_muon_analysis.py @@ -3,8 +3,7 @@ """ Script to perform the analysis of muon events. -- Inputs are a DL1a data file (pixel information is needed) and a -calibration file +- Inputs are a DL1a data file (pixel information is needed) and a calibration file - Output is a table with muon parameters (to be updated to a dataframe!) Usage: @@ -81,11 +80,10 @@ help="Maximum number of processed muon ring candidates", ) -args = parser.parse_args() - def main(): - + args = parser.parse_args() + print("input files: {}".format(args.input_file)) print("calib file: {}".format(args.calib_file)) print("output file: {}".format(args.output_file)) diff --git a/lstchain/scripts/lstchain_mc_r0_to_dl1.py b/lstchain/scripts/lstchain_mc_r0_to_dl1.py index eaedbf4150..dc6aecba70 100644 --- a/lstchain/scripts/lstchain_mc_r0_to_dl1.py +++ b/lstchain/scripts/lstchain_mc_r0_to_dl1.py @@ -43,11 +43,10 @@ default=None ) -args = parser.parse_args() - def main(): - + args = parser.parse_args() + output_dir = args.output_dir.absolute() output_dir.mkdir(exist_ok=True) output_file = output_dir / r0_to_dl1_filename(args.input_file.name) diff --git a/lstchain/scripts/lstchain_mc_r0_to_dl2.py b/lstchain/scripts/lstchain_mc_r0_to_dl2.py index 02482166f0..f814d91eda 100644 --- a/lstchain/scripts/lstchain_mc_r0_to_dl2.py +++ b/lstchain/scripts/lstchain_mc_r0_to_dl2.py @@ -14,10 +14,9 @@ --path-models ./trained_models """ - -from ctapipe.utils import get_dataset_path import argparse import os +from ctapipe.utils import get_dataset_path from distutils.util import strtobool from lstchain.paths import r0_to_dl1_filename from pathlib import Path @@ -53,10 +52,10 @@ default=None ) -args = parser.parse_args() - def main(): + args = parser.parse_args() + outdir = args.outdir.absolute() dl1_file = outdir / r0_to_dl1_filename(args.datafile.name) diff --git a/lstchain/scripts/lstchain_mc_rfperformance.py b/lstchain/scripts/lstchain_mc_rfperformance.py index 6b9c20cafc..49f015185c 100644 --- a/lstchain/scripts/lstchain_mc_rfperformance.py +++ b/lstchain/scripts/lstchain_mc_rfperformance.py @@ -72,10 +72,10 @@ default=None ) -args = parser.parse_args() - def main(): + args = parser.parse_args() + custom_config = {} if args.config_file is not None: try: diff --git a/lstchain/scripts/lstchain_mc_sensitivity.py b/lstchain/scripts/lstchain_mc_sensitivity.py index 8d662e51fc..c5891d6901 100644 --- a/lstchain/scripts/lstchain_mc_sensitivity.py +++ b/lstchain/scripts/lstchain_mc_sensitivity.py @@ -51,10 +51,10 @@ dest = 'output_path', help = 'path where to save plot images') -args = parser.parse_args() - def main(): + args = parser.parse_args() + ntelescopes_gamma = 1 n_bins_energy = 20 # Number of energy bins obstime = 50 * 3600 * u.s diff --git a/lstchain/scripts/lstchain_mc_trainpipe.py b/lstchain/scripts/lstchain_mc_trainpipe.py index 4b70240865..3f592282a4 100644 --- a/lstchain/scripts/lstchain_mc_trainpipe.py +++ b/lstchain/scripts/lstchain_mc_trainpipe.py @@ -50,10 +50,9 @@ default=None ) - -args = parser.parse_args() - def main(): + args = parser.parse_args() + #Train the models config = {} diff --git a/lstchain/scripts/lstchain_merge_muon_files.py b/lstchain/scripts/lstchain_merge_muon_files.py index 0f8a60e445..57d62341c3 100644 --- a/lstchain/scripts/lstchain_merge_muon_files.py +++ b/lstchain/scripts/lstchain_merge_muon_files.py @@ -46,10 +46,9 @@ default='*.fits', ) -args = parser.parse_args() - - def main(): + args = parser.parse_args() + if args.run_number: run = f'Run{args.run_number:05d}' file_list = sorted(filter( diff --git a/lstchain/scripts/lstchain_tune_nsb.py b/lstchain/scripts/lstchain_tune_nsb.py index c03a683ad4..3d7814f7ba 100644 --- a/lstchain/scripts/lstchain_tune_nsb.py +++ b/lstchain/scripts/lstchain_tune_nsb.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + """ Usage: @@ -42,10 +44,9 @@ required=True, ) -args = parser.parse_args() - def main(): + args = parser.parse_args() if not args.config.is_file(): log.error('Config file does not exist or is not a file')