gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 509027d: New --ignoreblankinsky for NoiseChise


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 509027d: New --ignoreblankinsky for NoiseChisel and Statistics
Date: Sun, 29 Apr 2018 21:03:50 -0400 (EDT)

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

    New --ignoreblankinsky for NoiseChisel and Statistics
    
    Until now, NoiseChisel and Statistics would set all the pixels that are
    blank in the input to blank in the Sky and Sky standard deviation images
    also. This was good for visual inspection when the field isn't aligned with
    the rectangular image.
    
    But in some situations (for example when you have intentionally set some
    pixels to blank temporarily), you actually want the Sky and its standard
    deviation under the blank pixels also. With this new `--ignoreblankinsky'
    option, both NoiseChisel and Statistics will ignore the input's blank
    values when writing the output with the same size as the input
    (`--oneelempertile' wasn't called).
---
 NEWS                          |  4 ++++
 bin/noisechisel/args.h        | 13 +++++++++++++
 bin/noisechisel/main.h        |  1 +
 bin/noisechisel/noisechisel.c |  8 ++++----
 bin/noisechisel/ui.h          |  1 +
 bin/statistics/args.h         | 13 +++++++++++++
 bin/statistics/main.h         |  1 +
 bin/statistics/sky.c          |  9 +++++++--
 bin/statistics/ui.h           |  1 +
 doc/gnuastro.texi             | 16 ++++++++++++++++
 10 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index ae73509..ba39e32 100644
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,9 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
   NoiseChisel:
     --rawoutput: only output the detection labels and Sky and its STD.
+    --ignoreblankinsky: don't set the pixels that are blank in the input to
+      blank in the Sky and Sky standard deviation outputs (when
+      `--oneelempertile' is not called).
     --label: label the connected detections. Until now this was the default
       behavior. However, from this release, NoiseChisel is only in charge
       of detection. Segmentation is done by a new program (Segment). Since
@@ -65,6 +68,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
   Statistics:
     --manualbinrange: histogram or CFP range can be outside of distribution.
+    --ignoreblankinsky: similar to same option in NoiseChisel.
 
   Libraries:
     gal_array_read: read array from any of known formats (FITS,TIFF,JPEG,...).
diff --git a/bin/noisechisel/args.h b/bin/noisechisel/args.h
index d9df385..4d6a3f2 100644
--- a/bin/noisechisel/args.h
+++ b/bin/noisechisel/args.h
@@ -137,6 +137,19 @@ struct argp_option program_options[] =
 
     /* Output options. */
     {
+      "ignoreblankinsky",
+      UI_KEY_IGNOREBLANKINSKY,
+      0,
+      0,
+      "Don't write input's blanks in the Sky output.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->ignoreblankinsky,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
       "rawoutput",
       UI_KEY_RAWOUTPUT,
       0,
diff --git a/bin/noisechisel/main.h b/bin/noisechisel/main.h
index 05eb729..a2590bc 100644
--- a/bin/noisechisel/main.h
+++ b/bin/noisechisel/main.h
@@ -52,6 +52,7 @@ struct noisechiselparams
   char                  *whdu;  /* Wide kernel HDU.                       */
 
   uint8_t  continueaftercheck;  /* Don't abort after the check steps.     */
+  uint8_t    ignoreblankinsky;  /* Ignore input's blank values.           */
   uint8_t           rawoutput;  /* Only detection & 1 elem/tile output.   */
   uint8_t               label;  /* Label detections that are connected.   */
 
diff --git a/bin/noisechisel/noisechisel.c b/bin/noisechisel/noisechisel.c
index 04f6835..060b865 100644
--- a/bin/noisechisel/noisechisel.c
+++ b/bin/noisechisel/noisechisel.c
@@ -182,8 +182,8 @@ noisechisel_output(struct noisechiselparams *p)
   /* Write the Sky image into the output */
   if(p->sky->name) free(p->sky->name);
   p->sky->name="SKY";
-  gal_tile_full_values_write(p->sky, &p->cp.tl, 1, p->cp.output,
-                             NULL, PROGRAM_NAME);
+  gal_tile_full_values_write(p->sky, &p->cp.tl, !p->ignoreblankinsky,
+                             p->cp.output, NULL, PROGRAM_NAME);
   p->sky->name=NULL;
 
 
@@ -198,8 +198,8 @@ noisechisel_output(struct noisechiselparams *p)
   gal_fits_key_list_add(&keys, GAL_TYPE_FLOAT32, "MEDSTD", 0, &p->medstd, 0,
                         "Median raw tile standard deviation", 0,
                         p->input->unit);
-  gal_tile_full_values_write(p->std, &p->cp.tl, 1, p->cp.output, keys,
-                             PROGRAM_NAME);
+  gal_tile_full_values_write(p->std, &p->cp.tl, !p->ignoreblankinsky,
+                             p->cp.output, keys, PROGRAM_NAME);
   p->std->name=NULL;
 
   /* Let the user know that the output is written. */
diff --git a/bin/noisechisel/ui.h b/bin/noisechisel/ui.h
index 0c5e7b2..c3e72b2 100644
--- a/bin/noisechisel/ui.h
+++ b/bin/noisechisel/ui.h
@@ -94,6 +94,7 @@ enum option_keys_enum
   UI_KEY_CHECKDETECTION,
   UI_KEY_CHECKSKY,
   UI_KEY_RAWOUTPUT,
+  UI_KEY_IGNOREBLANKINSKY,
 };
 
 
diff --git a/bin/statistics/args.h b/bin/statistics/args.h
index 6b0fbb9..47beddf 100644
--- a/bin/statistics/args.h
+++ b/bin/statistics/args.h
@@ -520,6 +520,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "ignoreblankinsky",
+      UI_KEY_IGNOREBLANKINSKY,
+      0,
+      0,
+      "Don't write input's blanks in the Sky output.",
+      UI_GROUP_SKY,
+      &p->ignoreblankinsky,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
 
 
 
diff --git a/bin/statistics/main.h b/bin/statistics/main.h
index 01c437b..fe58f90 100644
--- a/bin/statistics/main.h
+++ b/bin/statistics/main.h
@@ -90,6 +90,7 @@ struct statisticsparams
   size_t       smoothwidth;  /* Width of flat kernel to smooth interpd.  */
   uint8_t         checksky;  /* Save the steps for deriving the Sky.     */
   double    sclipparams[2];  /* Muliple and parameter of sigma clipping. */
+  uint8_t ignoreblankinsky;  /* Ignore input's blank values.             */
 
 
   /* Internal */
diff --git a/bin/statistics/sky.c b/bin/statistics/sky.c
index ffd56c1..09be96f 100644
--- a/bin/statistics/sky.c
+++ b/bin/statistics/sky.c
@@ -251,8 +251,13 @@ sky(struct statisticsparams *p)
                                         ( p->cp.output
                                           ? p->cp.output
                                           : p->inputname ), "_sky.fits");
-  gal_tile_full_values_write(p->sky_t, tl, 1, outname, NULL, PROGRAM_NAME);
-  gal_tile_full_values_write(p->std_t, tl, 1, outname, NULL, PROGRAM_NAME);
+  p->sky_t->name="SKY";
+  p->std_t->name="SKY_STD";
+  gal_tile_full_values_write(p->sky_t, tl, !p->ignoreblankinsky, outname,
+                             NULL, PROGRAM_NAME);
+  gal_tile_full_values_write(p->std_t, tl, !p->ignoreblankinsky, outname,
+                             NULL, PROGRAM_NAME);
+  p->sky_t->name = p->std_t->name = NULL;
   if(!cp->quiet)
     printf("  - Written to `%s'.\n", outname);
 
diff --git a/bin/statistics/ui.h b/bin/statistics/ui.h
index e8d4bef..13efee9 100644
--- a/bin/statistics/ui.h
+++ b/bin/statistics/ui.h
@@ -95,6 +95,7 @@ enum option_keys_enum
   UI_KEY_MODMEDQDIFF,
   UI_KEY_SMOOTHWIDTH,
   UI_KEY_CHECKSKY,
+  UI_KEY_IGNOREBLANKINSKY,
   UI_KEY_SCLIPPARAMS,
 };
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 9868f89..270c037 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -13730,6 +13730,14 @@ discontinuities do not show up in the final Sky 
values. The smoothing is
 done through convolution (see @ref{Convolution process}) with a flat
 kernel, so the value to this option must be an odd number.
 
address@hidden --ignoreblankinsky
+Don't set the input's blank pixels to blank in the output Sky and Sky
+standard deviation datasets. This is only applicable when the output has
+the same size as the input, in other words, when @option{--oneelempertile}
+isn't called. By default, blank values in the input (commonly on the edges
+which are outside the survey/field area) will be set to blank in the output
+Sky and Sky standard deviation also.
+
 @item --checksky
 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
@@ -14614,6 +14622,14 @@ NoiseChisel will abort once its desired extensions 
have been written. With
 NoiseChisel to continue with the rest of the processing, even after the
 requested check files are complete.
 
address@hidden --ignoreblankinsky
+Don't set the input's blank pixels to blank in the output Sky and Sky
+standard deviation datasets. This is only applicable when the output has
+the same size as the input, in other words, when @option{--oneelempertile}
+isn't called. By default, blank values in the input (commonly on the edges
+which are outside the survey/field area) will be set to blank in the output
+Sky and Sky standard deviation also.
+
 @item -l
 @itemx --label
 Run a connected-components algorithm on the finally detected pixels to



reply via email to

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