gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 0597cea 058/113: Imported work in master, no c


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 0597cea 058/113: Imported work in master, no conflicts
Date: Fri, 16 Apr 2021 10:33:46 -0400 (EDT)

branch: master
commit 0597cea81f21e8577819cced3464026c608f96c0
Merge: 9285abe e958450
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Imported work in master, no conflicts
    
    There were no conflicts in this merge.
---
 bin/segment/segment.c | 23 ++++++++++++++---------
 lib/table.c           |  7 ++-----
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/bin/segment/segment.c b/bin/segment/segment.c
index da38458..312f325 100644
--- a/bin/segment/segment.c
+++ b/bin/segment/segment.c
@@ -591,11 +591,13 @@ segment_on_threads(void *in_prm)
       if(clprm->step==1 || p->checksn)
         { gal_data_free(topinds); continue; }
 
+
       /* Only keep true clumps and abort if the user only wants clumps. */
       clumps_det_keep_true_relabel(&cltprm);
       gal_data_free(topinds);
       if(clprm->step==2) continue;
 
+
       /* When only clumps are desired ignore the rest of the process. */
       if(!p->onlyclumps)
         {
@@ -717,14 +719,16 @@ segment_save_sn_table(struct clumps_params *clprm)
   int32_t *oiarr, *cioarr;
   gal_list_str_t *comments=NULL;
   size_t i, j, c=0, totclumps=0;
-  gal_data_t *sn, *objind, *clumpinobj;
   struct segmentparams *p=clprm->p;
+  gal_data_t *sn, *objind, *clumpinobj;
 
 
   /* Find the total number of clumps in all the initial detections. Recall
      that the `size' values were one more than the actual number because
      the labelings start from 1. */
-  for(i=1;i<p->numdetections+1;++i) totclumps += clprm->sn[i].size-1;
+  for(i=1;i<p->numdetections+1;++i)
+    if( clprm->sn[i].size > 1 )
+      totclumps += clprm->sn[i].size-1;
 
 
   /* Allocate the columns for the table. */
@@ -744,13 +748,14 @@ segment_save_sn_table(struct clumps_params *clprm)
   oiarr=objind->array;
   cioarr=clumpinobj->array;
   for(i=1;i<p->numdetections+1;++i)
-    for(j=1;j<clprm->sn[i].size;++j)
-      {
-        oiarr[c]  = i;
-        cioarr[c] = j;
-        sarr[c]   = ((float *)(clprm->sn[i].array))[j];
-        ++c;
-      }
+    if( clprm->sn[i].size > 1 )
+      for(j=1;j<clprm->sn[i].size;++j)
+        {
+          oiarr[c]  = i;
+          cioarr[c] = j;
+          sarr[c]   = ((float *)(clprm->sn[i].array))[j];
+          ++c;
+        }
 
 
   /* Write the comments. */
diff --git a/lib/table.c b/lib/table.c
index a263700..e22fb4b 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -493,10 +493,8 @@ gal_table_comments_add_intro(gal_list_str_t **comments, 
char *program_string,
 
   /* Get the Git description in the running folder. */
   tmp=gal_git_describe();
-  if(tmp) sprintf(gitdescribe, " from %s,", tmp);
-  else    gitdescribe[0]='\0';
-  free(tmp);
-
+  if(tmp) { sprintf(gitdescribe, " from %s,", tmp); free(tmp); }
+  else      gitdescribe[0]='\0';
 
   /* Git version and time of program's starting, this will be the second
      line. Note that ctime puts a `\n' at the end of its string, so we'll
@@ -507,7 +505,6 @@ gal_table_comments_add_intro(gal_list_str_t **comments, 
char *program_string,
   tmp[ strlen(tmp)-1 ]='\0';
   gal_list_str_add(comments, tmp, 0);
 
-
   /* Program name: this will be the top of the list (first line). We will
      need to set the allocation flag for this one, because program_string
      is usually statically allocated.*/



reply via email to

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