gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 2a3cc19b: radial-profile: removes radii that a


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2a3cc19b: radial-profile: removes radii that are larger than requested rmax
Date: Sat, 2 Apr 2022 16:09:35 -0400 (EDT)

branch: master
commit 2a3cc19b124a4ecb12fd9d4eae0c4739193d95bf
Author: Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    radial-profile: removes radii that are larger than requested rmax
    
    Until now, due to the position angle and axis ratio, it was possible that
    the output radial profile has one extra radius and we didn't have any check
    to avoid this situation.
    
    With this commit, the output catalog is checked so the final output does
    not have radii larger than what user asked for.
    
    This issue originates from MakeProfiles that built the labeled image for
    measurement: it could happen that at certain ellipticities and position
    angles, the profile would contain one or two pixels with a radius on the
    limit due to floating-point errors. That pixel would cause this problem. So
    the easiest solution was to limit the table in the end.
---
 NEWS                         |  2 ++
 bin/script/radial-profile.in | 17 ++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 13846c8d..9f3bc501 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ See the end of the file for license conditions.
               Found and fixed by Sepideh Eskandarlou.
   bug #62250: Convolve crashes when doing PSF matching. Found with help of
               Raul Infante-Sainz.
+  bug #62252: Radial profile giving one larger radius in high axis-ratio
+              profile. Found and fixed by Sepideh Eskandarlou.
 
 
 
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index 2c5e56b6..ca35c77d 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -710,22 +710,33 @@ astmkcatalog $apertures -h1 --valuesfile=$values 
--valueshdu=1 --ids \
 #
 # But before anything, we need to set the options to print the other
 # columns untouched (we only want to change the first column).
+outraw=$tmpdir/out-raw.fits
 restcols=$(astfits $cat -h1 \
                | awk '/^TFIELDS/{for(i=2;i<=$3;++i) printf "-c%d ", i}')
 if [ x"$oversample" != x ]; then
     asttable $cat -c'arith OBJ_ID float32 '$oversample' / 1 -' $restcols \
-             -o$output --colmetadata=ARITH_3,RADIUS,pix,"Radial distance"
+             -o$outraw --colmetadata=ARITH_3,RADIUS,pix,"Radial distance"
 elif [ x"$undersample" != x ]; then
     asttable $cat -c'arith OBJ_ID float32 '$undersample' x 1 -' $restcols \
-             -o$output --colmetadata=ARITH_3,RADIUS,pix,"Radial distance"
+             -o$outraw --colmetadata=ARITH_3,RADIUS,pix,"Radial distance"
 else
-    asttable $cat -c'arith OBJ_ID float32 1 -' $restcols -o$output \
+    asttable $cat -c'arith OBJ_ID float32 1 -' $restcols -o$outraw \
              --colmetadata=1,RADIUS,pix,"Radial distance"
 fi
 
 
 
 
+# Due to a possible position angle and axis ratio, it is possible to get at
+# least one extra radial aperture (that is given to
+# MakeCatalog). Therefore, once the final radii are set (accounting for
+# over/under sampling), we should make sure that the final output doesn't
+# contain radii larger than what the user asked for.
+asttable $outraw --range=RADIUS,0,$rmax --output=$output
+
+
+
+
 
 # Remove temporary files
 # ----------------------



reply via email to

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