[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 61c9d302: ds9-region: properly quoting units t
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 61c9d302: ds9-region: properly quoting units to print name columns |
Date: |
Fri, 5 May 2023 15:40:29 -0400 (EDT) |
branch: master
commit 61c9d3026c78804aef096228bcf80f611cee865e
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
ds9-region: properly quoting units to print name columns
Until now, when run in image-mode and given the '--namecol' option, this
script simply printed a zero for the name (ignoring any value!). However,
in WCS-mode, there was no problem and the name was printed.
This happened because DS9's region file format requires a double-quotation
(") for showing the arc-seconds nature of the region size in
WCS-mode. However, in image-mode, it doesn't need anything. As a result, we
would just put the empty string there. However, 'printf' would not "see"
the empty string in image-mode and use the name column instead of units!
With this commit, the problem was solved by placing the 'unit' variable
within double quotations. Therefore, even when it is an empty string,
'printf' will "see" it and put the empty string instead of units. As a
result, it will print the name column in its proper place.
This bug was reported by Zahra Sharbaf.
This fixes bug #64153.
---
NEWS | 2 ++
bin/script/ds9-region.in | 13 ++++++++-----
doc/announce-acknowledge.txt | 1 +
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 0f23ee0c..e881fd96 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,8 @@ See the end of the file for license conditions.
bug #64148: MakeCatalog crash when using the options '--std' and/or
'sigclip-mean-sb-delta' for clumps catalog. Reported by Raul
Infante-Sainz.
+ bug #64153: astscript-ds9-region: '--namecol' gives a constant zero in
+ image-mode. Reported by Zahra Sharbaf.
diff --git a/bin/script/ds9-region.in b/bin/script/ds9-region.in
index 9b939252..352fa13f 100644
--- a/bin/script/ds9-region.in
+++ b/bin/script/ds9-region.in
@@ -327,20 +327,23 @@ else printf "image\n" >> $out; fi
# Write each region's results (when no input file is given, read from the
-# standard input).
+# standard input). Note that the 'unit' string will be empty in image-mode
+# coordinates. As a result, it we don't enclose it in double-quotations,
+# 'printf' will not see anything and use the next variable where the unit
+# should be printed! See https://savannah.gnu.org/bugs/index.php?64153
if [ x"$namecol" = x ]; then
if [ x"$inputs" = x ]; then
cat /dev/stdin \
| asttable --column=$col \
| while read a b; do \
printf "circle(%f,%f,%f%s)\n" \
- $a $b $radius $unit >> $out; \
+ $a $b $radius "$unit" >> $out; \
done
else
asttable $inputs --hdu=$hdu --column=$col \
| while read a b; do \
printf "circle(%f,%f,%f%s)\n" \
- $a $b $radius $unit >> $out; \
+ $a $b $radius "$unit" >> $out; \
done
fi
else
@@ -349,13 +352,13 @@ else
| asttable --column=$col --column=$namecol \
| while read a b c; do \
printf "circle(%f,%f,%f%s) # text={%g}\n" \
- $a $b $radius $unit $c >> $out; \
+ $a $b $radius "$unit" $c >> $out; \
done
else
asttable $inputs --hdu=$hdu --column=$col --column=$namecol \
| while read a b c; do \
printf "circle(%f,%f,%f%s) # text={%g}\n" \
- $a $b $radius $unit $c >> $out; \
+ $a $b $radius "$unit" $c >> $out; \
done
fi
fi
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 1224e75c..60b42c0f 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -2,6 +2,7 @@ Alphabetically ordered list to acknowledge in the next release.
Irene Pintos Castro
Raul Infante-Sainz
+Zahra Sharbaf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 61c9d302: ds9-region: properly quoting units to print name columns,
Mohammad Akhlaghi <=