gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 92482d5: ds9-region: using floating point numb


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 92482d5: ds9-region: using floating point numbers instead of genearl character
Date: Wed, 1 Dec 2021 12:51:05 -0500 (EST)

branch: master
commit 92482d5743a5e7fef9910a0c20a7efa2cc0e5ee8
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    ds9-region: using floating point numbers instead of genearl character
    
    Until this commit, when saving the region files, the coordinates were set
    as general (%g). However, this can produces problems because of rounding
    the floating points numbers. Actually, I detected this problem when
    checking the central position of some objects that were systematically
    offset.
    
    With this commit, this problem has been fixed by using floating point
    numbers (%f).
---
 NEWS                     | 2 ++
 bin/script/ds9-region.in | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index fb93c82..1f661ca 100644
--- a/NEWS
+++ b/NEWS
@@ -111,6 +111,8 @@ See the end of the file for license conditions.
   bug #61584: When FITS file doesn't end with '.fits' and the output file
               already existed, Arithmetic would write the output in new
               extension while it should have been deleted.
+  bug #61598: ds9-region script not using precise WCS values, found and
+              fixed by Raúl Infante-Sainz.
 
 
 
diff --git a/bin/script/ds9-region.in b/bin/script/ds9-region.in
index 7e6945e..38ec91b 100644
--- a/bin/script/ds9-region.in
+++ b/bin/script/ds9-region.in
@@ -324,13 +324,13 @@ if [ x"$namecol" = x ]; then
         cat /dev/stdin \
             | asttable --column=$col \
             | while read a b; do \
-                  printf "circle(%g,%g,%g%s)\n" \
+                  printf "circle(%f,%f,%f%s)\n" \
                          $a $b $radius $unit >> $out; \
               done
     else
         asttable $input --hdu=$hdu --column=$col \
             | while read a b; do \
-                  printf "circle(%g,%g,%g%s)\n" \
+                  printf "circle(%f,%f,%f%s)\n" \
                          $a $b $radius $unit >> $out; \
               done
     fi
@@ -339,13 +339,13 @@ else
         cat /dev/stdin \
             | asttable --column=$col --column=$namecol \
             | while read a b c; do \
-                  printf "circle(%g,%g,%g%s) # text={%g}\n" \
+                  printf "circle(%f,%f,%f%s) # text={%g}\n" \
                          $a $b $radius $unit $c >> $out; \
               done
     else
         asttable $input --hdu=$hdu --column=$col --column=$namecol \
             | while read a b c; do \
-                  printf "circle(%g,%g,%g%s) # text={%g}\n" \
+                  printf "circle(%f,%f,%f%s) # text={%g}\n" \
                          $a $b $radius $unit $c >> $out; \
               done
     fi



reply via email to

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