gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master a70d144: Statistics check images in output dir


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master a70d144: Statistics check images in output directory if given
Date: Sun, 29 Jul 2018 13:58:02 -0400 (EDT)

branch: master
commit a70d144da6c2bff8361ba83153e641bcc03f4cd5
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Statistics check images in output directory if given
    
    Throughout Gnuastro, when an output is specified, the check images are
    written in the same directory. However, until now implementing this in the
    Statistics program was forgotten! With this commit, Statistics also puts
    the check images (for tiles and sky value) in the same directory that
    contains the output file (if an output is given).
---
 bin/statistics/ui.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index edf2e85..03242f9 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -791,8 +791,13 @@ void
 ui_preparations(struct statisticsparams *p)
 {
   gal_data_t *check;
+  int keepinputdir=p->cp.keepinputdir;
   struct gal_options_common_params *cp=&p->cp;
   struct gal_tile_two_layer_params *tl=&cp->tl;
+  char *checkbasename = p->cp.output ? p->cp.output : p->inputname;
+
+  /* Change `keepinputdir' based on if an output name was given. */
+  p->cp.keepinputdir = p->cp.output ? 1 : 0;
 
   /* Read the input. */
   if(p->isfits && p->hdu_type==IMAGE_HDU)
@@ -824,7 +829,7 @@ ui_preparations(struct statisticsparams *p)
       /* Make the tile check image if requested. */
       if(tl->checktiles)
         {
-          tl->tilecheckname=gal_checkset_automatic_output(cp, p->inputname,
+          tl->tilecheckname=gal_checkset_automatic_output(cp, checkbasename,
                                                           "_tiled.fits");
           check=gal_tile_block_check_tiles(tl->tiles);
           if(p->inputformat==INPUT_FORMAT_IMAGE)
@@ -841,7 +846,7 @@ ui_preparations(struct statisticsparams *p)
 
       /* Set the steps image name. */
       if(p->sky && p->checksky)
-        p->checkskyname=gal_checkset_automatic_output(cp, p->inputname,
+        p->checkskyname=gal_checkset_automatic_output(cp, checkbasename,
                                                       "_sky_steps.fits");
     }
 
@@ -875,6 +880,9 @@ ui_preparations(struct statisticsparams *p)
       if( !isnan(p->mirror) )             ++p->numoutfiles;
       if( p->histogram || p->cumulative ) ++p->numoutfiles;
     }
+
+  /* Reset `keepinputdir' to what it originally was. */
+  p->cp.keepinputdir=keepinputdir;
 }
 
 



reply via email to

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