gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 4d3b55a2: astscript-fits-view: not accounting


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 4d3b55a2: astscript-fits-view: not accounting for different HDUs bug fixed
Date: Thu, 14 Dec 2023 06:22:02 -0500 (EST)

branch: master
commit 4d3b55a28b60ddf0ace3b6f469de9c1695c1e66f
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Raul Infante-Sainz <infantesainz@gmail.com>

    astscript-fits-view: not accounting for different HDUs bug fixed
    
    Until this commit, this script was not able to account for different HDUs.
    It only considered the last HDU provided from the command line.
    
    With this commit, this bug has been fixed. Now when specifying different
    HDU numbers or names, they are properly accounted for.
    
    This fixes bug #64825, reported by Teet Kuutma:
    https://savannah.gnu.org/bugs/?64825
---
 bin/script/fits-view.sh | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/bin/script/fits-view.sh b/bin/script/fits-view.sh
index fac079e6..b3b63a71 100644
--- a/bin/script/fits-view.sh
+++ b/bin/script/fits-view.sh
@@ -8,6 +8,7 @@
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # All author(s):
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+#     Raul Infante-Sainz <infantesainz@gmail.com>
 #     Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
 # Copyright (C) 2020-2023 Free Software Foundation, Inc.
 #
@@ -191,9 +192,9 @@ do
     case "$1" in
 
         # Input options
-        -h|--hdu)             hdu="$2";                            check_v 
"$1" "$hdu"; shift;shift;;
-        -h=*|--hdu=*)         hdu="${1#*=}";                       check_v 
"$1" "$hdu"; shift;;
-        -h*)                  hdu=$(echo "$1"  | sed -e's/-h//');  check_v 
"$1" "$hdu"; shift;;
+        -h|--hdu)            aux="$2";                             check_v 
"$1" "$aux"; hdu="$hdu $aux"; shift;shift;;
+        -h=*|--hdu=*)        aux="${1#*=}";                        check_v 
"$1" "$aux"; hdu="$hdu $aux"; shift;;
+        -h*)                 aux="$(echo "$1"  | sed -e's/-h//')"; check_v 
"$1" "$aux"; hdu="$hdu $aux"; shift;;
 
         # Output options
         -g|--ds9geometry)     ds9geometry="$2";                    check_v 
"$1" "$ds9geometry"; shift;shift;;
@@ -381,8 +382,13 @@ else
                 if [ x"$hdu" = x ]; then
                     inwithhdu="$inputs"
                 else
+                    c=1
                     inwithhdu=""
-                    for i in $inputs; do inwithhdu="$inwithhdu $i[$hdu]"; done
+                    for i in $inputs; do
+                        h=$(echo $hdu | awk -vc=$c '{print $c}')
+                        inwithhdu="$inwithhdu $i[$h]"
+                        c=$((c+1))
+                    done
                 fi
 
                 # Read the number of dimensions.
@@ -464,8 +470,13 @@ else
                 if [ x"$hdu" = x ]; then
                 inwithhdu="$inputs"
                 else
+                    c=1
                     inwithhdu=""
-                    for i in $inputs; do inwithhdu="$inwithhdu $i#$hdu"; done
+                    for i in $inputs; do
+                        h=$(echo $hdu | awk -vc=$c '{print $c}')
+                        inwithhdu="$inwithhdu $i#$h"
+                        c=$((c+1))
+                    done
                 fi
 
                 # TOPCAT command.



reply via email to

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