gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 6dc1fd4 2/2: Warp: warning is printed when ali


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 6dc1fd4 2/2: Warp: warning is printed when alignment is not correct
Date: Thu, 28 May 2020 00:04:11 -0400 (EDT)

branch: master
commit 6dc1fd447fd07f3fab20cd496411ff3aeea27df5
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Warp: warning is printed when alignment is not correct
    
    Until now, when the North and East axis are not properly oriented
    (left-hand orientation), Warp would simply fail to make the correct
    rotation and wouldn't give any warning. It has been recognized as bug
    
    With this commit, it prints a warning when such cases may occur. We still
    haven't had time to fix it, but atleast the warning will tell the users how
    to fix it.
    
    Also, Warp now prints the name of its output file.
---
 bin/warp/ui.c   | 17 +++++++++++++++++
 bin/warp/warp.c |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 3f5d49d..f821f47 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -483,6 +483,8 @@ ui_matrix_make_align(struct warpparams *p, double *tmatrix)
      to find as 'X' and the final (aligned matrix) 'P' (which is the pixel
      scale):
 
+          X            W             P
+        ------       ------      -------
         x0  x1       w0  w1      -P0   0
         x2  x3   *   w2  w3   =   0    P1
 
@@ -541,6 +543,21 @@ ui_matrix_make_align(struct warpparams *p, double *tmatrix)
       x[3] = P[1] / w[1] / A;
       x[0] = -1 * x[1] * w[3] / w[1];
       x[2] = -1 * x[3] * w[2] / w[0];
+
+      /* When the input matrix is flipped, the diagonal elements of the
+         necessary rotation will have a different sign. */
+      if(x[0]*x[3]<0)
+        if(!p->cp.quiet)
+          error(0, 0, "%s (hdu %s): WARNING (bug #55217)! The alignment may "
+                "not be correct! This is a recognized bug, we just haven't "
+                "had enough time to fix it yet, any help or support is "
+                "most welcome.\n\n"
+                "This may be due to the East and North not being left-hand "
+                "oriented. If this is the case, you can fix it by flipping "
+                "the image along the problematic axis (with '--flip=1,0' or "
+                "'--flip=0,1') and re-running Warp with '--align'. Note "
+                "that you can't yet call '--flip' in the same command as "
+                "'--align'",  p->inputname, p->cp.hdu);
     }
 
   /* For a check:
diff --git a/bin/warp/warp.c b/bin/warp/warp.c
index 285027c..b67629d 100644
--- a/bin/warp/warp.c
+++ b/bin/warp/warp.c
@@ -581,6 +581,8 @@ warp(struct warpparams *p)
 
   /* Save the output. */
   correct_wcs_save_output(p);
+  if(!p->cp.quiet)
+    printf(" Output: %s\n", p->cp.output);
 
 
   /* Free the allocated spaces: */



reply via email to

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