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

Propagate WCS alignment to gwcs keywords #81

Open
gbrammer opened this issue May 26, 2022 · 5 comments
Open

Propagate WCS alignment to gwcs keywords #81

gbrammer opened this issue May 26, 2022 · 5 comments

Comments

@gbrammer
Copy link
Owner

The alignment scripts in prep now appear to work for the SIP headers generated for JWST exposures, but the alignment updates (shifts, rotation, scale) aren't propagated to the keywords that are read when running the assignWCS pipeline step. These seem to be
RA_REF, DEC_REF and ROLL_REF / PA_V3 in the SCI extension of the FITS files. It's not necessarily true that the REF position is the same as the SIP CRPIX pixel, so the shifts and rotation derived to align the SIP headers may not necessarily be the same for gwcs, depending on the order of operations.

@gbrammer
Copy link
Owner Author

gbrammer commented Jun 8, 2022

This is implemented in jwst_utils.match_gwcs_to_sip, but isn't yet run in the pipeline.

@jdavies-st
Copy link
Contributor

jdavies-st commented Oct 19, 2022

You can also use the tweakwcs package directly with the GWCS objects for the JWST data without using SIP FITS WCS approximations at all. I.e. tweak the GWCS objects directly to get alignment.

https://tweakwcs.readthedocs.io/en/latest/index.html

The tweakwcs package is actually what is running under-the-hood in jwst.tweakreg.

@gbrammer
Copy link
Owner Author

Thanks @jdavies-st. I agree, but the reason to implement things this way in grizli with the SIP headers is so that I can make consistent WCS between HST and JWST instruments and use the same (old) low-level drizzle code with both of them. I can generate SIP headers with forward/reverse transformations that agree with the GWCS objects to a small fraction of a pixel, though this required a bit of extra work beyond the existing gwcs method to generate the SIP WCS.

@jdavies-st
Copy link
Contributor

Cool. This might be something you can outsource to jwst.tweakreg, as it also (after tweaking), re-fits the SIP approximation so it resembles HST data.

Or if you don't like the SIP fitting or tweaking currently in jwst.tweakreg, you could keep it internal in grizli and use your own SIP approximation, i.e. in grizli use tweakwcs to do the JWST tweaking, then do your own SIP fitting afterwards.

Btw, if you find that your SIP fitting works better (or is more reliable) than that in the JWST pipeline, then you may want to push those changes or fixes upstream to jwst package. Would be great to get the best versions of the algorithms used consistently across both packages. 👍

@gbrammer
Copy link
Owner Author

Agreed. I'll look into the jwst.tweakreg version to see if it's better than what I was testing last summer. I'm sorry to admit I generally haven't updated my jwst module for quite some time, trying to leave well enough alone, but some of these things might be fixed by now.

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