bugGNU Astronomy Utilities - Bugs: bug #58640, Error in calculation of SIP to TPV...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #58640: Error in calculation of SIP to TPV coversions

Submitter:  Sachin Kumar Singh <sks_15>
Submitted:  Mon 22 Jun 2020 01:03:55 PM UTC
   
 
Category:  Fits Severity:  3 - Normal
Item Group:  Output not reasonable Status:  Fixed
Privacy:  Public Assigned to:  sks_15
Open/Closed:  Closed

Jump to the original submission

Wed 24 Jun 2020 12:17:17 AM UTC, comment #15: 

That's great! Thanks Raul for testing:-):-)

PVi_j are coefficients of some x^m*y^n in a tpv equation(also given in the comments). Also, PVi_3 and PVi_11(in current implementation order only up to 16) are radial terms and hence not used. So it's just that some coefficients might have a 0 value in the equation for given parameters and hence are missing,

Sachin Kumar Singh <sks_15>
Wed 24 Jun 2020 12:13:37 AM UTC, comment #14: 

Thanks for the check Raul ;-)! I am closing the task now.

About the old extra coefficients, I guess they became non-zero because of the same bug that caused the inverse sign. Once that bug was fixed, they also disappeared. As Sachin explained before, that bug was because of the incorrect reading of the SIP keywords.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 23 Jun 2020 11:09:46 PM UTC, comment #13: 

Thanks a log guys, now it seems to be good. As you can see the agreement between them are almost perfect! :-)

Using Python:


                      / World Coordinate System (WCS)
WCSAXES =                    2 / Number of coordinate axes
CRPIX1  =        976.816238403 / Pixel coordinate of reference point
CRPIX2  =        440.521743774 / Pixel coordinate of reference point
PC1_1   =    -1.00022174065751 / Coordinate transformation matrix element
PC1_2   =    -0.00319660295795 / Coordinate transformation matrix element
PC2_1   =    -0.00235639222511 / Coordinate transformation matrix element
PC2_2   =     0.99977077772003 / Coordinate transformation matrix element
CDELT1  =  9.34302943928898E-05 / [deg] Coordinate increment at reference point
CDELT2  =  9.35240534339602E-05 / [deg] Coordinate increment at reference point
CUNIT1  = 'deg'                / Units of coordinate increment and value
CUNIT2  = 'deg'                / Units of coordinate increment and value
CTYPE1  = 'RA---TPV'           / TAN (gnomonic) projection + distortions
CTYPE2  = 'DEC--TPV'           / TAN (gnomonic) projection + distortions
CRVAL1  =        39.9265010846 / [deg] Coordinate value at reference point
CRVAL2  =       -8.12618217247 / [deg] Coordinate value at reference point
LONPOLE =                180.0 / [deg] Native longitude of celestial pole
LATPOLE =       -8.12618217247 / [deg] Native latitude of celestial pole
RADESYS = 'FK5'                / Equatorial coordinate system
EQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates
PV1_1   =                   1.0 / TPV coefficient: x
PV1_4   =  2.74744439572126E-03 / TPV coefficient: xx
PV1_5   = -2.51914579463917E-03 / TPV coefficient: xy
PV1_6   = -4.48803400336329E-03 / TPV coefficient: yy
PV2_1   =                   1.0 / TPV coefficient: y
PV2_4   = -2.52742435899630E-03 / TPV coefficient: yy
PV2_5   =  1.75088471295910E-02 / TPV coefficient: yx
PV2_6   = -5.71014067284307E-03 / TPV coefficient: xx

                      / Versions and date
DATE    = '2020-04-14T13:33:00' / file creation date (YYYY-MM-DDThh:mm:ss UT)
CFITSIO = '3.47    '           / CFITSIO version.
WCSLIB  = '6.4     '           / WCSLIB version.
GSL     = '2.6     '           / GNU Scientific Library version.
GNUASTRO= '0.11    '           / GNU Astronomy Utilities version.
COMMIT  = 'v0.2-21-g1d5a5fa-dirty' / Git's commit description in running dir.
END



Using Gnuastro:


                      / World Coordinate System (WCS)
WCSAXES =                    2 / Number of coordinate axes
CRPIX1  =         976.81623840 / Pixel coordinate of reference point
CRPIX2  =         440.52174377 / Pixel coordinate of reference point
PC1_1   =    -1.00022174065751 / Coordinate transformation matrix element
PC1_2   =    -0.00319660295795 / Coordinate transformation matrix element
PC2_1   =    -0.00235639222511 / Coordinate transformation matrix element
PC2_2   =     0.99977077772003 / Coordinate transformation matrix element
CDELT1  =  9.34302943928899E-05 / [deg] Coordinate increment at reference point
CDELT2  =  9.35240534339601E-05 / [deg] Coordinate increment at reference point
CUNIT1  = 'deg'                / Units of coordinate increment and value
CUNIT2  = 'deg'                / Units of coordinate increment and value
CTYPE1  = 'RA---TPV'           / TAN (gnomonic) projection + distortions
CTYPE2  = 'DEC--TPV'           / TAN (gnomonic) projection + distortions
CRVAL1  =        39.9265010846 / [deg] Coordinate value at reference point
CRVAL2  =        -8.1261821725 / [deg] Coordinate value at reference point
LONPOLE =                180.0 / [deg] Native longitude of celestial pole
LATPOLE =        -8.1261821725 / [deg] Native latitude of celestial pole
RADESYS = 'FK5'                / Equatorial coordinate system
EQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates
PV1_1   =                  1.0 / TPV coefficient: x
PV1_4   =   2.747444395721E-03 / TPV coefficient: xx
PV1_5   =  -2.519145794639E-03 / TPV coefficient: xy
PV1_6   =  -4.488034003363E-03 / TPV coefficient: yy
PV2_1   =                  1.0 / TPV coefficient: y
PV2_4   =  -2.527424358996E-03 / TPV coefficient: yy
PV2_5   =   1.750884712959E-02 / TPV coefficient: yx
PV2_6   =  -5.710140672843E-03 / TPV coefficient: xx

                      / Versions and date
DATE    = '2020-06-23T23:00:35' / file creation date (YYYY-MM-DDThh:mm:ss UT)
CFITSIO = '3.47    '           / CFITSIO version.
WCSLIB  = '5.17    '           / WCSLIB version.
GSL     = '2.4     '           / GNU Scientific Library version.
GNUASTRO= '0.12.10-ebee'       / GNU Astronomy Utilities version.
END


Just curious. I can see that now there are some coefficients that have been disappeared, any reason for that?

Raul Infante-Sainz <infantesainz>
Group Member
Tue 23 Jun 2020 04:51:32 PM UTC, comment #12: 

Thanks Sachin, I just merged the branch in to 'master' in Commit ebeef2b94389d. You can now delete it the branch on your fork (its best for branches to be deleted as soon as they are merged).

Raul, can you please try the most recent tarball? If the final TPV signs are corrected, please close this task also ;-). The commit is already in the 'master' branch.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 23 Jun 2020 04:30:27 PM UTC, comment #11: 

Also, major changes were the initialisation using loops. If anything else comes up, I'll do the changes.

(Also somehow it automatically closed this task so wrote this comment to open it :-))

Sachin Kumar Singh <sks_15>
Tue 23 Jun 2020 04:25:24 PM UTC, comment #10: 

I've pushed it on task-sip-tpv branch on gitlab. We can fix more changes over it.

Sachin Kumar Singh <sks_15>
Tue 23 Jun 2020 03:51:52 PM UTC, comment #9: 

Thanks for the fix Sachin, so it isn't yet implemented. I just opened the task until we can confirm that it is fixed ;-).

I just fetched your commit, but it isn't over the most recent 'master' branch! Since that old 'bug-fixes' branch has now been fully rebased into the master branch, you shouldn't commit over it any more ;-). You should pull the most recent commit of the master branch and make your commit over that.

Also, please choose more descriptive names to avoid such confusions, generic branch names like 'bug-fixes' can cause a lot of confusion!

By the way, I also remember some minor cosmetic things you wanted to fix in the code, if you haven't implemented them yet, maybe you can also include them in the new commit you will make.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 23 Jun 2020 03:37:05 PM UTC, comment #8: 

It's a very small change I've pushed it on the bug-fix branch on my gitlab branch.

Sachin Kumar Singh <sks_15>
Tue 23 Jun 2020 03:28:08 PM UTC, comment #7: 

Sachin, do you mean that it is correct in Commit 7dca196b6f7f?

Raul, when you get the chance, can you please try the most recent tarball to see if is indeed corrected?

If it isn't you can open this bug again, but following Sachin's suggestion, we'll keep it closed until you can confirm ;-).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 23 Jun 2020 03:20:51 PM UTC, comment #6: 

The error was due to reading of SIP.REV instead of SIP.FWD keyword which was fine before but was changed by mistake and it read reverse coefficients(which are approximately equal to forward coefficients but opposite in sign) and hence was causing negative values and somewhat different results.

Sachin Kumar Singh <sks_15>
Tue 23 Jun 2020 02:54:20 PM UTC, comment #5: 

There was a silly error I made a few commits ago. I've fixed it now and it should produce almost similar to sip_tpv module. I think we can close this task now.

Sachin Kumar Singh <sks_15>
Tue 23 Jun 2020 01:57:42 PM UTC, comment #4: 

In a private discussion, Sachin just pointed out that the PV2* keywords have the wrong opposite sign (as if multiplied by -1). He is working on finding the cause and fixing it.

So I am reopening this bug until this issue is also fixed.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 23 Jun 2020 01:55:08 AM UTC, comment #3: 

Thanks a lot for the check Raul! I just rebased all the work on this test branch (which was originally started for bug #58623) as one commit into Gnuastro (Commit 7dca196b6f7f5884).

You can now safely install and use the most recent tarball:

https://akhlaghi.org/gnuastro-latest.tar.lz

Mohammad Akhlaghi <makhlaghi>
Group administrator
Mon 22 Jun 2020 10:58:36 PM UTC, comment #2: 

Thanks Mohammad.

1. Tarball installed without any problem and working with header only fits file! :-)

2. I think that solved the very big/small values of some coefficients. Now I obtain the following.

With Python:


                      / World Coordinate System (WCS)
WCSAXES =                    2 / Number of coordinate axes
CRPIX1  =        976.816238403 / Pixel coordinate of reference point
CRPIX2  =        440.521743774 / Pixel coordinate of reference point
PC1_1   =    -1.00022174065751 / Coordinate transformation matrix element
PC1_2   =    -0.00319660295795 / Coordinate transformation matrix element
PC2_1   =    -0.00235639222511 / Coordinate transformation matrix element
PC2_2   =     0.99977077772003 / Coordinate transformation matrix element
CDELT1  =  9.34302943928898E-05 / [deg] Coordinate increment at reference point
CDELT2  =  9.35240534339602E-05 / [deg] Coordinate increment at reference point
CUNIT1  = 'deg'                / Units of coordinate increment and value
CUNIT2  = 'deg'                / Units of coordinate increment and value
CTYPE1  = 'RA---TPV'           / TAN (gnomonic) projection + distortions
CTYPE2  = 'DEC--TPV'           / TAN (gnomonic) projection + distortions
CRVAL1  =        39.9265010846 / [deg] Coordinate value at reference point
CRVAL2  =       -8.12618217247 / [deg] Coordinate value at reference point
LONPOLE =                180.0 / [deg] Native longitude of celestial pole
LATPOLE =       -8.12618217247 / [deg] Native latitude of celestial pole
RADESYS = 'FK5'                / Equatorial coordinate system
EQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates
PV1_1   =                   1.0 / TPV coefficient: x
PV1_4   =  2.74744439572126E-03 / TPV coefficient: xx
PV1_5   = -2.51914579463917E-03 / TPV coefficient: xy
PV1_6   = -4.48803400336329E-03 / TPV coefficient: yy
PV2_1   =                   1.0 / TPV coefficient: y
PV2_4   = -2.52742435899630E-03 / TPV coefficient: yy
PV2_5   =  1.75088471295910E-02 / TPV coefficient: yx
PV2_6   = -5.71014067284307E-03 / TPV coefficient: xx



With Gnuastro:


                      / World Coordinate System (WCS)
WCSAXES =                    2 / Number of coordinate axes
CRPIX1  =         976.81623840 / Pixel coordinate of reference point
CRPIX2  =         440.52174377 / Pixel coordinate of reference point
PC1_1   =    -1.00022174065751 / Coordinate transformation matrix element
PC1_2   =    -0.00319660295795 / Coordinate transformation matrix element
PC2_1   =    -0.00235639222511 / Coordinate transformation matrix element
PC2_2   =     0.99977077772003 / Coordinate transformation matrix element
CDELT1  =  9.34302943928899E-05 / [deg] Coordinate increment at reference point
CDELT2  =  9.35240534339601E-05 / [deg] Coordinate increment at reference point
CUNIT1  = 'deg'                / Units of coordinate increment and value
CUNIT2  = 'deg'                / Units of coordinate increment and value
CTYPE1  = 'RA---TPV'           / TAN (gnomonic) projection + distortions
CTYPE2  = 'DEC--TPV'           / TAN (gnomonic) projection + distortions
CRVAL1  =        39.9265010846 / [deg] Coordinate value at reference point
CRVAL2  =        -8.1261821725 / [deg] Coordinate value at reference point
LONPOLE =                180.0 / [deg] Native longitude of celestial pole
LATPOLE =        -8.1261821725 / [deg] Native latitude of celestial pole
RADESYS = 'FK5'                / Equatorial coordinate system
EQUINOX =               2000.0 / [yr] Equinox of equatorial coordinates
PV1_0   =   1.889113867242E-10 / TPV coefficient: 1
PV1_1   =   1.000000002193E+00 / TPV coefficient: x
PV1_2   =  -4.561985107818E-09 / TPV coefficient: y
PV1_4   =   2.710853423663E-03 / TPV coefficient: xx
PV1_5   =  -2.407209583341E-03 / TPV coefficient: xy
PV1_6   =  -4.504079860535E-03 / TPV coefficient: yy
PV2_0   =  -5.914329028462E-08 / TPV coefficient: 1
PV2_1   =   1.000001428240E+00 / TPV coefficient: y
PV2_2   =  -6.865513780250E-07 / TPV coefficient: x
PV2_4   =   2.496120304034E-03 / TPV coefficient: yy
PV2_5   =  -1.753549801538E-02 / TPV coefficient: yx
PV2_6   =   5.745550377824E-03 / TPV coefficient: xx


Now I see they are pretty similar. In some cases I think the Python script is rounding (PV1_1, PV2_1 ~ 1) or even removing them (PV1_0, PV20 ~ 0). What do you think? Thanks a lot, great work! :-)

Raul Infante-Sainz <infantesainz>
Group Member
Mon 22 Jun 2020 05:10:42 PM UTC, comment #1: 

Raul, can you try this tarball (for Comment 8 or task 15676): http://akhlaghi.org/src/gnuastro-0.12.13-81d57.tar.lz

It has two new features (Commit 81d573b8a78):

1. The input FITS images doesn't need to have any data (a keyword-only extension is also enough)

2. I found a bug that I had mistakenly introduced in Sachin's code a few commits ago on this branch (I had mistakenly changed a few of Sachin's 'k++'s to '++k's!). This may fix the problem with the absurdly large and small values that you found.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Mon 22 Jun 2020 01:03:55 PM UTC, original submission:  

Some discussions are done in task #15676 related to some false values resulting when SIP->TPV conversions are done. This is a continuation of the the thread in task $15676.

Sachin Kumar Singh <sks_15>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by infantesainz (Posted a comment)
  • -email is unavailable- added by makhlaghi (Posted a comment)
  • -email is unavailable- added by makhlaghi
  • -email is unavailable- added by sks_15 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 17 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-24 sks_15 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2020-06-24 sks_15 StatusFixed In Progress
        Open/ClosedClosed Open
    2020-06-24 makhlaghi StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2020-06-23 sks_15 StatusFixed In Progress
        Open/ClosedClosed Open
    2020-06-23 sks_15 Open/ClosedOpen Closed
    2020-06-23 makhlaghi Open/ClosedClosed Open
    2020-06-23 sks_15 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2020-06-23 makhlaghi StatusFixed In Progress
        Open/ClosedClosed Open
    2020-06-23 makhlaghi StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2020-06-22 makhlaghi Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code