[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master a6e1c50a 1/3: Arithmetic: only a 1D single num
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master a6e1c50a 1/3: Arithmetic: only a 1D single number will be printed on terminal |
Date: |
Thu, 10 Feb 2022 19:51:08 -0500 (EST) |
branch: master
commit a6e1c50a16211540ae3608a2d51452acbd32bce9
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Arithmetic: only a 1D single number will be printed on terminal
Until now, when Arithmetic ends up with a single number, it will simply
print the number on the command-line. This is good for a 1 dimensional,
single-valued dataset; but when the dataset can have multiple dimensions,
it is annoying. For example the command below will fail to create a 2D
image with a single element:
astarithmetic 1 1 2 makenew
With this commit, the following two conditions have been added for printing
the value on the command-line: the dataset has to be one-dimensional, and
the '--onedasimage' should be called.
---
bin/arithmetic/arithmetic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index a5ac86bc..ca85023a 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -1483,7 +1483,7 @@ reversepolish(struct arithmeticparams *p)
/* If the final data structure has more than one element, write it as a
FITS file. Otherwise, print it in the standard output. */
data=p->operands->data;
- if(data->size==1)
+ if(data->size==1 && data->ndim==1 && p->onedasimage==0)
{
/* Make the string to print the number. */
printnum=gal_type_to_string(data->array, data->type, 0);