gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master d24fabe: Corrected reading of --upperlimitsigm


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d24fabe: Corrected reading of --upperlimitsigma in MakeCatalog
Date: Tue, 6 Mar 2018 10:39:30 -0500 (EST)

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

    Corrected reading of --upperlimitsigma in MakeCatalog
    
    While everything was set for this option, we were not actually setting it
    as a condition to measure the necessary parameters from the upperlimit
    distribution. With this commit, it is now added to the trigers to fill the
    necessary values.
---
 bin/mkcatalog/upperlimit.c  | 35 ++++++++++++++++++++++-------------
 bin/noisechisel/detection.c |  2 +-
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/bin/mkcatalog/upperlimit.c b/bin/mkcatalog/upperlimit.c
index 645f695..20619f5 100644
--- a/bin/mkcatalog/upperlimit.c
+++ b/bin/mkcatalog/upperlimit.c
@@ -274,7 +274,7 @@ upperlimit_measure(struct mkcatalog_passparams *pp, int32_t 
clumplab,
   gal_data_t *column;
   size_t init_size, col, one=1;
   struct mkcatalogparams *p=pp->p;
-  gal_data_t *sigclip=NULL, *sum, *qfunc;
+  gal_data_t *sum, *qfunc=NULL, *sigclip=NULL;
   double *o = ( clumplab
                 ? &pp->ci[ (clumplab-1) * CCOL_NUMCOLS ]
                 : pp->oi );
@@ -292,6 +292,7 @@ upperlimit_measure(struct mkcatalog_passparams *pp, int32_t 
clumplab,
             /* Columns that depend on the sigma of the distribution. */
             case UI_KEY_UPPERLIMIT:
             case UI_KEY_UPPERLIMITMAG:
+            case UI_KEY_UPPERLIMITSIGMA:
             case UI_KEY_UPPERLIMITONESIGMA:
 
               /* We only need to do this once. */
@@ -324,18 +325,26 @@ upperlimit_measure(struct mkcatalog_passparams *pp, 
int32_t clumplab,
             /* Quantile column. */
             case UI_KEY_UPPERLIMITQUANTILE:
 
-              /* Similar to the case for sigma-clipping, we'll need to keep
-                 the size here also. */
-              init_size=pp->up_vals->size;
-              sum=gal_data_alloc(NULL, GAL_TYPE_FLOAT32, 1, &one, NULL, 0,
-                                 -1, NULL, NULL, NULL);
-              ((float *)(sum->array))[0]=o[clumplab ? CCOL_SUM : OCOL_SUM];
-              qfunc=gal_statistics_quantile_function(pp->up_vals, sum, 1);
-
-              /* Fill in the column. */
-              col = clumplab ? CCOL_UPPERLIMIT_Q : OCOL_UPPERLIMIT_Q;
-              pp->up_vals->size=pp->up_vals->dsize[0]=init_size;
-              o[col] = ((double *)(qfunc->array))[0];
+              /* Also only necessary once (if requested multiple times). */
+              if(qfunc==NULL)
+                {
+                  /* Similar to the case for sigma-clipping, we'll need to
+                     keep the size here also. */
+                  init_size=pp->up_vals->size;
+                  sum=gal_data_alloc(NULL, GAL_TYPE_FLOAT32, 1, &one, NULL, 0,
+                                     -1, NULL, NULL, NULL);
+                  ((float *)(sum->array))[0]=o[clumplab?CCOL_SUM:OCOL_SUM];
+                  qfunc=gal_statistics_quantile_function(pp->up_vals, sum, 1);
+
+                  /* Fill in the column. */
+                  col = clumplab ? CCOL_UPPERLIMIT_Q : OCOL_UPPERLIMIT_Q;
+                  pp->up_vals->size=pp->up_vals->dsize[0]=init_size;
+                  o[col] = ((double *)(qfunc->array))[0];
+
+                  /* Clean up. */
+                  gal_data_free(sum);
+                  gal_data_free(qfunc);
+                }
               break;
             }
         }
diff --git a/bin/noisechisel/detection.c b/bin/noisechisel/detection.c
index f74332e..c7e08a7 100644
--- a/bin/noisechisel/detection.c
+++ b/bin/noisechisel/detection.c
@@ -972,7 +972,7 @@ detection_quantile_expand(struct noisechiselparams *p, 
gal_data_t *workbin)
   float *i, *e_th, *arr=p->conv->array;
   uint8_t *b=workbin->array, *bf=b+workbin->size;
 
-  /* only continue if there actually are any pixels to expand (this can
+  /* Only continue if there actually are any pixels to expand (this can
      happen!). */
   if(p->numexpand)
     {



reply via email to

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