From 716613af2774a14de7a6f13d18503b9974ac4878 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Tue, 17 Sep 2024 15:09:03 +0200 Subject: [PATCH 1/5] Replace gamma_test_large.simtel.gz with gamma_lstprod2.simtel.gz --- lstchain/reco/r0_to_dl1.py | 3 +-- lstchain/scripts/lstchain_mc_r0_to_dl1.py | 4 ++-- lstchain/scripts/lstchain_mc_r0_to_dl2.py | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lstchain/reco/r0_to_dl1.py b/lstchain/reco/r0_to_dl1.py index 41314154a..a1c6f5684 100644 --- a/lstchain/reco/r0_to_dl1.py +++ b/lstchain/reco/r0_to_dl1.py @@ -329,11 +329,10 @@ def r0_to_dl1( ------- """ - # using None as default and using `get_dataset_path` only inside the function # prevents downloading at import time. if input_filename is None: - get_dataset_path('gamma_test_large.simtel.gz') + get_dataset_path('gamma_lstprod2.simtel.gz') if output_filename is None: try: diff --git a/lstchain/scripts/lstchain_mc_r0_to_dl1.py b/lstchain/scripts/lstchain_mc_r0_to_dl1.py index fdceab176..7d8304e96 100644 --- a/lstchain/scripts/lstchain_mc_r0_to_dl1.py +++ b/lstchain/scripts/lstchain_mc_r0_to_dl1.py @@ -52,10 +52,10 @@ def main(): args = parser.parse_args() # using a default of None and only using get_dataset_path here - # prevents downloading gamma_test_large when an input file is actually given + # prevents downloading when an input file is actually given # or just --help is called. if args.input_file is None: - args.input_file = get_dataset_path('gamma_test_large.simtel.gz') + args.input_file = get_dataset_path('gamma_lstprod2.simtel.gz') output_dir = args.output_dir.absolute() output_dir.mkdir(exist_ok=True, parents=True) diff --git a/lstchain/scripts/lstchain_mc_r0_to_dl2.py b/lstchain/scripts/lstchain_mc_r0_to_dl2.py index 2d350efbe..40f720017 100644 --- a/lstchain/scripts/lstchain_mc_r0_to_dl2.py +++ b/lstchain/scripts/lstchain_mc_r0_to_dl2.py @@ -62,10 +62,10 @@ def main(): args = parser.parse_args() # using a default of None and only using get_dataset_path here - # prevents downloading gamma_test_large when an input file is actually given + # prevents downloading when an input file is actually given # or just --help is called. if args.datafile is None: - args.datafile = get_dataset_path('gamma_test_large.simtel.gz') + args.datafile = get_dataset_path('gamma_lstprod2.simtel.gz') output_dir = args.output_dir.absolute() dl1_file = output_dir / r0_to_dl1_filename(args.datafile.name) From 310da26de070ab61f5f05ac135c7694002ff9c7f Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Tue, 17 Sep 2024 15:20:37 +0200 Subject: [PATCH 2/5] Replace path in notebooks --- notebooks/disp.ipynb | 2 +- notebooks/example_container.ipynb | 2 +- notebooks/lstchain.ipynb | 7 ++++--- notebooks/mc_energy_distr.ipynb | 2 +- notebooks/step_by_step_dl0_to_dl1.ipynb | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/notebooks/disp.ipynb b/notebooks/disp.ipynb index 50192abbd..14680dbba 100644 --- a/notebooks/disp.ipynb +++ b/notebooks/disp.ipynb @@ -69,7 +69,7 @@ }, "outputs": [], "source": [ - "infile = get_dataset_path(\"gamma_test_large.simtel.gz\")\n", + "infile = get_dataset_path(\"gamma_lstprod2.simtel.gz\")\n", "\n", "allowed_tels = {1} # select LST1 only\n", "max_events = (\n", diff --git a/notebooks/example_container.ipynb b/notebooks/example_container.ipynb index bcf069ddd..aed4a356a 100644 --- a/notebooks/example_container.ipynb +++ b/notebooks/example_container.ipynb @@ -47,7 +47,7 @@ }, "outputs": [], "source": [ - "infile = get_dataset_path(\"gamma_test_large.simtel.gz\")\n", + "infile = get_dataset_path(\"gamma_lstprod2.simtel.gz\")\n", "\n", "dl1_parameters_filename = \"dl1.h5\"\n", "\n", diff --git a/notebooks/lstchain.ipynb b/notebooks/lstchain.ipynb index 84698cd9b..31f9b0935 100644 --- a/notebooks/lstchain.ipynb +++ b/notebooks/lstchain.ipynb @@ -79,10 +79,11 @@ }, "outputs": [], "source": [ - "#datafile = get_dataset_path('gamma_test_large.simtel.gz')\n", + "# test data file from the ctapipe data server\n", + "datafile = get_dataset_path('gamma_lstprod2.simtel.gz')\n", "\n", - "# Local files can be also imported.\n", - "datafile = \"/fefs/aswg/data/mc/DL0/20190415/gamma/south_pointing/gamma_20deg_180deg_run9___cta-prod3-demo-2147m-LaPalma-baseline-mono_off0.4.simtel.gz\"" + "# Local files can be also be used:\n", + "# datafile = \"/fefs/aswg/data/mc/DL0/20190415/gamma/south_pointing/gamma_20deg_180deg_run9___cta-prod3-demo-2147m-LaPalma-baseline-mono_off0.4.simtel.gz\"" ] }, { diff --git a/notebooks/mc_energy_distr.ipynb b/notebooks/mc_energy_distr.ipynb index c819b2bc2..c05c380cd 100644 --- a/notebooks/mc_energy_distr.ipynb +++ b/notebooks/mc_energy_distr.ipynb @@ -27,7 +27,7 @@ "metadata": {}, "outputs": [], "source": [ - "simtel_file = get_dataset_path('gamma_test_large.simtel.gz')" + "simtel_file = get_dataset_path('gamma_lstprod2.simtel.gz')" ] }, { diff --git a/notebooks/step_by_step_dl0_to_dl1.ipynb b/notebooks/step_by_step_dl0_to_dl1.ipynb index d6a7511fc..60fdbc768 100644 --- a/notebooks/step_by_step_dl0_to_dl1.ipynb +++ b/notebooks/step_by_step_dl0_to_dl1.ipynb @@ -82,7 +82,7 @@ "metadata": {}, "outputs": [], "source": [ - "#input_filename=get_dataset_path('gamma_test_large.simtel.gz')\n", + "#input_filename=get_dataset_path('gamma_prod2.simtel.gz')\n", "input_filename=\"/home/queenmab/DATA/LST1/Gamma/gamma_20deg_0deg_run8___cta-prod3-lapalma-2147m-LaPalma-FlashCam.simtel.gz\"" ] }, From fde71f7234738e8a54ae3d0bf76afc5e530b445c Mon Sep 17 00:00:00 2001 From: Daniel Morcuende Date: Mon, 11 Nov 2024 19:16:42 +0100 Subject: [PATCH 3/5] add test for running r0 to dl1 mc without input file --- lstchain/scripts/tests/test_lstchain_scripts.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lstchain/scripts/tests/test_lstchain_scripts.py b/lstchain/scripts/tests/test_lstchain_scripts.py index 0311225fc..28ce12cd8 100644 --- a/lstchain/scripts/tests/test_lstchain_scripts.py +++ b/lstchain/scripts/tests/test_lstchain_scripts.py @@ -90,6 +90,13 @@ def merged_simulated_dl1_file(simulated_dl1_file, temp_dir_simulated_files): return merged_dl1_file +def test_lstchain_mc_r0_to_dl1_default_mc_file(temp_dir_simulated_files): + """Run R0 to DL1 script for the default MC file without specifying an input file.""" + output_file = temp_dir_simulated_files / "dl1_gamma_lstprod2.h5" + run_program("lstchain_mc_r0_to_dl1", "-o", temp_dir_simulated_files) + assert output_file.is_file() + + def test_lstchain_mc_r0_to_dl1(simulated_dl1_file): assert simulated_dl1_file.is_file() From 5fe7225a7b666221b36efcb689c7f94b03ce57d9 Mon Sep 17 00:00:00 2001 From: Daniel Morcuende Date: Tue, 12 Nov 2024 18:59:29 +0100 Subject: [PATCH 4/5] create output of r0 to dl1 with default mc in different output dir --- lstchain/scripts/tests/test_lstchain_scripts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lstchain/scripts/tests/test_lstchain_scripts.py b/lstchain/scripts/tests/test_lstchain_scripts.py index 28ce12cd8..52b7a570b 100644 --- a/lstchain/scripts/tests/test_lstchain_scripts.py +++ b/lstchain/scripts/tests/test_lstchain_scripts.py @@ -90,10 +90,10 @@ def merged_simulated_dl1_file(simulated_dl1_file, temp_dir_simulated_files): return merged_dl1_file -def test_lstchain_mc_r0_to_dl1_default_mc_file(temp_dir_simulated_files): +def test_lstchain_mc_r0_to_dl1_default_mc_file(tmp_path): """Run R0 to DL1 script for the default MC file without specifying an input file.""" - output_file = temp_dir_simulated_files / "dl1_gamma_lstprod2.h5" - run_program("lstchain_mc_r0_to_dl1", "-o", temp_dir_simulated_files) + output_file = tmp_path / "dl1_gamma_lstprod2.h5" + run_program("lstchain_mc_r0_to_dl1", "-o", tmp_path) assert output_file.is_file() From c02584918ab26385f5a588e7852c47c65ed99eea Mon Sep 17 00:00:00 2001 From: Daniel Morcuende Date: Tue, 12 Nov 2024 19:00:36 +0100 Subject: [PATCH 5/5] ignore all test coverage products --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a0084a7c9..b16653461 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ __pycache__ */cython_version.py htmlcov .coverage +.coverage.* +coverage.xml MANIFEST # Sphinx