gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 5637520: Segment: --noobjects is new name for


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 5637520: Segment: --noobjects is new name for old --onlyclumps
Date: Sun, 17 Oct 2021 10:24:53 -0400 (EDT)

branch: master
commit 56375202ef35e88edb3158783dc4b48f85ae734f
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Segment: --noobjects is new name for old --onlyclumps
    
    Until now, the '--onlyclumps' option name could cause a confusion: leading
    the user to assume that the output will _only_ contain the 'CLUMPS' HDU!
    But this was not the case by default! To get such an output, the user would
    also have to give '--rawoutput'.
    
    With this commit, to avoid such confusions, the option name has been
    changed to '--noobjects'.
    
    This issue was reported by Sepideh Eskandarlou.
---
 NEWS                         | 10 ++++++++++
 bin/segment/args.h           | 10 +++++-----
 bin/segment/main.h           |  2 +-
 bin/segment/segment.c        | 24 ++++++++++++------------
 bin/segment/ui.h             |  2 +-
 doc/announce-acknowledge.txt |  2 +-
 doc/gnuastro.texi            |  2 +-
 7 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/NEWS b/NEWS
index 2c407fd..e8d604e 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,16 @@ See the end of the file for license conditions.
 
 ** Changed features
 
+  Segment:
+   - '--noobjects' is the new name for the old '--onlyclumps' option. This
+     is because the name Only-Clumps can lead to a wrong expectation that
+     the output will _only_ contain a 'CLUMPS' HDU. However,
+     with'--onlyclumps', the input image (without a Sky level) and the Sky
+     standard deviation image are also present as HDUs in the output. To
+     only get the 'CLUMPS' HDU, it is necessary to also use the
+     '--rawoutput' option. This renaming was done to avoid such confusions
+     and was raised by Sepideh Eskandarlou.
+
 ** Bugs fixed
   bug #61329: make check crash in macOS in convolve/spectrum-1d.sh, found
               and fixed with the help of Sebastian Luna-Valero.
diff --git a/bin/segment/args.h b/bin/segment/args.h
index 0fedc8d..5dcf8ff 100644
--- a/bin/segment/args.h
+++ b/bin/segment/args.h
@@ -186,7 +186,7 @@ struct argp_option program_options[] =
       UI_KEY_RAWOUTPUT,
       0,
       0,
-      "Output only object and clump labels.",
+      "Output contains only CLUMPS and/or OBJECTS HDUs.",
       GAL_OPTIONS_GROUP_OUTPUT,
       &p->rawoutput,
       GAL_OPTIONS_NO_ARG_TYPE,
@@ -195,13 +195,13 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET
     },
     {
-      "onlyclumps",
-      UI_KEY_ONLYCLUMPS,
+      "noobjects",
+      UI_KEY_NOOBJECTS,
       0,
       0,
-      "Finish after finding true clumps.",
+      "Finish with true clumps, don't create objects.",
       GAL_OPTIONS_GROUP_OUTPUT,
-      &p->onlyclumps,
+      &p->noobjects,
       GAL_OPTIONS_NO_ARG_TYPE,
       GAL_OPTIONS_RANGE_0_OR_1,
       GAL_OPTIONS_NOT_MANDATORY,
diff --git a/bin/segment/main.h b/bin/segment/main.h
index 889484b..fb23dee 100644
--- a/bin/segment/main.h
+++ b/bin/segment/main.h
@@ -70,7 +70,7 @@ struct segmentparams
   float               snquant;  /* Quantile of clumps in sky for true S/N.*/
   uint8_t    keepmaxnearriver;  /* Keep clumps with a peak near a river.  */
   float         clumpsnthresh;  /* Clump S/N threshold.                   */
-  uint8_t          onlyclumps;  /* Finish after finding true clumps.      */
+  uint8_t           noobjects;  /* Finish after finding true clumps.      */
   float               gthresh;  /* Multiple of STD to stop growing clumps.*/
   size_t       minriverlength;  /* Min, len of good grown clump rivers.   */
   float           objbordersn;  /* Minimum S/N for grown clumps to be one.*/
diff --git a/bin/segment/segment.c b/bin/segment/segment.c
index 98a7426..77183bd 100644
--- a/bin/segment/segment.c
+++ b/bin/segment/segment.c
@@ -725,7 +725,7 @@ segment_relab_overall(struct clumps_thread_params *cltprm)
   struct clumps_params *clprm=cltprm->clprm;
 
   int32_t startinglab;
-  uint8_t onlyclumps=clprm->p->onlyclumps;
+  uint8_t noobjects=clprm->p->noobjects;
   size_t *s=cltprm->indexs->array, *sf=s+cltprm->indexs->size;
   int32_t *clabel=clprm->p->clabel->array, *olabel=clprm->p->olabel->array;
 
@@ -737,18 +737,18 @@ segment_relab_overall(struct clumps_thread_params *cltprm)
 
   /* Set the starting label for re-labeling (THIS HAS TO BE BEFORE
      CORRECTING THE TOTAL NUMBER OF CLUMPS/OBJECTS). */
-  startinglab = onlyclumps ? clprm->totclumps : clprm->totobjects;
+  startinglab = noobjects ? clprm->totclumps : clprm->totobjects;
 
   /* Save the total number of clumps and objects. */
   clprm->totclumps  += cltprm->numtrueclumps;
-  if( !onlyclumps ) clprm->totobjects += cltprm->numobjects;
+  if( !noobjects ) clprm->totobjects += cltprm->numobjects;
 
   /* Unlock the mutex (if it was locked). */
   if(clprm->p->cp.numthreads>1)
     pthread_mutex_unlock(&clprm->labmutex);
 
   /* Increase all the object labels by 'startinglab'. */
-  if( onlyclumps )
+  if( noobjects )
     {
       if(cltprm->numtrueclumps>0)
         {
@@ -884,7 +884,7 @@ segment_on_threads(void *in_prm)
 
 
       /* When only clumps are desired ignore the rest of the process. */
-      if(!p->onlyclumps)
+      if(!p->noobjects)
         {
           /* Abort the looping here if we don't only want clumps. */
           if(clprm->step==2) continue;
@@ -1097,8 +1097,8 @@ segment_reproducible_labels(struct segmentparams *p)
   size_t i;
   gal_data_t *new;
   int32_t currentlab=0, *oldarr, *newarr, *newlabs;
-  gal_data_t *old = p->onlyclumps ? p->clabel : p->olabel;
-  size_t numlabsplus1 = (p->onlyclumps ? p->numclumps : p->numobjects) + 1;
+  gal_data_t *old = p->noobjects ? p->clabel : p->olabel;
+  size_t numlabsplus1 = (p->noobjects ? p->numclumps : p->numobjects) + 1;
 
   /* Allocate the necessary datasets. */
   new=gal_data_alloc(NULL, old->type, old->ndim, old->dsize, old->wcs, 0,
@@ -1128,8 +1128,8 @@ segment_reproducible_labels(struct segmentparams *p)
 
   /* Clean up. */
   free(newlabs);
-  if(p->onlyclumps) { gal_data_free(p->clabel); p->clabel=new; }
-  else              { gal_data_free(p->olabel); p->olabel=new; }
+  if(p->noobjects) { gal_data_free(p->clabel); p->clabel=new; }
+  else             { gal_data_free(p->olabel); p->olabel=new; }
 }
 
 
@@ -1183,7 +1183,7 @@ segment_detections(struct segmentparams *p)
 
              /* When the user only wanted clumps, there is no point in
                 continuing beyond step 2. */
-             && !(p->onlyclumps && clprm.step>2)
+             && !(p->noobjects && clprm.step>2)
 
              /* When the user just wants to check the clump S/N values,
                 then break out of the loop, we don't need the rest of the
@@ -1401,7 +1401,7 @@ segment_output(struct segmentparams *p)
 
 
   /* The object labels. */
-  if(!p->onlyclumps)
+  if(!p->noobjects)
     {
       gal_fits_key_list_add(&keys, GAL_TYPE_SIZE_T, "NUMLABS", 0,
                             &p->numobjects, 0, "Total number of objects", 0,
@@ -1543,7 +1543,7 @@ segment(struct segmentparams *p)
   /* Report the results and timing to the user. */
   if(!p->cp.quiet)
     {
-      if(p->onlyclumps)
+      if(p->noobjects)
         {
           if( asprintf(&msg, "%zu clump%sfound.",
                        p->numclumps,  p->numclumps ==1 ? " " : "s ")<0 )
diff --git a/bin/segment/ui.h b/bin/segment/ui.h
index a7de4ec..23c169c 100644
--- a/bin/segment/ui.h
+++ b/bin/segment/ui.h
@@ -82,7 +82,7 @@ enum option_keys_enum
   UI_KEY_MINIMA,
   UI_KEY_RAWOUTPUT,
   UI_KEY_MINNUMFALSE,
-  UI_KEY_ONLYCLUMPS,
+  UI_KEY_NOOBJECTS,
   UI_KEY_GROWNCLUMPS,
   UI_KEY_CHECKSN,
   UI_KEY_CHECKSEGMENTATION,
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index aa37c7a..74645fe 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,12 +1,12 @@
 Alphabetically ordered list to acknowledge in the next release.
 
+Sepideh Eskandarlou
 Sebastian Luna-Valero
 
 
 
 
 
-
 Copyright (C) 2015-2021 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document under
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 87652ac..08f2a7d 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -18116,7 +18116,7 @@ Don't abort Segment after producing the check image(s).
 The usage of this option is identical to NoiseChisel's 
@option{--continueaftercheck} option (@ref{NoiseChisel input}).
 Please see the descriptions there for more.
 
-@item --onlyclumps
+@item --noobjects
 Abort Segment after finding true clumps and don't continue with finding 
options.
 Therefore, no @code{OBJECTS} extension will be present in the output.
 Each true clump in @code{CLUMPS} will get a unique label, but diffuse regions 
will still have a negative value.



reply via email to

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