From 381e6ee39d6b9b62beae81f43c26cd20187414b5 Mon Sep 17 00:00:00 2001 From: Karl Kosack Date: Wed, 27 Sep 2023 13:33:39 +0200 Subject: [PATCH] add test to ensure select_subarray() works --- ctapipe/instrument/tests/test_subarray.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ctapipe/instrument/tests/test_subarray.py b/ctapipe/instrument/tests/test_subarray.py index eddca897c86..b93c5cbad5d 100644 --- a/ctapipe/instrument/tests/test_subarray.py +++ b/ctapipe/instrument/tests/test_subarray.py @@ -255,7 +255,6 @@ def test_unknown_telescopes(example_subarray): def test_multiplicity(subarray_prod5_paranal): - subarray = subarray_prod5_paranal.select_subarray([1, 2, 20, 21, 80, 81]) mask = np.array([True, False, True, True, False, False]) @@ -276,3 +275,14 @@ def test_multiplicity(subarray_prod5_paranal): np.testing.assert_equal(subarray.multiplicity(masks, "LST_LST_LSTCam"), [1, 2]) np.testing.assert_equal(subarray.multiplicity(masks, "MST_MST_FlashCam"), [2, 1]) np.testing.assert_equal(subarray.multiplicity(masks, "SST_ASTRI_CHEC"), [0, 1]) + + +def test_subarrays(subarray_prod5_paranal: SubarrayDescription): + """ + Check that constructing a new SubarrayDescription by using + `select_subarray()` works as expected. + """ + subarray = subarray_prod5_paranal.select_subarray([1, 2, 3, 4], name="NewArray") + assert subarray.name == "NewArray" + assert isinstance(subarray.reference_location, EarthLocation) + assert subarray.reference_location == subarray_prod5_paranal.reference_location