gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master c4a0ecf: Minor corrections in Segment: warning


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c4a0ecf: Minor corrections in Segment: warning message and flag setting
Date: Fri, 31 Aug 2018 08:59:14 -0400 (EDT)

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

    Minor corrections in Segment: warning message and flag setting
    
    Based on a real-world mistake by myself(!), a warning will be printed by
    NoiseChisel and Segment if the value to `--snquant' is very small (less
    than 0.1). The scenario that this happens if fully described in the comment
    above it: mistaking false-detection rate (where lower is better) with
    purity (where higher is better).
    
    Also, in Segment, I noticed that while we were intending to set the blank
    flag to no flags, we were mistakenly setting it to containing blanks (using
    the bit-wise OR operator). This has also been fixed with this commit. So
    this commit will allow a small preformance improvement.
---
 bin/noisechisel/ui.c | 15 +++++++++++++++
 bin/segment/clumps.c |  3 ++-
 bin/segment/ui.c     | 15 +++++++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index cf9f09a..f72e38a 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -281,6 +281,21 @@ ui_read_check_only_options(struct noisechiselparams *p)
               "HDU number (starting from zero), extension name, or any "
               "HDU identifier acceptable by CFITSIO", p->widekernelname);
     }
+
+  /* If the S/N quantile is less than 0.1 (an arbitrary small value), this
+     is probably due to forgetting that this is the purity level
+     (higher-is-better), not the contamination level
+     (lower-is-better). This actually happened in a few cases: where we
+     wanted a false detection rate of 0.0001 (a super-high value!), and
+     instead of inputing 0.9999, we mistakenly gave `--snquant' a value of
+     `0.0001'. We were thus fully confused with the output (an extremely
+     low value) and thought its a bug, while it wasn't! */
+  if(p->snquant<0.1)
+    fprintf(stderr, "\nWARNING: Value of `--snquant' (`-c') is %g. Note "
+            "that this is not a contamination rate (where lower is "
+            "better), it is a purity rate (where higher is better). If you "
+            "intentionally asked for such a low purity level, please "
+            "ignore this warning\n\n", p->snquant);
 }
 
 
diff --git a/bin/segment/clumps.c b/bin/segment/clumps.c
index a2f7235..3c580ac 100644
--- a/bin/segment/clumps.c
+++ b/bin/segment/clumps.c
@@ -723,7 +723,8 @@ clumps_true_find_sn_thresh(struct segmentparams *p)
 
   /* The S/N array of sky clumps is desiged to have no blank values, so set
      the flags accordingly to avoid a redundant blank search. */
-  sn->flag = GAL_DATA_FLAG_BLANK_CH | GAL_DATA_FLAG_HASBLANK;
+  sn->flag  =  GAL_DATA_FLAG_BLANK_CH;
+  sn->flag &= ~GAL_DATA_FLAG_HASBLANK;
 
 
   /* If the user wanted to see the S/N table, then save it. */
diff --git a/bin/segment/ui.c b/bin/segment/ui.c
index 3c3f637..1cd006b 100644
--- a/bin/segment/ui.c
+++ b/bin/segment/ui.c
@@ -267,6 +267,21 @@ ui_read_check_only_options(struct segmentparams *p)
               "(starting from zero), extension name, or anything "
               "acceptable by CFITSIO");
     }
+
+  /* If the S/N quantile is less than 0.1 (an arbitrary small value), this
+     is probably due to forgetting that this is the purity level
+     (higher-is-better), not the contamination level
+     (lower-is-better). This actually happened in a few cases: where we
+     wanted a false detection rate of 0.0001 (a super-high value!), and
+     instead of inputing 0.9999, we mistakenly gave `--snquant' a value of
+     `0.0001'. We were thus fully confused with the output (an extremely
+     low value) and thought its a bug, while it wasn't! */
+  if(p->snquant<0.1)
+    fprintf(stderr, "\nWARNING: Value of `--snquant' (`-c') is %g. Note "
+            "that this is not a contamination rate (where lower is "
+            "better), it is a purity rate (where higher is better). If you "
+            "intentionally asked for such a low purity level, please "
+            "ignore this warning\n\n", p->snquant);
 }
 
 



reply via email to

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