jwst icon indicating copy to clipboard operation
jwst copied to clipboard

tweakreg should report inverse SIP coefficients in FITS WCS

Open mcara opened this issue 2 years ago • 9 comments

This PR enables tweakreg to report inverse SIP coefficients in data model's meta.wcsinfo when computing FITS WCS from GWCS.

I believe it is better not to include these coefficients as most common WCS software would resort to a more accurate iterative solution, but I make this PR for in case it is needed. See #6936 discussions for more details.

Checklist

  • [x] added entry in CHANGES.rst within the relevant release section
  • [ ] updated or added relevant tests
  • [ ] updated relevant documentation
  • [x] added relevant milestone
  • [x] added relevant label(s)

mcara avatar Jul 24 '22 09:07 mcara

Codecov Report

Merging #6939 (35ec286) into master (495831c) will decrease coverage by 0.00%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #6939      +/-   ##
==========================================
- Coverage   79.42%   79.42%   -0.01%     
==========================================
  Files         415      415              
  Lines       37458    37476      +18     
==========================================
+ Hits        29751    29765      +14     
- Misses       7707     7711       +4     
Flag Coverage Δ *Carryforward flag
nightly 79.39% <ø> (ø) Carriedforward from 495831c
unit 53.12% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
jwst/tweakreg/tweakreg_step.py 64.82% <ø> (+1.28%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Jul 24 '22 09:07 codecov[bot]

Given the information provided in #6936 , which suggests that ds9 can compute it's own inverse when not provided in the header and what it computes appears to be quite accurate, I don't see the need for this. Of course it also can't really hurt to have it, in case other tools can't compute their own inverse.

hbushouse avatar Jul 25 '22 11:07 hbushouse

Of course it also can't really hurt to have it...

It can, if provided inverse SIP approximation is not very accurate due to how DS9 has been set-up to use this approximation first, if available.

mcara avatar Jul 25 '22 13:07 mcara

Of course it also can't really hurt to have it...

It can, if provided inverse SIP approximation is not very accurate due to how DS9 has been set-up to use this approximation first, if available.

Good point.

hbushouse avatar Jul 25 '22 13:07 hbushouse

On the other hand, current level of accuracy (0.005 pixels) for the inverse is high enough for visualization applications (DS9) and astropy.wcs.WCS.all_worls2pix() ignores inverse SIP. So does AST (by default). But I do not know what else is out there that may or may not use inverse SIP. So, by having high enough accuracy, we can mitigate the issue of some applications such as DS9 using [less accurate] inverse SIP.

I just don't want us to arrive at a final solution. 😆

mcara avatar Jul 25 '22 13:07 mcara

Well, if we can easily provide a fairly accurate reverse solution, then I guess we're back to the state of "we might as well put it in, because it shouldn't do any damage". That way it's also consistent with what we provide in the cal products. What do you think @nden ?

hbushouse avatar Jul 25 '22 14:07 hbushouse

👍 for adding it

nden avatar Jul 25 '22 20:07 nden

@mcara can you fix the conflict in this PR, so that I can then run the regtest suite on it?

hbushouse avatar Aug 09 '22 15:08 hbushouse

Again, I recommend not to write out inverse SIP but I understand if this is desired and that is the only reason for this PR.

mcara avatar Aug 09 '22 19:08 mcara