gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 884991f4: psf-scale-factor: optionally saving


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 884991f4: psf-scale-factor: optionally saving result in output file
Date: Tue, 6 Sep 2022 08:24:55 -0400 (EDT)

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

    psf-scale-factor: optionally saving result in output file
    
    Until now, this script was not saving the output result into the output
    file, even when it was provided with the option '--output'. This was simply
    because a final step to write the result into the output file was missing,
    and it was always being printed on standard output.
    
    With this commit, this bug has been fixed. If the user provides a filename
    to '--output' (in which the result should be kept), the scale factor number
    will be written in that output file (in plain-text).
    
    This fixes bug #63022.
---
 NEWS                           |  2 ++
 bin/script/psf-scale-factor.in | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 68e1eb3a..8251eda9 100644
--- a/NEWS
+++ b/NEWS
@@ -180,6 +180,8 @@ See the end of the file for license conditions.
               equal sign in long format. Found by Faezeh Bijarchian.
   bug #63013: Sigma clip segmentation fault when input has an integer type
               with values close to saturation-level.
+  bug #63022: psf-scale-factor not saving the result in the output file,
+              found and fixed by Raul Infante-Sainz.
 
 
 
diff --git a/bin/script/psf-scale-factor.in b/bin/script/psf-scale-factor.in
index 632b4a95..fe91b77b 100644
--- a/bin/script/psf-scale-factor.in
+++ b/bin/script/psf-scale-factor.in
@@ -614,8 +614,18 @@ astarithmetic $cropped -h1 set-i \
               $psfcropped -h1 set-p \
               $radcropped -h1 set-r \
               r $normradiusmin lt r $normradiusmax ge or set-m \
-              i p / m nan where -o$multipimg $quiet
-aststatistics $multipimg --sclipparams=$sigmaclip  --sigclip-median
+              i p / m nan where --output $multipimg $quiet
+multifactor=$(aststatistics $multipimg --sigclip-median \
+                            --sclipparams=$sigmaclip --quiet)
+
+
+
+
+
+# Print the multiplication factor in standard output or in a given file
+if [ x"$output" = x ]; then echo $multifactor
+else                        echo $multifactor > $output
+fi
 
 
 



reply via email to

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