gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 2718494e 19/69: PSF stamp: allowing to run the


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2718494e 19/69: PSF stamp: allowing to run the script without making normalization
Date: Wed, 26 Jan 2022 12:39:10 -0500 (EST)

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

    PSF stamp: allowing to run the script without making normalization
    
    Until this commit, when running the script 'psf-create-make-stamp', it
    would abort as soon as the user doesn't provide a normalization radii with
    the option '--normradii'. The reason is that this script is desired to
    obtain normalized stamps of stars. However, it could be possible that the
    user want the stamps without making the normalization.  For example,
    because there is any other methodology for making the normalization. But at
    the same time, it would be good to have this script running in order to
    obtain the stamps (center the star, mask nearby objects, etc.). With this
    commit, necessary changes have been included with the goal of running this
    script without having to specify a ring of normalization. Internally, it
    won't compute the radial profile and the normalization value will be set to
    1.0.
---
 bin/script/psf-create-make-stamp.in | 68 ++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 35 deletions(-)

diff --git a/bin/script/psf-create-make-stamp.in 
b/bin/script/psf-create-make-stamp.in
index 70d5d7b9..f7208b2d 100644
--- a/bin/script/psf-create-make-stamp.in
+++ b/bin/script/psf-create-make-stamp.in
@@ -296,9 +296,8 @@ fi
 
 # If a normalization range is not given at all.
 if [ x"$normradii" = x ]; then
-    echo "$scriptname: no rign of normalization provided."
-    echo "$scriptname: values to '--normradii' ('-n') should be provided."
-    exit 1
+    echo "$scriptname: no ring of normalization provided."
+    echo "$scriptname: the stamp won't be normalized."
 else
     nnormradii=$(echo $normradii | awk 'BEGIN{FS=","}END{print NF}')
     if [ x$nnormradii != x2 ]; then
@@ -467,40 +466,39 @@ fi
 
 
 
-# Compute the radial profile
-# --------------------------
+# Compute the radial profile and the normalization value
+# ------------------------------------------------------
 #
-# Generate the radial profile of the stamp, since it has been already
-# centered on the center of the object, it is not necessary to give the
-# center coordinates. If the user specifies a maximum radius, use it. If
-# the user specifies sigma clip parameters, use them.
-radialprofile=$tmpdir/rprofile-$objectid.fits
-if [ x"$rmax" != x ]; then maximumradius="--rmax=$rmax"
-else                       maximumradius=""
-fi
-if [ x"$sigmaclip" = x ]; then finalsigmaclip=""
-else                           finalsigmaclip="--sigmaclip=$sigmaclip";
-fi
-astscript-radial-profile $cropped_masked --hdu=1 $maximumradius \
-                         --measure=$normop $finalsigmaclip \
-                         --output=$radialprofile $quiet
-
-
-
-
-
-# Compute the normalization value
-# -------------------------------
-#
-# The normalization value is computed from the radial profile in between
-# the two radius specified by the user. In this case, the option to give
-# sigmaclip parameters to 'aststatistics' is different.
-if [ x"$sigmaclip" = x ]; then finalsigmaclip=""
-else                           finalsigmaclip="--sclipparams=$sigmaclip";
+# Only if the the user has specified a ring of normalization (--normradii).
+# Otherwise set the normalization value equal to 1.0 (no normalization).
+if [ x"$normradiusmin" != x ] && [ x"$normradiusmax" != x ]; then
+    # Generate the radial profile of the stamp, since it has been already
+    # centered on the center of the object, it is not necessary to give the
+    # center coordinates. If the user specifies a maximum radius, use it. If
+    # the user specifies sigma clip parameters, use them.
+    radialprofile=$tmpdir/rprofile-$objectid.fits
+    if [ x"$rmax" != x ]; then maximumradius="--rmax=$rmax"
+    else                       maximumradius=""
+    fi
+    if [ x"$sigmaclip" = x ]; then finalsigmaclip=""
+    else                           finalsigmaclip="--sigmaclip=$sigmaclip";
+    fi
+    astscript-radial-profile $cropped_masked --hdu=1 $maximumradius \
+                             --measure=$normop $finalsigmaclip \
+                             --output=$radialprofile $quiet
+
+    # The normalization value is computed from the radial profile in between
+    # the two radius specified by the user. In this case, the option to give
+    # sigmaclip parameters to 'aststatistics' is different.
+    if [ x"$sigmaclip" = x ]; then finalsigmaclip=""
+    else                           finalsigmaclip="--sclipparams=$sigmaclip";
+    fi
+    normvalue=$(asttable $radialprofile $quiet \
+                         --range=1,$normradiusmin,$normradiusmax \
+                         | aststatistics --column=2 --$normop $finalsigmaclip 
-q)
+else
+    normvalue=1.0
 fi
-normvalue=$(asttable $radialprofile $quiet \
-                     --range=1,$normradiusmin,$normradiusmax \
-                     | aststatistics --column=2 --$normop $finalsigmaclip -q)
 
 
 



reply via email to

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