[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master fe719ea0: Statistics: directory of output resp
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master fe719ea0: Statistics: directory of output respected with --ontile |
Date: |
Sun, 9 Jun 2024 17:53:55 -0400 (EDT) |
branch: master
commit fe719ea09fd693dc8cd3bca76d8774cf4fdb3dc3
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Statistics: directory of output respected with --ontile
Until now, when the Statistics program was called with '--oneline', and the
output was not in the running directory, the output's directory would be
ignored and the file is created in the running directory!
With this commit, the problem was solved by temporarily changing an
internal variable (the internal 'keepinputdir' which does not apply to this
scenario; as in the '--sky' opiton of Statistics).
This fixes bug #65862.
---
NEWS | 3 +++
bin/statistics/statistics.c | 18 ++++++++++++++----
bin/statistics/ui.c | 2 ++
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 5c124049..1027cb77 100644
--- a/NEWS
+++ b/NEWS
@@ -210,6 +210,9 @@ See the end of the file for license conditions.
- bug #65853: Statistics crashes with the --ontile option.
+ - bug #65862: Output directory ignored when Statistics is called with
+ the '--ontile' option.
+
diff --git a/bin/statistics/statistics.c b/bin/statistics/statistics.c
index baae8abf..d60f8ff0 100644
--- a/bin/statistics/statistics.c
+++ b/bin/statistics/statistics.c
@@ -497,13 +497,23 @@ statistics_on_tile(struct statisticsparams *p)
gal_data_t *tile, *values;
size_t tind, dsize=1, mind=-1;
uint8_t type=GAL_TYPE_INVALID;
+ uint8_t keepinputdir=p->cp.keepinputdir;
gal_data_t *tmp=NULL, *tmpv=NULL, *ttmp;
struct gal_options_common_params *cp=&p->cp;
struct gal_tile_two_layer_params *tl=&p->cp.tl;
- char *output=gal_checkset_automatic_output(cp, cp->output
- ? cp->output
- : p->inputname,
- "_ontile.fits");
+ char *output;
+
+ /* Save the Sky and its standard deviation. We want the output to have a
+ '_sky.fits' suffix. So we'll temporarily re-set 'p->cp.keepinputdir'
+ if the user asked for a specific name. Note that we copied the actual
+ value in the 'keepinputdir' above (in the definition). */
+ p->cp.keepinputdir = p->cp.output ? 1 : keepinputdir;
+ output=gal_checkset_automatic_output(cp,
+ ( cp->output
+ ? cp->output
+ : p->inputname ),
+ "_ontile.fits");
+ p->cp.keepinputdir=keepinputdir;
/* Do the operation on each tile. */
for(operation=p->singlevalue; operation!=NULL; operation=operation->next)
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index 41966e9a..8cb1700d 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -404,6 +404,7 @@ ui_check_only_options(struct statisticsparams *p)
gal_list_i32_t *tmp;
struct gal_tile_two_layer_params *tl=&p->cp.tl;
+
/* Check if the format of the output table is valid, given the type of
the output. */
gal_tableintern_check_fits_format(p->cp.output, p->cp.tableformat);
@@ -415,6 +416,7 @@ ui_check_only_options(struct statisticsparams *p)
"(for example '--median') must be requested with the '--ontile' "
"option: there is no value to put in each tile");
+
/* Tessellation related options. */
if( p->ontile || p->sky )
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master fe719ea0: Statistics: directory of output respected with --ontile,
Mohammad Akhlaghi <=