Skip to content

Commit

Permalink
Merge pull request #1291 from cta-observatory/replace_test_file
Browse files Browse the repository at this point in the history
Replace test file
  • Loading branch information
moralejo authored Nov 21, 2024
2 parents 95f7227 + c025849 commit 8a62ad1
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 13 deletions.
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 @@ 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:
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 @@ 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)
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

0 comments on commit 8a62ad1

Please sign in to comment.