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

IRF interpolation outside node ranges #275

Open
juanjq opened this issue Dec 12, 2024 · 3 comments
Open

IRF interpolation outside node ranges #275

juanjq opened this issue Dec 12, 2024 · 3 comments

Comments

@juanjq
Copy link

juanjq commented Dec 12, 2024

I noticed in the limiting cases, when for example, in high ZD observations. If your target cosZD is outside of the range that your grid points cover, even that if the distance is relatively small. Then the aeff interpolation is failing (i.e. returning all nan), and consequently when trying to create the hdu (line 373 of /magic-cta-pipe/magicctapipe/scripts/lst1_magic/lst1_magic_dl2_to_dl3.py) program fails with the following error IndexError: index 0 is out of bounds for axis 0 with size 0 and without any other explanation.

Can be solved providing only one IRF in those cases, but I think something can be added/changed in the code. Selecting just closer node in this cases, and no interpolation, or at least tell the user that the hdu creation failed because the observations cannot be interpolated in this case. I would suggest to implement same procedure than in lstchain, where when this happens is solved with the following exception:
Target value is outside interpolation. Using the nearest IRF.

If you need it I can prepare a small script with some data with these conditions in case you want to recreate the problem.

@Elisa-Visentin
Copy link
Collaborator

I can have a look into the dl2-dl3 script to check what is happening (not now). Just one comment: maybe we should use the nearest node only if it is within XXX deg from the target (otherwise, don't produce the output file), just to prevent cases in which, due to missing test nodes, you assign to your observation a IRF evaluated too far away (e.g., observation at 50 deg, IRFs only up to 20 deg, you use the 20 deg IRF for a 50 deg observation: quite dangerous!)

@juanjq
Copy link
Author

juanjq commented Dec 12, 2024

I agree, even that is close I guess make sense at least notify that no interpolation is being used, and in the case that is too far, notify that output is not being produced because of that. About the limiting distance maybe makes sense to use the config parameter 'dl2_to_dl3': {'max_distance': }? Or maybe is too large for this purpose, this I don't know...

@Elisa-Visentin
Copy link
Collaborator

the current max_distance parameter is, by default, 45 deg, b/c it takes into account both Azimuth and Zenith, so that you don't have to have a test point 'on' your source path to use it, it must just be at a 'total distance' (Azimuth AND Zenith) < 45 deg; in low-mid zenith observations, the Zenith steps for the IRFs are quite small, so this is often a strong requirement in Azimuth. As for the Zenith-only distance, I would suggest something much smaller (20 deg? 15 deg?) or you could use 10 deg IRFs for 50 deg observations....

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

No branches or pull requests

2 participants