Skip to content

Commit 413afaf

Browse files
authored
Merge pull request #115 from fact-project/export_cam_geom
Add script to export FACT camera geometry for ctapipe
2 parents 53f41f8 + 62e4816 commit 413afaf

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from astropy.table import Table
2+
from fact.instrument import get_pixel_coords
3+
import astropy.units as u
4+
import numpy as np
5+
6+
x, y = get_pixel_coords()
7+
x = (x * u.mm).to(u.m)
8+
y = (y * u.mm).to(u.m)
9+
pix_id = np.arange(1440)
10+
11+
radius = np.sqrt(np.diff(x)**2 + np.diff(y)**2).min() / 2
12+
pix_area = 1.5 * np.sqrt(3) * radius**2
13+
14+
15+
t = Table()
16+
17+
t['pix_id'] = pix_id
18+
19+
# convert from fact coords into hess/cta camera coordinate system
20+
t['pix_x'] = -y
21+
t['pix_y'] = -x
22+
23+
t['pix_area'] = pix_area
24+
t.meta['TAB_TYPE'] = 'ctapipe.instrument.CameraGeometry'
25+
t.meta['PIX_TYPE'] = 'hexagonal'
26+
t.meta['CAM_ID'] = 'FACT'
27+
t.meta['PIX_ROT'] = 0.0
28+
t.meta['CAM_ROT'] = 0.0
29+
t.meta['SOURCE'] = 'pyfact'
30+
t.meta['TAB_VER'] = '1'
31+
32+
33+
t.write('FACT.camgeom.fits.gz', overwrite=True)

0 commit comments

Comments
 (0)