cta-observatory / ctapipe

Low-level data processing pipeline software for CTAO or similar arrays of Imaging Atmospheric Cherenkov Telescopes
https://ctapipe.readthedocs.org
BSD 3-Clause "New" or "Revised" License
63 stars 269 forks source link

Proper handling of curved camera geometries #1018

Open maxnoe opened 5 years ago

maxnoe commented 5 years ago

The information we need is in the SimTelFiles:

It contains pixel x, y, z and x and y of the normal vector on the pixel. In the comment it says that the vector should be (x, y, 1).

What is the angle to the z direction of the pixels of the CHEC camera @watsonjj ? Just to verify.

I got 7.7° 4.62°, 1.5° for the different pixel groups, is that correct?

maxnoe commented 5 years ago
import numpy as np
from eventio import SimTelFile

s = SimTelFile('chec.simtel.gz')
camera_settings = s.telescope_descriptions[1]['camera_settings']

x = camera_settings['pixel_x']
y = camera_settings['pixel_y']
z = camera_settings['pixel_z']

# normal vector components
nx = camera_settings['nxpix']
ny = camera_settings['nypix']
nz = np.ones_like(nx)

The chec.simtel.gz is the file @watsonjj has provided here #963

maxnoe commented 5 years ago

@dneise maybe we should give better names to those nxpix and nypix in eventio

maxnoe commented 5 years ago

chec

thomasarmstrong commented 5 years ago

Looks sort of correct. The pixels should be orientated with each of the modules*, where the module positions can be found at start of the camera configuration file for chec. How do you only get 3 distinct pixel groups for the z angle? I get a range between 2 and 9 degrees.

*on a side note, is the corresponding module number for each pixel saved in camera_settings?

maxnoe commented 5 years ago

This is what I did:

from eventio import SimTelFile
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

s = SimTelFile('chec.simtel.gz')
camera_settings = s.telescope_descriptions[1]['camera_settings']

x = camera_settings['pixel_x']
y = camera_settings['pixel_y']
z = camera_settings['pixel_z']

# normal vector components
nx = camera_settings['nxpix']
ny = camera_settings['nypix']
nz = np.ones_like(nx)

n = np.column_stack([nx, ny])

print(*np.unique(np.round(np.rad2deg(np.arctan(n)), 1), axis=0), sep='\n')

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)

ax.quiver(x, y, nx, ny)
ax.set_aspect(1)

fig.savefig('chec.png', dpi=300)
plt.show()

The simtel files contains something called pixel drawers, maybe that's it?

maxnoe commented 5 years ago
from ctapipe.visualization import CameraDisplay
from ctapipe.io import SimTelEventSource
import matplotlib.pyplot as plt

source = SimTelEventSource(input_url='chec.simtel.gz')

cam = source._subarray_info.tel[1].camera

disp = CameraDisplay(cam)

disp.image = source.file_.telescope_descriptions[1]['camera_organization']['drawer']
disp.add_colorbar()

plt.savefig('drawers.png', dpi=200)

drawers

thomasgas commented 5 years ago

Can this issue be closed? @MaxNoe

maxnoe commented 5 years ago

No, we have no handling of curved geometries / the definite answer we don't need it

maxnoe commented 3 years ago

I emailed with Konrad again, and he said we should like we do now just look at the xy projection. However that results in ugly camera displays, since there we don't actually do the projection but draw a regular square at each center position.

This also might create problems for the muon calibration or any other algorithm where you need to calculate a signal expectation for each pixel.

So input from the two mirror telescope teams here would be very welcome, I cannot yet wrap my head around how best to implement this.

How do we need to transform a pixel with (x, y, n_x, n_y) where n_x and n_y are x and y components of the normal vector of the pixel to a position in the field of view (TelescopeFrame)?

@thomasarmstrong @watsonjj @seinecke