diff --git a/ctapipe/conftest.py b/ctapipe/conftest.py index 3c22f5b9f65..7bf662d368b 100644 --- a/ctapipe/conftest.py +++ b/ctapipe/conftest.py @@ -324,30 +324,6 @@ def dl1_file(dl1_tmp_path, prod5_gamma_simtel_path): return output -@pytest.fixture(scope="session") -def dl1_camera_frame_file(dl1_tmp_path, prod5_gamma_simtel_path): - """ - DL1 file containing both images and parameters from a gamma simulation set. - """ - from ctapipe.tools.process import ProcessorTool - - output = dl1_tmp_path / "gamma_camera_frame.dl1.h5" - - # prevent running process multiple times in case of parallel tests - with FileLock(output.with_suffix(output.suffix + ".lock")): - if output.is_file(): - return output - - argv = [ - f"--input={prod5_gamma_simtel_path}", - f"--output={output}", - "--camera-frame", - "--write-images", - ] - assert run_tool(ProcessorTool(), argv=argv, cwd=dl1_tmp_path) == 0 - return output - - @pytest.fixture(scope="session") def dl2_only_file(dl2_tmp_path, prod5_gamma_simtel_path): """ diff --git a/ctapipe/io/tests/test_hdf5eventsource.py b/ctapipe/io/tests/test_hdf5eventsource.py index bae1eb1359b..81488391590 100644 --- a/ctapipe/io/tests/test_hdf5eventsource.py +++ b/ctapipe/io/tests/test_hdf5eventsource.py @@ -2,10 +2,6 @@ import numpy as np import pytest -from ctapipe.containers import ( - CameraHillasParametersContainer, - CameraTimingParametersContainer, -) from ctapipe.io import DataLevel, EventSource, HDF5EventSource @@ -196,25 +192,3 @@ def test_read_dl2(dl2_shower_geometry_file): impact = e.dl2.tel[tel_id].impact[algorithm] assert impact.prefix == algorithm + "_tel_impact" assert impact.distance is not None - - -def test_dl1_camera_frame(dl1_camera_frame_file): - with HDF5EventSource(dl1_camera_frame_file) as s: - tel_id = None - for e in s: - for tel_id, dl1 in e.dl1.tel.items(): - assert isinstance( - dl1.parameters.hillas, CameraHillasParametersContainer - ) - assert isinstance( - dl1.parameters.timing, CameraTimingParametersContainer - ) - assert dl1.parameters.hillas.intensity is not None - - for tel_id, sim in e.simulation.tel.items(): - assert isinstance( - sim.true_parameters.hillas, CameraHillasParametersContainer - ) - assert sim.true_parameters.hillas.intensity is not None - - assert tel_id is not None, "did not test any events" diff --git a/ctapipe/reco/tests/test_ImPACT.py b/ctapipe/reco/tests/test_ImPACT.py index eaf0e9766da..be03f45402b 100644 --- a/ctapipe/reco/tests/test_ImPACT.py +++ b/ctapipe/reco/tests/test_ImPACT.py @@ -5,7 +5,7 @@ from numpy.testing import assert_allclose from ctapipe.containers import ( - CameraHillasParametersContainer, + HillasParametersContainer, ReconstructedEnergyContainer, ReconstructedGeometryContainer, ) @@ -25,9 +25,9 @@ def setup_class(self): self.impact_reco = ImPACTReconstructor(root_dir=".") self.horizon_frame = AltAz() - self.h1 = CameraHillasParametersContainer( - x=1 * u.deg, - y=1 * u.deg, + self.h1 = HillasParametersContainer( + fov_lon=1 * u.deg, + fov_lat=1 * u.deg, r=1 * u.deg, phi=Angle(0 * u.rad), intensity=100, diff --git a/ctapipe/tools/process.py b/ctapipe/tools/process.py index 32848532623..0f2fefddc81 100644 --- a/ctapipe/tools/process.py +++ b/ctapipe/tools/process.py @@ -137,10 +137,6 @@ class ProcessorTool(Tool): "store DL1/Event/Telescope muon parameters in output", "don't store DL1/Event/Telescope muon parameters in output", ), - "camera-frame": ( - {"ImageProcessor": {"use_telescope_frame": False}}, - "Use camera frame for image parameters instead of telescope frame", - ), } classes = ( diff --git a/ctapipe/tools/tests/test_process.py b/ctapipe/tools/tests/test_process.py index 01039649265..92c718ac261 100644 --- a/ctapipe/tools/tests/test_process.py +++ b/ctapipe/tools/tests/test_process.py @@ -80,7 +80,6 @@ def test_stage_1_dl1(tmp_path, dl1_image_file, dl1_parameters_file): f"--config={config}", f"--input={dl1_image_file}", f"--output={dl1b_from_dl1a_file}", - "--camera-frame", "--write-parameters", "--overwrite", ], @@ -114,8 +113,8 @@ def test_stage_1_dl1(tmp_path, dl1_image_file, dl1_parameters_file): "obs_id", "event_id", "tel_id", - "camera_frame_hillas_intensity", - "camera_frame_hillas_x", + "hillas_intensity", + "hillas_fov_lon", "concentration_cog", "leakage_pixels_width_1", ) diff --git a/ctapipe/visualization/tests/test_mpl.py b/ctapipe/visualization/tests/test_mpl.py index 31867d5d158..130c4e883b8 100644 --- a/ctapipe/visualization/tests/test_mpl.py +++ b/ctapipe/visualization/tests/test_mpl.py @@ -11,10 +11,7 @@ from matplotlib import __version__ as mpl_version from ctapipe.calib.camera.calibrator import CameraCalibrator -from ctapipe.containers import ( - CameraHillasParametersContainer, - HillasParametersContainer, -) +from ctapipe.containers import HillasParametersContainer from ctapipe.coordinates.telescope_frame import TelescopeFrame from ctapipe.instrument import PixelShape, SubarrayDescription @@ -90,19 +87,6 @@ def test_camera_display_single(prod5_lst_cam, tmp_path): fig.savefig(tmp_path / "result.png") -def test_hillas_overlay_camera_frame(prod5_lst_cam, tmp_path): - from ctapipe.visualization import CameraDisplay - - fig, ax = plt.subplots() - disp = CameraDisplay(prod5_lst_cam, ax=ax) - hillas = CameraHillasParametersContainer( - x=0.1 * u.m, y=-0.1 * u.m, length=0.5 * u.m, width=0.2 * u.m, psi=90 * u.deg - ) - - disp.overlay_moments(hillas, color="w") - fig.savefig(tmp_path / "result.png") - - def test_hillas_overlay(prod5_lst_cam, tmp_path): from ctapipe.visualization import CameraDisplay @@ -205,16 +189,13 @@ def test_array_display(prod5_mst_nectarcam): # ...with scalar color ad.set_vector_uv(np.array([1, 2, 3]) * u.m, np.array([1, 2, 3]) * u.m, c=3) - geom = prod5_mst_nectarcam.camera.geometry + geom = prod5_mst_nectarcam.camera.geometry.transform_to(TelescopeFrame()) rot_angle = 20 * u.deg - hillas = CameraHillasParametersContainer(x=0 * u.m, y=0 * u.m, psi=rot_angle) - - # test using hillas params CameraFrame: - hillas_dict = { - 1: CameraHillasParametersContainer(length=100.0 * u.m, psi=90 * u.deg), - 2: CameraHillasParametersContainer(length=20000 * u.cm, psi="95deg"), - } + hillas = HillasParametersContainer( + fov_lon=0 * u.deg, fov_lat=0 * u.deg, psi=rot_angle + ) + # test using hillas params for divergent pointing in telescopeframe: grad = 2 intercept = 1 @@ -226,19 +207,11 @@ def test_array_display(prod5_mst_nectarcam): cleaning_mask=np.ones(geom.n_pixels, dtype=bool), ) gradient_dict = {1: timing_rot20.slope.value, 2: timing_rot20.slope.value} + core_dict = { tel_id: dl1.parameters.core.psi for tel_id, dl1 in event.dl1.tel.items() } - ad.set_vector_hillas( - hillas_dict=hillas_dict, - core_dict=core_dict, - length=500, - time_gradient=gradient_dict, - angle_offset=0 * u.deg, - ) - ad.set_line_hillas(hillas_dict=hillas_dict, core_dict=core_dict, range=300) - # test using hillas params for divergent pointing in telescopeframe: hillas_dict = { 1: HillasParametersContainer( fov_lon=1.0 * u.deg, fov_lat=1.0 * u.deg, length=1.0 * u.deg, psi=90 * u.deg diff --git a/ctapipe/visualization/utils.py b/ctapipe/visualization/utils.py index 94988439f64..6cb28550d24 100644 --- a/ctapipe/visualization/utils.py +++ b/ctapipe/visualization/utils.py @@ -2,7 +2,7 @@ import numpy as np from astropy.coordinates import Angle -from ..containers import CameraHillasParametersContainer, HillasParametersContainer +from ..containers import HillasParametersContainer def build_hillas_overlay(hillas, unit, with_label=True, n_sigma=1): @@ -15,16 +15,12 @@ def build_hillas_overlay(hillas, unit, with_label=True, n_sigma=1): except u.UnitsError: raise ValueError("hillas must be in same frame as geometry") - # strip off any units if isinstance(hillas, HillasParametersContainer): cog_x = hillas.fov_lon.to_value(unit) cog_y = hillas.fov_lat.to_value(unit) - elif isinstance(hillas, CameraHillasParametersContainer): - cog_x = hillas.x.to_value(unit) - cog_y = hillas.y.to_value(unit) else: raise TypeError( - "hillas must be a (Camera)HillasParametersContainer" f", got: {hillas} " + "hillas must be a HillasParametersContainer" f", got: {hillas} " ) psi_rad = hillas.psi.to_value(u.rad)