From 39f06923750d55c6f5b5450bde1bc8295c4c114c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Wed, 19 Dec 2018 17:17:10 +0100 Subject: [PATCH 1/2] Add script to export FACT camera geometry for ctapipe --- examples/export_ctapipe_camera_geometry.py | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/export_ctapipe_camera_geometry.py diff --git a/examples/export_ctapipe_camera_geometry.py b/examples/export_ctapipe_camera_geometry.py new file mode 100644 index 0000000..0a8c872 --- /dev/null +++ b/examples/export_ctapipe_camera_geometry.py @@ -0,0 +1,30 @@ +from astropy.table import Table +from fact.instrument import get_pixel_coords +import astropy.units as u +import numpy as np + +x, y = get_pixel_coords() +x = (x * u.mm).to(u.m) +y = (y * u.mm).to(u.m) +pix_id = np.arange(1440) + +radius = np.sqrt(np.diff(x)**2 + np.diff(y)**2).min() / 2 +pix_area = 1.5 * np.sqrt(3) * radius**2 + + +t = Table() + +t['pix_id'] = pix_id +t['pix_x'] = -y +t['pix_y'] = -x +t['pix_area'] = pix_area +t.meta['TAB_TYPE'] = 'ctapipe.instrument.CameraGeometry' +t.meta['PIX_TYPE'] = 'hexagonal' +t.meta['CAM_ID'] = 'FACT' +t.meta['PIX_ROT'] = 0.0 +t.meta['CAM_ROT'] = 0.0 +t.meta['SOURCE'] = 'pyfact' +t.meta['TAB_VER'] = '1' + + +t.write('FACT.camgeom.fits.gz', overwrite=True) From 62e481633a8e20e46b23a3f1c07007760f92f399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Tue, 12 Feb 2019 13:31:56 +0100 Subject: [PATCH 2/2] Add comment about coord systems --- examples/export_ctapipe_camera_geometry.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/export_ctapipe_camera_geometry.py b/examples/export_ctapipe_camera_geometry.py index 0a8c872..3450a11 100644 --- a/examples/export_ctapipe_camera_geometry.py +++ b/examples/export_ctapipe_camera_geometry.py @@ -15,8 +15,11 @@ t = Table() t['pix_id'] = pix_id + +# convert from fact coords into hess/cta camera coordinate system t['pix_x'] = -y t['pix_y'] = -x + t['pix_area'] = pix_area t.meta['TAB_TYPE'] = 'ctapipe.instrument.CameraGeometry' t.meta['PIX_TYPE'] = 'hexagonal'