Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace test file #1291

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ __pycache__
*/cython_version.py
htmlcov
.coverage
.coverage.*
coverage.xml
MANIFEST

# Sphinx
Expand Down
3 changes: 1 addition & 2 deletions lstchain/reco/r0_to_dl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,10 @@
-------

"""

# 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')

Check warning on line 335 in lstchain/reco/r0_to_dl1.py

View check run for this annotation

Codecov / codecov/patch

lstchain/reco/r0_to_dl1.py#L335

Added line #L335 was not covered by tests

if output_filename is None:
try:
Expand Down
4 changes: 2 additions & 2 deletions lstchain/scripts/lstchain_mc_r0_to_dl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lstchain/scripts/lstchain_mc_r0_to_dl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
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')

Check warning on line 68 in lstchain/scripts/lstchain_mc_r0_to_dl2.py

View check run for this annotation

Codecov / codecov/patch

lstchain/scripts/lstchain_mc_r0_to_dl2.py#L68

Added line #L68 was not covered by tests

output_dir = args.output_dir.absolute()
dl1_file = output_dir / r0_to_dl1_filename(args.datafile.name)
Expand Down
7 changes: 7 additions & 0 deletions lstchain/scripts/tests/test_lstchain_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(tmp_path):
"""Run R0 to DL1 script for the default MC file without specifying an input file."""
output_file = tmp_path / "dl1_gamma_lstprod2.h5"
run_program("lstchain_mc_r0_to_dl1", "-o", tmp_path)
assert output_file.is_file()


def test_lstchain_mc_r0_to_dl1(simulated_dl1_file):
assert simulated_dl1_file.is_file()

Expand Down
2 changes: 1 addition & 1 deletion notebooks/disp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/example_container.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions notebooks/lstchain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/mc_energy_distr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/step_by_step_dl0_to_dl1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
]
},
Expand Down