Closed HealthyPear closed 4 years ago
Unless I am mistaken, this is also sometimes referred to as "alpha", and is illustrated in this diagram:
I don't think there is an implementation in ctapipe for this currently. I don't think it should be added to the hillas parameters, and one should probably be careful not to use it in the reconstruction (unless you are doing a source-dependent reconstruction), but we should/could have an implementation in ctapipe.
This is the implementation I use in the CHEC pipeline:
def calculate_alpha(x_src, y_src, x_cog, y_cog, psi):
beta = np.arctan2(y_cog - y_src, x_cog - x_src) # Angle between x and src
alpha = beta - psi
alpha = np.arctan2(np.sin(alpha), np.cos(alpha)) # Fix between -pi & pi
alpha90 = np.abs(np.arctan(np.sin(alpha) / np.cos(alpha))) # 0 to pi/2
return alpha, alpha90
Currently there are no source dependent parameters calculated in ctapipe.
This is something left to higher analysis steps usually, as there might be multiple sources in the field of view (e.g. NGC1275 and IC310) or no known source position at all (Follow up alerts with uncertain source position, Galactic Plane Survey)
IMHO DL1 to DL3 processing should nowhere depent on a known source position.
But we could optionally have a SourceDependentHillasParameters
container, that should also hold the assumed source position. This can then also be produced for Off positions when observing in wobble mode.
I used the image uploaded by Jason to clarify a bit.
It related to alpha, but not directly, since you should define a distance along the shower axis to use alpha directly.
I think this quantity is already available using the coordinates of centroid, source position and the angle between shower axis and "x" axis. Am i right?
This is done for MC-based analysis where the source is at the center of the camera, for the moment, but I am not sure one cannot use it also in a real case (the "true" position in the end the one sent to the Drive system).
You can use ctapipe.image.hillas.camera_to_shower_coordinates
for this:
from ctapipe.image.hillas import camera_to_shower_coordinates
disp, miss = camera_to_shower_coordinates(source_x, source_y, cog_x, cog_y, psi)
# maybe use `arctan(miss / disp)` to automatically get the smaller angle
alpha = np.arctan2(miss, disp)
There is an alternative definition of disp which would be the hypothenuse of the alpha /miss triangle.
On Mon, 25 Nov 2019 at 16:29, Maximilian Nöthe notifications@github.com wrote:
Currently there are no source dependent parameters calculated in ctapipe.
This is something left to higher analysis steps usually, as there might be multiple source in the field of view.
IMHO DL1 to DL3 processing should nowhere depent on a known source position.
I agree. But regardless of where miss is calculated, it can indeed be "used for a source-independent analysis". In case of MARS, one makes a LUT (with axes Width / Length and Intensity) by filling in it the average squared miss. The smaller the value, the more reliable the image axis is. Then one uses this LUT to assign weights to image axes in stereo reconstruction, depending only on the Intensity and Width/Length of the image. Hence in the "actual analysis" of the events in the "test" sample miss is of course not used.
A.
--
Abelardo Moralejo Olaizola Institut de Física d'Altes Energies Tel : +34 931641662 Fax: +34 935811938 Avís - Aviso - Legal Notice - (LOPD) - http://legal.ifae.es
-- Avís - Aviso - Legal Notice - (LOPD) - http://legal.ifae.es http://legal.ifae.es/
You can use
ctapipe.image.hillas.camera_to_shower_coordinates
for this:from ctapipe.image.hillas import camera_to_shower_coordinates disp, miss = camera_to_shower_coordinates(source_x, source_y, cog_x, cog_y, psi)
Oh it was literally the function above.... :) Many thanks.
This is solved, right?
Or do we need this as a function called miss?
In the framework of the comparison between protopipe and CTA-MARS, and in particular looking at how the latter works in detail, I encountered a quantity which I think it is not taken into (at least direct) account in ctapipe . Since I need it for protopipe, perhaps it can be useful for others as well.
The quantity I am referring to is called the miss parameter (at least there) and it corresponds to the minimal distance in degrees between the parametrized image axis and the true source position.
From
ctapipe.image.hillas.hillas_parameters
many useful quantities are already available and I was thinking about how to implement it (or add it directly to the same method).Is this already available and I am not seeing it? If not, did someone already do it somewhere else and we can just migrate it to ctapipe (lst-chain for example)?