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

Use sky_to_fov() also for RADEC FoVAlignment in make_map_background_irf #4667

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SimoneMender
Copy link
Contributor

@SimoneMender SimoneMender commented Jul 18, 2023

Suggestion to fix issue #3510

@bkhelifi
Copy link
Member

Hello @SimoneMender ,
Thank you for this PR. @maxnoe, is the SkyOffsetFrame(origin=pointing_icrs) compatible with the CTAO official frame in which the IRF can be defined? The link with pyrirf is obvious here and a coordination is needed.

@bkhelifi bkhelifi requested a review from maxnoe July 18, 2023 11:02
@maxnoe
Copy link
Member

maxnoe commented Jul 18, 2023

Unfortunayley, there are no official CTAO celestial coordinate definitions yet

1 similar comment
@maxnoe
Copy link
Member

maxnoe commented Jul 18, 2023

Unfortunayley, there are no official CTAO celestial coordinate definitions yet

@bkhelifi
Copy link
Member

It was my fear... And do you think that, at least temporary in Gammapy&pyirf, this definition from astropy could be used? At least for testing purposes....

@SimoneMender
Copy link
Contributor Author

SimoneMender commented Jul 18, 2023

From my point of view, the issue is that according to the GADF definition (https://gamma-astro-data-formats.readthedocs.io/en/latest/general/coordinates.html#coords-fov), "FOV LON should increase with decreasing OTHER LON". As this is the coordinate system in which a background model has to be stored, it is mandatory to switch the sign of longitude angle when creating a background map. This is exactly covered by the sky_to_fov() function.

@maxnoe
Copy link
Member

maxnoe commented Jul 18, 2023

I think that CTA(O) definitions are not relevant here.

As of now, Gammapy only supports GADF as input format. So what applies are the definitions of the field of view coordinate system of GADF.

And GADF defines the FOV longitude to have the opposite sign to the system ot is aligned with, for both alignments (ALTAZ / RADEC).

We should probably implement this using astropy coordinate frames like GADFFoVAltAz and GADFFoVICRS.

@SimoneMender
Copy link
Contributor Author

SimoneMender commented Jul 18, 2023

Isn't the parameter sky_coord already following the definition of the right coordinate system (in the case of RADEC FoVAlignment), as it is created from the reference geometry geom, which is a ~gammapy.maps.WcsGeom object?

sky_coord = map_coord.skycoord

Copy link
Contributor

@registerrier registerrier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SimoneMender .
As far as I know, sky_to_fov does the same thing as what was done here (except for the sign of fov_lon). But it does not check the input systems of the coordinates.

The issue lies probably in the sky_to_fov implementation, taking ra and dec instead of a full SkyCoord.

fov_lon = pseudo_fov_coord.lon
fov_lat = pseudo_fov_coord.lat
fov_lon, fov_lat = sky_to_fov(
sky_coord.ra, sky_coord.dec, pointing_icrs.ra, pointing_icrs.dec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, it is not guaranteed that pointing_icrs is actually a SkyCoord in RADEC system if the input is not a FixedPointingInfo. This must be fixed before calling the ra and dec attributes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also is it guaranteed that sky_coord is in RADEC system?

@bkhelifi
Copy link
Member

@SimoneMender can you update your code from the main, such that the CI tests can pass successfully?

@registerrier registerrier added this to the 1.2 milestone Nov 23, 2023
@registerrier registerrier modified the milestones: 1.2, 1.3 Feb 9, 2024
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

Successfully merging this pull request may close these issues.

None yet

4 participants