gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master b00cdc4 1/2: WCS library: gal_wcs_pixel_scale


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master b00cdc4 1/2: WCS library: gal_wcs_pixel_scale not ignoring singular matrices
Date: Sat, 30 Nov 2019 13:45:33 -0500 (EST)

branch: master
commit b00cdc40a17bc9fccb692569f50388e29866aa58
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    WCS library: gal_wcs_pixel_scale not ignoring singular matrices
    
    Until now, if the WCS rotation matrix was singular (had atleast one zero
    element along the diagonal), `gal_wcs_pixel_scale' would not proceed. But
    while testing on some images with such matrices (the image WCS was rotated
    90 degrees compared to the standard directions), it worked nicely and was
    able to calculate the pixel scale. So with this commit, this extra check
    has been removed.
---
 lib/wcs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/wcs.c b/lib/wcs.c
index d0f9a77..2dd5524 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -655,17 +655,15 @@ gal_wcs_pixel_scale(struct wcsprm *wcs)
   /* Only continue if a WCS exists. */
   if(wcs==NULL) return NULL;
 
+
   /* Write the full WCS rotation matrix into an array, irrespective of what
      style it was stored in the wcsprm structure (`PCi_j' style or `CDi_j'
      style). */
   a=gal_wcs_warp_matrix(wcs);
 
-  /* A small sanity check (this won't work on a singular matrix, can happen
-     in FITS WCSs!). In this case, we should return NULL.*/
-  n=wcs->naxis;
-  for(i=0;i<n;++i) {if(a[i*n+i]==0.0f) return NULL;}
 
   /* Now that everything is good, we can allocate the necessary memory. */
+  n=wcs->naxis;
   v=gal_pointer_allocate(GAL_TYPE_FLOAT64, n*n, 0, __func__, "v");
   permutation=gal_pointer_allocate(GAL_TYPE_SIZE_T, n, 0, __func__,
                                    "permutation");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]