gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 31aee864: NoiseChisel: no. tiles for outliers


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 31aee864: NoiseChisel: no. tiles for outliers given through --outliernumngb
Date: Sat, 5 Nov 2022 21:54:04 -0400 (EDT)

branch: master
commit 31aee8645ec05340f65b86f2cd05d38647baf1dc
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    NoiseChisel: no. tiles for outliers given through --outliernumngb
    
    Until now, the number of tiles used for identifying outlier tiles (on the
    wings of bright galaxies) was given through the '--interpnumngb'
    option. But as the name suggests, '--interpnumngb' is for the number of
    tiles to use for the interpolation phase. Using the same value for outlier
    rejection was both confusing and made it hard to customize in some
    situations (since interpolation is done after outlier rejection).
    
    With this commit, we now have a new option called '--outliernumngb' that is
    only for identifying the number of tiles for finding outliers. The number
    of neighboring tiles for interpolation is now uniquely for interpolation.
    
    Therefore '--outliernumngb' is now the most imporant option to change when
    the outer wings of bright galaxies/stars are not detected.
    
    This was done after a discussion with Elham Saremi.
---
 NEWS                                  | 16 +++++++++++
 bin/noisechisel/args.h                | 13 +++++++++
 bin/noisechisel/astnoisechisel.conf   |  1 +
 bin/noisechisel/main.h                |  1 +
 bin/noisechisel/threshold.c           | 14 ++++++----
 bin/noisechisel/ui.h                  |  5 ++--
 bin/statistics/args.h                 | 13 +++++++++
 bin/statistics/aststatistics.conf     |  1 +
 bin/statistics/main.h                 |  1 +
 bin/statistics/sky.c                  | 10 ++++---
 bin/statistics/ui.h                   | 46 ++++++++++++++++----------------
 doc/gnuastro.texi                     | 50 ++++++++++++++++++++++-------------
 lib/gnuastro-internal/tile-internal.h |  3 ++-
 lib/tile-internal.c                   | 17 +++++++-----
 14 files changed, 130 insertions(+), 61 deletions(-)

diff --git a/NEWS b/NEWS
index 6c679098..0188e91e 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,22 @@ See the end of the file for license conditions.
    --metaname: Specify the name of the cropped output HDU (value to the
      'EXTNAME' keyword in FITS).
 
+   NoiseChisel:
+   --outliernumngb: the number of neighboring tiles to reject those that
+     have passed (the mean-median quantile difference criteria) because of
+     being on the wings of bright stars/galaxies. Until now, this number
+     was the same as the number given to '--interpnumngb', but it is
+     confusing and can cause problems (because interpolation is done after
+     outlier rejection). From this version, '--interpnumngb' is only in
+     charge of the number of neighboring tiles for interpolation outliers
+     are defined based on the number of tiles given to this
+     option. Therefore, if you are not detecting the wings of large
+     galaxies, THE BEST solution is most-probably to increase
+     '--outliernumngb'. This was done after a discussion with Elham Saremi.
+
+   Statistics:
+   --outliernumngb: see description of same option in NoiseChisel.
+
    Library:
    - GAL_ARITHMETIC_OP_SWAP: swap the top two operands.
    - GAL_ARITHMETIC_OP_INDEX: An index (counting from 0) for every element.
diff --git a/bin/noisechisel/args.h b/bin/noisechisel/args.h
index 88d3ac33..a9614357 100644
--- a/bin/noisechisel/args.h
+++ b/bin/noisechisel/args.h
@@ -211,6 +211,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "outliernumngb",
+      UI_KEY_OUTLIERNUMNGB,
+      "INT",
+      0,
+      "Num neighboring tiles to look for outlier.",
+      UI_GROUP_DETECTION,
+      &p->outliernumngb,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GE_0,
+      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
     {
       "outliersclip",
       UI_KEY_OUTLIERSCLIP,
diff --git a/bin/noisechisel/astnoisechisel.conf 
b/bin/noisechisel/astnoisechisel.conf
index 40a6da47..cdaa4a56 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -30,6 +30,7 @@
 # Detection:
  meanmedqdiff         0.01
  qthresh               0.3
+ outliernumngb          15
  outliersigma            5
  outliersclip        3,0.2
  smoothwidth             5
diff --git a/bin/noisechisel/main.h b/bin/noisechisel/main.h
index d52fca4a..64446071 100644
--- a/bin/noisechisel/main.h
+++ b/bin/noisechisel/main.h
@@ -58,6 +58,7 @@ struct noisechiselparams
 
   float          meanmedqdiff;  /* Difference between mode and median.    */
   float               qthresh;  /* Quantile threshold on convolved image. */
+  size_t        outliernumngb;  /* Number of neighbors to define outliers.*/
   float          outliersigma;  /* Multiple of sigma to define outlier.   */
   double      outliersclip[2];  /* Outlier Sigma-clipping params.         */
   size_t          smoothwidth;  /* Interpolation: flat kernel to smooth.  */
diff --git a/bin/noisechisel/threshold.c b/bin/noisechisel/threshold.c
index a51d78c2..b3364849 100644
--- a/bin/noisechisel/threshold.c
+++ b/bin/noisechisel/threshold.c
@@ -533,6 +533,8 @@ threshold_good_error(size_t number, int before0_after1, 
size_t interpnumngb)
                   "(where the number may decrease even further).");
   char *in3 = ( before0_after1
                 ? "\n"
+                  "  - (slightly) Decrease '--outliernumngb' to use less "
+                  "tiles to find outliers.\n"
                   "  - (slightly) Increase '--outliersclip' to reject less "
                   "as outliers.\n"
                   "  - (slightly) Increase '--outliersigma' to reject less "
@@ -670,11 +672,13 @@ threshold_quantile_find_apply(struct noisechiselparams *p)
 
 
   /* Remove the outliers. */
-  gal_tileinternal_no_outlier_local(qprm.erode_th, qprm.noerode_th,
-                                    qprm.expand_th, &cp->tl,
-                                    cp->interpmetric, cp->interpnumngb,
-                                    cp->numthreads, p->outliersclip,
-                                    p->outliersigma, p->qthreshname);
+  if(p->outliernumngb)
+    gal_tileinternal_no_outlier_local(qprm.erode_th, qprm.noerode_th,
+                                      qprm.expand_th, &cp->tl,
+                                      cp->interpmetric, p->outliernumngb,
+                                      cp->numthreads, p->outliersclip,
+                                      p->outliersigma, p->qthreshname,
+                                      "--outliernumngb");
 
 
   /* Use the no-outlier grid as a basis for later estimating the sky. To
diff --git a/bin/noisechisel/ui.h b/bin/noisechisel/ui.h
index a432cedb..51ab394d 100644
--- a/bin/noisechisel/ui.h
+++ b/bin/noisechisel/ui.h
@@ -50,7 +50,7 @@ enum program_args_groups
 
 /* Available letters for short options:
 
-   a b f g i j n r u v x y z
+   b f g i j n r u v x y z
    A E G H J O W X Y
 */
 enum option_keys_enum
@@ -71,7 +71,7 @@ enum option_keys_enum
   UI_KEY_DETGROWQUANT       = 'd',
   UI_KEY_CONTINUEAFTERCHECK = 'C',
   UI_KEY_LABEL              = 'l',
-
+  UI_KEY_OUTLIERNUMNGB      = 'a',
 
   /* Only with long version (start with a value 1000, the rest will be set
      automatically). */
@@ -82,7 +82,6 @@ enum option_keys_enum
   UI_KEY_MINNUMFALSE,
   UI_KEY_SMOOTHWIDTH,
   UI_KEY_QTHRESHTILEQUANT,
-  UI_KEY_OUTLIERNUM,
   UI_KEY_OUTLIERSIGMA,
   UI_KEY_OUTLIERSCLIP,
   UI_KEY_CHECKQTHRESH,
diff --git a/bin/statistics/args.h b/bin/statistics/args.h
index 9a22e980..f5ed2414 100644
--- a/bin/statistics/args.h
+++ b/bin/statistics/args.h
@@ -568,6 +568,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "outliernumngb",
+      UI_KEY_OUTLIERNUMNGB,
+      "INT",
+      0,
+      "Num neighboring tiles to look for outlier.",
+      UI_GROUP_SKY,
+      &p->outliernumngb,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GE_0,
+      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
     {
       "outliersclip",
       UI_KEY_OUTLIERSCLIP,
diff --git a/bin/statistics/aststatistics.conf 
b/bin/statistics/aststatistics.conf
index 7b5bdcc9..d8d62f8c 100644
--- a/bin/statistics/aststatistics.conf
+++ b/bin/statistics/aststatistics.conf
@@ -24,6 +24,7 @@
 # Sky and its STD settings
  khdu                 1
  meanmedqdiff      0.01
+ outliernumngb       15
  outliersigma         5
  outliersclip     3,0.2
  smoothwidth          3
diff --git a/bin/statistics/main.h b/bin/statistics/main.h
index ab591f51..7f63a9a5 100644
--- a/bin/statistics/main.h
+++ b/bin/statistics/main.h
@@ -108,6 +108,7 @@ struct statisticsparams
   char         *kernelname;  /* File name of kernel to convolve input.   */
   char               *khdu;  /* Kernel HDU.                              */
   float       meanmedqdiff;  /* Mode and median quantile difference.     */
+  size_t     outliernumngb;  /* Number of neighbors to define outliers.  */
   float       outliersigma;  /* Multiple of sigma to define outlier.     */
   double   outliersclip[2];  /* Outlier Sigma-clipping params.           */
   size_t       smoothwidth;  /* Width of flat kernel to smooth interpd.  */
diff --git a/bin/statistics/sky.c b/bin/statistics/sky.c
index bc470a28..f1b8f4cc 100644
--- a/bin/statistics/sky.c
+++ b/bin/statistics/sky.c
@@ -212,10 +212,12 @@ sky(struct statisticsparams *p)
 
 
   /* Remove outliers if requested. */
-  gal_tileinternal_no_outlier_local(p->sky_t, p->std_t, NULL, &cp->tl,
-                                    cp->interpmetric, cp->interpnumngb,
-                                    cp->numthreads, p->outliersclip,
-                                    p->outliersigma, p->checkskyname);
+  if(p->outliernumngb)
+    gal_tileinternal_no_outlier_local(p->sky_t, p->std_t, NULL, &cp->tl,
+                                      cp->interpmetric, p->outliernumngb,
+                                      cp->numthreads, p->outliersclip,
+                                      p->outliersigma, p->checkskyname,
+                                      "--outliernumngb");
 
 
   /* Interpolate the Sky and its standard deviation. */
diff --git a/bin/statistics/ui.h b/bin/statistics/ui.h
index 3e699e0b..d5175e23 100644
--- a/bin/statistics/ui.h
+++ b/bin/statistics/ui.h
@@ -46,33 +46,34 @@ enum program_args_groups
 
 /* Available letters for short options:
 
-   a b e j r v w x z
+   b e j r v w x z
    B G J L W X Y
 */
 enum option_keys_enum
 {
   /* With short-option version. */
-  UI_KEY_COLUMN       = 'c',
-  UI_KEY_GREATEREQUAL = 'g',
-  UI_KEY_LESSTHAN     = 'l',
-  UI_KEY_QRANGE       = 'Q',
-  UI_KEY_MEAN         = 'm',
-  UI_KEY_STD          = 'd',
-  UI_KEY_MEDIAN       = 'E',
-  UI_KEY_MODE         = 'O',
-  UI_KEY_QUANTILE     = 'u',
-  UI_KEY_ASCIIHIST    = 'A',
-  UI_KEY_HISTOGRAM    = 'H',
-  UI_KEY_CUMULATIVE   = 'C',
-  UI_KEY_SIGMACLIP    = 's',
-  UI_KEY_NORMALIZE    = 'n',
-  UI_KEY_ONTILE       = 't',
-  UI_KEY_INTERPOLATE  = 'i',
-  UI_KEY_SKY          = 'y',
-  UI_KEY_KERNEL       = 'k',
-  UI_KEY_CONTOUR      = 'R',
-  UI_KEY_FIT          = 'f',
-  UI_KEY_FITMAXPOWER  = 'p',
+  UI_KEY_COLUMN        = 'c',
+  UI_KEY_GREATEREQUAL  = 'g',
+  UI_KEY_LESSTHAN      = 'l',
+  UI_KEY_QRANGE        = 'Q',
+  UI_KEY_MEAN          = 'm',
+  UI_KEY_STD           = 'd',
+  UI_KEY_MEDIAN        = 'E',
+  UI_KEY_MODE          = 'O',
+  UI_KEY_QUANTILE      = 'u',
+  UI_KEY_ASCIIHIST     = 'A',
+  UI_KEY_HISTOGRAM     = 'H',
+  UI_KEY_CUMULATIVE    = 'C',
+  UI_KEY_SIGMACLIP     = 's',
+  UI_KEY_NORMALIZE     = 'n',
+  UI_KEY_ONTILE        = 't',
+  UI_KEY_INTERPOLATE   = 'i',
+  UI_KEY_SKY           = 'y',
+  UI_KEY_KERNEL        = 'k',
+  UI_KEY_CONTOUR       = 'R',
+  UI_KEY_FIT           = 'f',
+  UI_KEY_FITMAXPOWER   = 'p',
+  UI_KEY_OUTLIERNUMNGB = 'a',
 
   /* Only with long version (start with a value 1000, the rest will be set
      automatically). */
@@ -99,7 +100,6 @@ enum option_keys_enum
   UI_KEY_KHDU,
   UI_KEY_MIRRORDIST,
   UI_KEY_MEANMEDQDIFF,
-  UI_KEY_OUTLIERNUM,
   UI_KEY_OUTLIERSIGMA,
   UI_KEY_OUTLIERSCLIP,
   UI_KEY_SMOOTHWIDTH,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 2b34d7f0..3b77d219 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -5046,7 +5046,7 @@ Finally, in @code{QTHRESH-APPLIED}, you see the 
thresholded image: pixels with a
 Let's get back to the problem of optimizing the result.
 You have two strategies for detecting the outskirts of the merging galaxies:
 1) Increase the tile size to get more accurate measurements of skewness.
-2) Strengthen the outlier rejection parameters to discard more of the tiles 
with signal.
+2) Strengthen the outlier rejection parameters to discard more of the tiles 
with signal (primarily by increasing @option{--outliernumngb}).
 Fortunately in this image we have a sufficiently large region on the right 
side of the image that the galaxy does not extend to.
 So we can use the more robust first solution.
 In situations where this does not happen (for example, if the field of view in 
this image was shifted to the left to have more of M51 and less sky) you are 
limited to a combination of the two solutions or just to the second solution.
@@ -6212,7 +6212,7 @@ We modified the default value to two of the options, 
below you can see the reaso
 See @ref{Detecting large extended targets} for more on optimizing NoiseChisel.
 @itemize
 @item
-Since the image is so large, we have increased @option{--interpnumngb} to get 
better outlier statistics on the tiles.
+Since the image is so large, we have increased @option{--outliernumngb} to get 
better outlier statistics on the tiles.
 The default value is primarily for small images, so this is usually the first 
thing you should do when running NoiseChisel on a real/large image.
 @item
 Since the image is not too deep (made from few exposures), it does not have 
strong correlated noise, so we will decrease @option{--detgrowquant} and 
increase @option{--detgrowmaxholesize} to better extract signal.
@@ -6241,7 +6241,7 @@ $ astarithmetic label/67510-masked-sat.fits 2 
interpolate-maxofregion \
 $ astarithmetic label/67510-masked-conv.fits 2 interpolate-maxofregion \
                 --output=label/67510-fill-conv.fits
 $ rm label/67510-masked-conv.fits
-$ astnoisechisel label/67510-fill.fits --interpnumngb=100 \
+$ astnoisechisel label/67510-fill.fits --outliernumngb=100 \
                  --detgrowquant=0.8 --detgrowmaxholesize=100000 \
                  --convolved=label/67510-fill-conv.fits \
                  --output=label/67510-nc.fits
@@ -21394,7 +21394,7 @@ Therefore, the final step of ``quantifying signal in a 
tile'' is to look at this
 @mymath{\sigma}-clipping is a good solution for removing a few outliers, but 
the problem with outliers of this kind is that there may be many such tiles 
(depending on the large/bright stars/galaxies in the image).
 We therefore apply the following local outlier rejection strategy.
 
-For each tile, we find the nearest @mymath{N_{ngb}} tiles that had a usable 
value (@mymath{N_{ngb}} is the value given to  @option{--interpnumngb}).
+For each tile, we find the nearest @mymath{N_{ngb}} tiles that had a usable 
value (@mymath{N_{ngb}} is the value given to  @option{--outliernumngb}).
 We then sort them and find the difference between the largest and 
second-to-smallest elements (The minimum is not used because the scatter can be 
large).
 Let's call this the tile's @emph{slope} (measured from its neighbors).
 All the tiles that are on a region of flat noise will have similar slope 
values, but if a few tiles fall on the wings of a bright star or large galaxy, 
their slope will be significantly larger than the tiles with no signal.
@@ -21403,24 +21403,15 @@ We just have to find the smallest tile slope value 
that is an outlier compared t
 @cindex Outliers
 @cindex Identifying outliers
 To identify the smallest outlier, we will use the distribution of distances 
between sorted elements.
-Let's assume the total number tiles with a good mean-median quantile 
difference is @mymath{N}.
-We sort them in increasing order based on their @emph{slope} (defined above).
-So the array of tile slopes can be written as @mymath{@{s[0], s[1], ..., 
s[N]@}}, where @mymath{s[0]<s[1]} and so on.
-We then start from element @mymath{M} and calculate the distances between all 
two adjacent values before it: @mymath{@{s[1]-s[0], s[2]-s[1], s[M-1]-s[M-2]@}}.
-
-The @mymath{\sigma}-clipped median and standard deviation of this distribution 
are then found (this @mymath{\sigma}-clipping is configured with 
@option{--outliersclip} which takes two values, see @ref{Sigma clipping}).
-If the distance between the element and its previous element is more than 
@option{--outliersigma} multiples of the @mymath{\sigma}-clipped standard 
deviation added with the @mymath{\sigma}-clipped median, that element is 
considered an outlier and all tiles larger than that value are ignored.
-
-Formally, if we assume there are @mymath{N} elements.
-They are first sorted.
-Searching for the outlier starts on element @mymath{N/3} (integer division).
+Let's assume the total number of tiles with a good mean-median quantile 
difference is @mymath{N}.
+They are first sorted and searching for the outlier starts on element 
@mymath{N/3} (integer division).
 Let's take @mymath{v_i} to be the @mymath{i}-th element of the sorted input 
(with no blank values) and @mymath{m} and @mymath{\sigma} as the 
@mymath{\sigma}-clipped median and standard deviation from the distances of the 
previous @mymath{N/3-1} elements (not including @mymath{v_i}).
 If the value given to @option{--outliersigma} is displayed with @mymath{s}, 
the @mymath{i}-th element is considered as an outlier when the condition below 
is true.
 
 @dispmath{{(v_i-v_{i-1})-m\over \sigma}>s}
 
 @noindent
-Since @mymath{i} begins from the @mymath{N/3}-th element in the sorted array 
(a quantile of @mymath{1/3=0.33}), the outlier has to be larger than the 
@mymath{0.33} quantile value of the dataset.
+Since @mymath{i} begins from the @mymath{N/3}-th element in the sorted array 
(a quantile of @mymath{1/3=0.33}), the outlier has to be larger than the 
@mymath{0.33} quantile value of the dataset (this is usually the case; 
otherwise, it is hard to define it as an ``outlier''!).
 
 @cindex Bicubic interpolation
 @cindex Interpolation, bicubic
@@ -22187,6 +22178,11 @@ Outlier rejection is useful when the dataset contains 
a large and diffuse (almos
 The flatness of the profile will cause it to successfully pass the mean-median 
quantile difference test, so we will need to use the distribution of successful 
tiles for removing these false positive.
 For more, see the latter half of @ref{Quantifying signal in a tile}.
 
+@item --outliernumngb=INT
+Number of neighboring tiles to use for outlier rejection (mostly the wings of 
bright stars or galaxies).
+If this option is given a value of zero, no outlier rejection will take place.
+For more see the latter half of @ref{Quantifying signal in a tile}.
+
 @item --outliersigma=FLT
 Multiple of sigma to define an outlier in the Sky value estimation.
 If this option is given a value of zero, no outlier rejection will take place.
@@ -22320,7 +22316,8 @@ In these cases, the faint wings of galaxies/stars could 
be mistakenly identified
 
 It was possible to play with the parameters to correct this for that 
particular dataset, but that was frustrating.
 Therefore from version 0.14, instead of finding outliers from the full tile 
distribution, we now measure the @emph{slope} of the tile's nearby tiles and 
find outliers locally.
-For more on the outlier-by-distance algorithm and the definition of 
@emph{slope}, see @ref{Quantifying signal in a tile}.
+Three options have been added to configure this part of NoiseChisel: 
@option{--outliernumngb}, @option{--outliersclip} and @option{--outliersigma}.
+For more on the local outlier-by-distance algorithm and the definition of 
@emph{slope} mentioned above, see @ref{Quantifying signal in a tile}.
 In our tests, this gave a much improved estimate of the quantile thresholds 
and final Sky values with default values.
 @end itemize
 
@@ -22399,6 +22396,12 @@ $ astnoisechisel --help | grep check
 @end example
 @end cartouche
 
+@cartouche
+@noindent
+@strong{Not detecting wings of bright galaxies:} In such cases, probably the 
best solution is to increase @option{--outliernumngb} (to reject tiles that are 
affected by very flat diffuse signal).
+For more, see @ref{Quantifying signal in a tile}.
+@end cartouche
+
 When working on 3D datacubes, the tessellation options need three values and 
updating them every time can be annoying/buggy.
 To simplify the job, NoiseChisel also installs a @file{astnoisechisel-3d.conf} 
configuration file (see @ref{Configuration files}).
 You can use this for default values on datacubes.
@@ -22573,6 +22576,17 @@ The maximum acceptable distance between the quantiles 
of the mean and median in
 The quantile threshold estimates are measured on tiles where the quantiles of 
their mean and median are less distant than the value given to this option.
 for example, @option{--meanmedqdiff=0.01} means that only tiles where the 
mean's quantile is between 0.49 and 0.51 (recall that the median's quantile is 
0.5) will be used.
 
+@item -a INT
+@itemx --outliernumngb=INT
+Number of neighboring tiles to use for outlier rejection (mostly the wings of 
bright stars or galaxies).
+For optimal detection of the wings of bright stars or galaxies, this is 
@strong{the most important} option in NoiseChisel.
+This is because the extended wings of bright galaxies or stars (the PSF) can 
become flat over the tile.
+In this case, they will satisfy the @option{--meanmedqdiff} condition and pass 
that step.
+Therefore, to correctly identify such bad tiles, we need to look at the 
neighboring nearby tiles.
+A tile that is on the wing of a bright galaxy/star will clearly be an outlier 
when looking at the neighbors.
+For more on the details of the outlier rejection algorithm, see the latter 
half of @ref{Quantifying signal in a tile}.
+If this option is given a value of zero, no outlier rejection will take place.
+
 @item --outliersclip=FLT,FLT
 @mymath{\sigma}-clipping parameters for the outlier rejection of the quantile 
threshold.
 The format of the given values is similar to @option{--sigmaclip} below.
@@ -22647,7 +22661,7 @@ These values will be used to construct the final 
threshold map over the whole im
 All outlier tiles have been masked.
 The reason for removing outliers is that the quantile-of-mean is only 
sensitive to signal that varies on a scale that is smaller than the tile size.
 Therefore the extended wings of large galaxies or bright stars (which vary on 
scales much larger than the tile size) will pass that test.
-As described in @ref{Quantifying signal in a tile}, using the values given to 
@option{--outliersclip} and @option{--outliersigma}, the outlier tiles are 
removed in this step.
+As described in @ref{Quantifying signal in a tile} outlier rejection is 
customized through @option{--outliernumngb}, @option{--outliersclip} and 
@option{--outliersigma}.
 
 @item  THRESH1_INTERP
 @itemx THRESH2_INTERP
diff --git a/lib/gnuastro-internal/tile-internal.h 
b/lib/gnuastro-internal/tile-internal.h
index 259adae1..b31c33f1 100644
--- a/lib/gnuastro-internal/tile-internal.h
+++ b/lib/gnuastro-internal/tile-internal.h
@@ -72,7 +72,8 @@ gal_tileinternal_no_outlier_local(gal_data_t *input, 
gal_data_t *second,
                                   struct gal_tile_two_layer_params *tl,
                                   uint8_t metric, size_t numneighbors,
                                   size_t numthreads, double *outliersclip,
-                                  double outliersigma, char *filename);
+                                  double outliersigma, char *filename,
+                                  char *optionname);
 
 __END_C_DECLS    /* From C++ preparations */
 
diff --git a/lib/tile-internal.c b/lib/tile-internal.c
index babdbeeb..374cd614 100644
--- a/lib/tile-internal.c
+++ b/lib/tile-internal.c
@@ -311,6 +311,7 @@ struct tileinternal_outlier_local
   size_t                  numneighbors;
   uint8_t                *thread_flags;
   gal_list_void_t            *ngb_vals;
+  char                     *optionname;
   float (*metric)(size_t *, size_t *, size_t );
 
   struct gal_tile_two_layer_params *tl;
@@ -320,7 +321,7 @@ struct tileinternal_outlier_local
 
 
 
-/* Run the interpolation on many threads. */
+/* Run the outlier rejection on many threads. */
 static void *
 gal_tileinternal_no_outlier_local_on_thread(void *in_prm)
 {
@@ -493,9 +494,9 @@ gal_tileinternal_no_outlier_local_on_thread(void *in_prm)
              through the 'currentnum>=numnearest' check above. */
           if(sQ==NULL)
             error(EXIT_FAILURE, 0, "%s: only %zu neighbors found while "
-                  "you had asked to use %zu neighbors for close neighbor "
-                  "interpolation", __func__, ngb_counter,
-                  prm->numneighbors);
+                  "you had asked to use %zu neighbors for outlier "
+                  "rejection (value to '%s')", __func__, ngb_counter,
+                  prm->numneighbors, prm->optionname);
         }
 
       /* Calculate the desired statistic, and write it in the output. */
@@ -542,7 +543,8 @@ gal_tileinternal_no_outlier_local(gal_data_t *input, 
gal_data_t *second,
                                   struct gal_tile_two_layer_params *tl,
                                   uint8_t metric, size_t numneighbors,
                                   size_t numthreads, double *outliersclip,
-                                  double outliersigma, char *filename)
+                                  double outliersigma, char *filename,
+                                  char *optionname)
 {
   gal_data_t *othresh;
   float *base, *f, *ff, thresh;
@@ -553,8 +555,8 @@ gal_tileinternal_no_outlier_local(gal_data_t *input, 
gal_data_t *second,
 
   /* Sanity checks. */
   if(numneighbors<=3)
-    error(EXIT_FAILURE, 0, "interpnumngb has to be larger than 3, but "
-          "is currently %zu", numneighbors);
+    error(EXIT_FAILURE, 0, "%s has to be larger than 3, but "
+          "is currently %zu", optionname, numneighbors);
   if(input->type!=GAL_TYPE_FLOAT32)
     error(EXIT_FAILURE, 0, "%s: a bug! Please contact us at %s to fix "
           "the problem. The input to this function (not NoiseChisel) "
@@ -586,6 +588,7 @@ gal_tileinternal_no_outlier_local(gal_data_t *input, 
gal_data_t *second,
   prm.tl           = tl;
   prm.ngb_vals     = NULL;
   prm.input        = input;
+  prm.optionname   = optionname;
   prm.numneighbors = numneighbors;
 
 



reply via email to

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