gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 1b505d1 21/32: Binning the S/N column


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 1b505d1 21/32: Binning the S/N column
Date: Wed, 24 Feb 2021 22:36:18 -0500 (EST)

branch: master
commit 1b505d162368d80e81d96ce10681ab06d8c7b8fa
Author: Zahra Sharbaf <zahra.sharbaf2@gmail.com>
Commit: Zahra Sharbaf <zahra.sharbaf2@gmail.com>

    Binning the S/N column
    
    With this commit, the way to do binning the column with S/N data has been
    changed.
---
 bin/script/radial-profile.in | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index b192ecc..e243369 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -401,15 +401,26 @@ astmkcatalog $aperturesfits -h1 --valuesfile=$inputs 
--valueshdu=$hdu \
 # is possible to bin the data. It is done in any case, if the user set the
 # default value of binning variable($b) except 1, because the binning will
 # be equal to 1 so the output binned will be the same as the input. To do
-# the binning of the data, a small Awk script is used. Since the Awk script
-# will print the columns as float values, it is necessary to change the
-# headers. To do that, Sed is used to replace all ocurrences of i32 to f32.
+# the binning of the data, a small Awk script is used.Because of the
+# behavior of signal to noise ratio isn't linear. We used the different
+# way to do binning the S/N column. Since the Awk script will print the
+# columns as float values, it is necessary to change the headers. To do
+# that, Sed is used to replace all ocurrences of i32 to f32.
 bprofile=$(echo $output | sed -e"s|.fits|_binned.fits|g")
 if [ $b != 1 ]; then
 
   asttable $fprofile \
            | awk -v b=$b '/^#/{print} BEGIN { N = b }                          
                                                                                
                    { for (i = 1; i <= 2; i++) sum[i] += $i}
                                  { for (i = 3; i == 3; i++) sum[i] += $i ** 2}
+                                 {if (i != 3)
+                                      {
+                                        N = b
+                                      }
+                                  else
+                                     {
+                                       N = b ** 0.5
+                                     }
+                                 }
            NR % N == 0 { for (i = 1; i <= NF; i++)
                           {
                             printf("%.6f%s",sum[i]/N, ( i == NF) ? "\n" : " ")
@@ -480,7 +491,7 @@ cat $aprofile | asttable -o$output
 #
 # The half-light or 'effective' radius as the radius within which half of
 # the object's luminosity is contained.
-halfoflight=$(asttable $output | awk '{if(max<$2){max=$2}}END{print max/2}')
+halfoflight=$(asttable $output | awk 'NR>=3{if(max<$2){max=$2}}END{print 
max/2}')
 radius=$(asttable $output \
            | awk '{if('$(echo $halfoflight)'<=$2){line=$1;light=$2}}END{print 
line}')
 echo "Half-Light-Radii: $radius pixels from the center of the object"



reply via email to

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