Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove get_shower_coordinates from CameraGeometry #934

Closed
kosack opened this issue Jan 25, 2019 · 1 comment
Closed

Remove get_shower_coordinates from CameraGeometry #934

kosack opened this issue Jan 25, 2019 · 1 comment

Comments

@kosack
Copy link
Contributor

kosack commented Jan 25, 2019

the CameraGeometry.get_shower_coordinates() code seems out of place - the instrument module is not for algorithms, but for describing the hardware, and I don't like mixing the concepts too much.

I suggest we move this function elsewhere . It seems to just be a coordinate transform, so could be a new Frame (it's just a rotated camera). Or because it's only used by image.get_timing_parameters() and image.concentration()`, but nowhere else, it could be a helper-function in the image module.

def get_shower_coordinates(self, x, y, psi):
'''
Return longitudinal and transverse coordinates of the pixels
for a given set of hillas parameters
Parameters
----------
hillas_parameters: ctapipe.io.containers.HilllasContainer
Returns
-------
longitudinal: astropy.units.Quantity
longitudinal coordinates (along the shower axis)
transverse: astropy.units.Quantity
transverse coordinates (perpendicular to the shower axis)
'''
cos_psi = np.cos(psi)
sin_psi = np.sin(psi)
delta_x = self.pix_x - x
delta_y = self.pix_y - y
longi = delta_x * cos_psi + delta_y * sin_psi
trans = delta_x * -sin_psi + delta_y * cos_psi
return longi, trans

@maxnoe
Copy link
Member

maxnoe commented Jan 25, 2019

Agreed. It might also be better es a more general method taking arbitrary x and y instead of the pixel positions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants