[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 9f8488a0: astscript-color-faint-gray: fixed bu
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 9f8488a0: astscript-color-faint-gray: fixed bug with weights of differing type |
Date: |
Fri, 26 Jan 2024 06:12:26 -0500 (EST) |
branch: master
commit 9f8488a0ee5e9be9879155c693610b6d68f98928
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
astscript-color-faint-gray: fixed bug with weights of differing type
Until now, the script crashed when the user provided weights in different
data type formats. For example, if the user provides '-w1 -w1 -w1.5', two
of them are integers, while one is floating point. One of the Arithmetic
calls within the script would crash; complaining about different data
types.
With this commit, this bug has been fixed by forcing to consider the
weights as floating point numbers ('f32') in the step that they are
used. This problem was reported by Sepideh Eskandarlou.
---
bin/script/color-faint-gray.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/script/color-faint-gray.sh b/bin/script/color-faint-gray.sh
index 41321dfd..db2fdad1 100644
--- a/bin/script/color-faint-gray.sh
+++ b/bin/script/color-faint-gray.sh
@@ -618,10 +618,10 @@ gscaled="$tmpdir/G_scaled.fits"
bscaled="$tmpdir/B_scaled.fits"
# Compute normalized weights
-weight_sum=$(astarithmetic $rweight $gweight $bweight 3 sum --type=f32 -q)
-rweight_sum=$(astarithmetic $rweight $weight_sum / -q | awk '{printf "%.4f",
$1}')
-gweight_sum=$(astarithmetic $gweight $weight_sum / -q | awk '{printf "%.4f",
$1}')
-bweight_sum=$(astarithmetic $bweight $weight_sum / -q | awk '{printf "%.4f",
$1}')
+weight_sum=$(astarithmetic $rweight f32 $gweight f32 $bweight f32 3 sum
--type=f32 -q)
+rweight_sum=$(astarithmetic $rweight f32 $weight_sum / -q | awk '{printf
"%.4f", $1}')
+gweight_sum=$(astarithmetic $gweight f32 $weight_sum / -q | awk '{printf
"%.4f", $1}')
+bweight_sum=$(astarithmetic $bweight f32 $weight_sum / -q | awk '{printf
"%.4f", $1}')
wmax=$(astarithmetic $rweight_sum $gweight_sum $bweight_sum 3 max --type=f32
-q)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 9f8488a0: astscript-color-faint-gray: fixed bug with weights of differing type,
Mohammad Akhlaghi <=