gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 4f3be6ab: Statistics: new --checkskynointerp t


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 4f3be6ab: Statistics: new --checkskynointerp to avoid interpolation and smoothing
Date: Sat, 13 Jan 2024 22:07:25 -0500 (EST)

branch: master
commit 4f3be6ab8c8c224d68dd1f6c6978bbb8b778e9e1
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Statistics: new --checkskynointerp to avoid interpolation and smoothing
    
    Until now, the only way to access the good tile values for sky measurements
    of Statistics was the '--checksky' option. However, this would also do
    interpolation and smoothing (which could take a significant amount of time.
    
    With this commit, to avoid wasting time in such cases, this new option has
    been added which will abort Statistics once the good tiles have been
    identified.
---
 NEWS                  |  3 +++
 bin/statistics/args.h | 13 +++++++++++++
 bin/statistics/main.h |  1 +
 bin/statistics/sky.c  |  5 +++++
 bin/statistics/ui.c   |  7 ++++++-
 bin/statistics/ui.h   |  1 +
 doc/gnuastro.texi     |  5 +++++
 7 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 058fbf41..d2415cbb 100644
--- a/NEWS
+++ b/NEWS
@@ -90,6 +90,9 @@ See the end of the file for license conditions.
     verification.
 
 *** Statistics
+  --checkskynointerp: similar to '--checksky', but stop as soon as the good
+    tiles are found (do not continue to interpolation and smoothing of the
+    tiles which can be time consuming if not needed).
   --mad: Median Absolute Deviation (MAD) of input dataset.
   --madclip: MAD-clipping, showing intermediate results.
   --sigclip-mad: MAD of input after sigma-clipping.
diff --git a/bin/statistics/args.h b/bin/statistics/args.h
index f3b3f06f..d2468274 100644
--- a/bin/statistics/args.h
+++ b/bin/statistics/args.h
@@ -773,6 +773,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "checkskynointerp",
+      UI_KEY_CHECKSKYNOINTERP,
+      0,
+      0,
+      "Similar to --checksky, stops at interpolation.",
+      UI_GROUP_SKY,
+      &p->checkskynointerp,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
     {
       "ignoreblankintiles",
       UI_KEY_IGNOREBLANKINTILES,
diff --git a/bin/statistics/main.h b/bin/statistics/main.h
index c4a35bbe..ab79ac4e 100644
--- a/bin/statistics/main.h
+++ b/bin/statistics/main.h
@@ -114,6 +114,7 @@ struct statisticsparams
   double   outliersclip[2];  /* Outlier Sigma-clipping params.           */
   size_t       smoothwidth;  /* Width of flat kernel to smooth interpd.  */
   uint8_t         checksky;  /* Save the steps for deriving the Sky.     */
+  uint8_t checkskynointerp;  /* Stop --checksky before interpolation.    */
   double    sclipparams[2];  /* Muliple and parameter of sigma clipping. */
   double    mclipparams[2];  /* Muliple and parameter of sigma clipping. */
   uint8_t ignoreblankintiles;/* Ignore input's blank values.             */
diff --git a/bin/statistics/sky.c b/bin/statistics/sky.c
index 459af594..200ec04e 100644
--- a/bin/statistics/sky.c
+++ b/bin/statistics/sky.c
@@ -226,6 +226,11 @@ sky(struct statisticsparams *p)
                                       p->outliersigma, p->checkskyname,
                                       "--outliernumngb");
 
+  /* If the user only wants the sky level to this step, don't bother with
+     the rest (note that 'p->checksky' was activated in 'ui.c').  */
+  if(p->checkskynointerp)
+    exit(EXIT_SUCCESS);
+
 
   /* Interpolate the Sky and its standard deviation. */
   if(!cp->quiet) gettimeofday(&t1, NULL);
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index 1edcb033..e5c88f47 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -604,6 +604,11 @@ ui_check_only_options(struct statisticsparams *p)
         }
     }
 
+  /* In case '--checkskynointep' is given, we want everything to be similar
+     to '--checksky' in the initial phases (when necessary, we will
+     check 'p->checkskynointerp'. */
+  if(p->checkskynointerp) p->checksky=1;
+
   /* Reverse the list of statistics to print in one row and also the
      arguments, so it has the same order the user wanted. */
   gal_list_f64_reverse(&p->tp_args);
@@ -1210,7 +1215,7 @@ ui_preparations(struct statisticsparams *p)
           gal_data_free(check);
         }
 
-      /* Set the steps image name. */
+      /* Set the check-sky output name;  */
       if(p->sky && p->checksky)
         p->checkskyname=gal_checkset_automatic_output(cp, checkbasename,
                                                       "_sky_steps.fits");
diff --git a/bin/statistics/ui.h b/bin/statistics/ui.h
index 0cab17d5..06d7a7b9 100644
--- a/bin/statistics/ui.h
+++ b/bin/statistics/ui.h
@@ -106,6 +106,7 @@ enum option_keys_enum
   UI_KEY_OUTLIERSCLIP,
   UI_KEY_SMOOTHWIDTH,
   UI_KEY_CHECKSKY,
+  UI_KEY_CHECKSKYNOINTERP,
   UI_KEY_IGNOREBLANKINTILES,
   UI_KEY_SCLIPPARAMS,
   UI_KEY_MCLIPPARAMS,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 768e6083..cd433039 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -27660,6 +27660,11 @@ But in other scenarios this default behavior is not 
desired; for example, if you
 Create a multi-extension FITS file showing the steps that were used to 
estimate the Sky value over the input, see @ref{Quantifying signal in a tile}.
 The file will have two extensions for each step (one for the Sky and one for 
the Sky standard deviation).
 
+@item --checkskynointerp
+Similar to @code{--checksky}, but it will stop as soon as the outlier tiles 
have been identified and before it interpolates the values to cover the whole 
image.
+
+This is useful when you want the good tile values before interpolation, and 
don't want to slow down your pipeline with the extra computing that 
interpolation and smoothing require.
+
 @end table
 
 @node NoiseChisel, Segment, Statistics, Data analysis



reply via email to

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