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

update getViewWCS to adapt to projection #119

Merged
merged 13 commits into from
Nov 8, 2023

Conversation

ManonMarchand
Copy link
Member

This is an adaptation of the method getViewWCS so that is also works for projections that are not "SIN".

What's new

new in API:

aladin.getCooFrame()

This new function returns the current cooFrame of the view. The retruned values can be "J2000", "J2000d", "Galactic" and are taken from the label returned by aladin.view.cooframe

What changed

aladin.getViewWCS()

now adapts to the projection and coordinate system in the keys CTYPE1 and CTYPE2 rather than always returning RA---SIN and DEC

What needs to be reviewed

Check that this is the expected output. Example:

"Galactic"

CD1_1: 0.018111371257799755
CD1_2: 0
​CD2_1: 0
​CD2_2: 0.018111371257799755
​CRPIX1: 1280
​CRPIX2: 378
​CRVAL1: 326.8736386214195
​CRVAL2: 7.499153148417243
​CTYPE1: "GLON-AIT"
​CTYPE2: "GLAT-AIT"
​NAXIS: 2
​NAXIS1: 2560
​NAXIS2: 756
​RADECSYS: "ICRS"

"J2000d"

CD1_1: 0.018111371257799755
CD1_2: 0
CD2_1: 0
CD2_2: 0.018111371257799755
CRPIX1: 1280
CRPIX2: 378
CRVAL1: 326.8736386214195
CRVAL2: 7.4991531484172445
CTYPE1: "RA---STG"
CTYPE2: "DEC--STG"
NAXIS: 2
NAXIS1: 2560
NAXIS2: 756
RADECSYS: "ICRS"

@ManonMarchand
Copy link
Member Author

Also possible to add in this PR:

  • I wanted to add a test but I did not manage to create a fake aladin instance with happy-dom
  • we might need a setCooFrame method too?

@tboch
Copy link
Collaborator

tboch commented Aug 31, 2023

Also possible to add in this PR:

  • I wanted to add a test but I did not manage to create a fake aladin instance with happy-dom

I don't know, usage of happy-dom is new, perhaps @bmatthieu3 can help.

  • we might need a setCooFrame method too?

There is already a setFrame method actually. For symmetry, I suggest keeping setFrame (in order not to break existing API) and adding setCooFrame as an alias.

src/js/Aladin.js Outdated Show resolved Hide resolved
src/js/Aladin.js Outdated Show resolved Hide resolved
@ManonMarchand
Copy link
Member Author

There is already a setFrame method actually. For symmetry, I suggest keeping setFrame (in order not to break existing API) and adding setCooFrame as an alias.

Or we could just rename getCooFrame in getFrame?

@tboch
Copy link
Collaborator

tboch commented Aug 31, 2023

There is already a setFrame method actually. For symmetry, I suggest keeping setFrame (in order not to break existing API) and adding setCooFrame as an alias.

Or we could just rename getCooFrame in getFrame?

This involve less changes, thus let's do that!

@ManonMarchand
Copy link
Member Author

ManonMarchand commented Aug 31, 2023

Should be all good now? :)

EDIT: Nope. We have issues with a few projections.

@ManonMarchand
Copy link
Member Author

New commits add the following stuff:

ZEA: {id: 4, fov: 360}, /* Equal-area */
FEYE: {id: 5, fov: 190},
AIR: {id: 6, fov: 360},
TAN: {id: 1, fov: 180, longName: "gnomonic"}, /* Gnomonic projection */
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would have chosen maybe something like: 'name' or 'label' instead of 'longName'

Copy link
Member Author

Choose a reason for hiding this comment

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

I was kinda un-inspired. "label" sounds perfect thanks 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

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

In table 12 of WCS FITS paper ( https://arxiv.org/pdf/astro-ph/0207413.pdf ), the 3-letters code is called code and the name is called projection name 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but then I'd need to rename the code into "code" because everywhere else it's "name" for us. Do we do that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, let's keep it as you update it.

@ManonMarchand
Copy link
Member Author

I think we can merge ?

@bmatthieu3
Copy link
Collaborator

I am merging this. It would have been great to run some test asserting some wcs are good (a planetary one, with different projection). But this involve to much deep diving into how jsdom/happy-dom can mock webgl2 canvas. This is for another future PR

@bmatthieu3 bmatthieu3 merged commit 60d1567 into develop Nov 8, 2023
1 check passed
@ManonMarchand ManonMarchand deleted the feature-projections-in-get-view-wcs branch November 30, 2023 13:42
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.

3 participants