gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master a1ad568 3/3: MakeCatalog uses geometric when f


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master a1ad568 3/3: MakeCatalog uses geometric when flux weighted not available
Date: Tue, 23 May 2017 20:04:58 -0400 (EDT)

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

    MakeCatalog uses geometric when flux weighted not available
    
    Until now (since the re-write, not in version 0.2) when the object fully
    lies over a blank region, or is below the threshold, its `--x' and `--y' or
    `--ra' and `--dec' would be NaN and its area would be zero. Indeed, that is
    the definition of a flux weighted center. But these coordinates are used
    generically most of the time and forcing the user to call two sets of
    position columns to make a generic catalog is not really convenient.
    
    So now, if the flux weighted center of the object is not available. All
    flux-weighted position columns will use the geometric center calculations
    instead. Also, the `--area' column now reports the raw area of the pixels
    labeled with this object/clump, it is independent of the pixel values they
    lie over. To help distinguish if the flux weighte positions were used or
    the geometric positions, MakeCatalog now has a new `--weightarea' column.
---
 bin/crop/ui.c             |   2 +-
 bin/mkcatalog/args.h      |  14 +++++
 bin/mkcatalog/columns.c   | 106 +++++++++++++++++++++-----------
 bin/mkcatalog/main.h      |   4 ++
 bin/mkcatalog/mkcatalog.c | 150 +++++++++++++++++++++++-----------------------
 bin/mkcatalog/ui.c        |   2 +-
 bin/mkcatalog/ui.h        |   1 +
 doc/gnuastro.texi         |  52 ++++++++--------
 8 files changed, 196 insertions(+), 135 deletions(-)

diff --git a/bin/crop/ui.c b/bin/crop/ui.c
index ad66384..9b9e5ac 100644
--- a/bin/crop/ui.c
+++ b/bin/crop/ui.c
@@ -291,7 +291,7 @@ ui_read_check_only_options(struct cropparams *p)
   switch(checksum)
     {
     case 0:
-      error(EXIT_FAILURE, 0, "no crop definition, you can use any of the "
+      error(EXIT_FAILURE, 0, "no crop definition. You can use any of the "
             "following options to define the crop(s): (`--xc', `--yc'), "
             "(`--ra', `--dec'), `--catalog', `--section', `--polygon'. "
             "Please run this command for more information:\n\n"
diff --git a/bin/mkcatalog/args.h b/bin/mkcatalog/args.h
index df1d29c..0ec8e28 100644
--- a/bin/mkcatalog/args.h
+++ b/bin/mkcatalog/args.h
@@ -404,6 +404,20 @@ struct argp_option program_options[] =
       ui_column_codes_ll
     },
     {
+      "weightarea",
+      UI_KEY_WEIGHTAREA,
+      0,
+      0,
+      "Area used for flux weighted positions.",
+      ARGS_GROUP_COLUMNS,
+      0,
+      GAL_TYPE_INVALID,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_column_codes_ll
+    },
+    {
       "x",
       UI_KEY_X,
       0,
diff --git a/bin/mkcatalog/columns.c b/bin/mkcatalog/columns.c
index 69a6d54..ba91cd2 100644
--- a/bin/mkcatalog/columns.c
+++ b/bin/mkcatalog/columns.c
@@ -288,8 +288,8 @@ columns_define_alloc(struct mkcatalogparams *p)
           disp_fmt       = 0;
           disp_width     = 5;
           disp_precision = 0;
-          oiflag[ OCOL_NUM ] = 1;
-          ciflag[ CCOL_NUM ] = 1;
+          oiflag[ OCOL_NUMALL ] = 1;
+          ciflag[ CCOL_NUMALL ] = 1;
           break;
 
         case UI_KEY_CLUMPSAREA:
@@ -305,6 +305,20 @@ columns_define_alloc(struct mkcatalogparams *p)
           oiflag[ OCOL_C_NUM ] = 1;
           break;
 
+        case UI_KEY_WEIGHTAREA:
+          name           = "WEIGHT_AREA";
+          unit           = "counter";
+          ocomment       = "Area used for flux-weighted positions.";
+          ccomment       = ocomment;
+          otype          = GAL_TYPE_INT32;
+          ctype          = GAL_TYPE_INT32;
+          disp_fmt       = 0;
+          disp_width     = 5;
+          disp_precision = 0;
+          oiflag[ OCOL_NUMPOS ] = 1;
+          ciflag[ CCOL_NUMPOS ] = 1;
+          break;
+
         case UI_KEY_X:
           name           = "X";
           unit           = "position";
@@ -1055,7 +1069,7 @@ columns_second_order(struct mkcatalog_passparams *pp, 
double *row,
     case UI_KEY_GEOPOSITIONANGLE:
 
       /* Denominator (to be divided). */
-      denom = row[ o0c1 ? CCOL_NUM : OCOL_NUM ];
+      denom = row[ o0c1 ? CCOL_NUMALL : OCOL_NUMALL ];
 
       /* First order. */
       x  = MKC_RATIO( row[ o0c1 ? CCOL_GX  : OCOL_GX  ], denom );
@@ -1147,6 +1161,10 @@ columns_second_order(struct mkcatalog_passparams *pp, 
double *row,
    write them into the output columns. The list of columns here is in the
    same order as `columns_alloc_set_out_cols', see there for the type of
    each column. */
+#define POS_V_G(ARRAY, SUMPOS_COL, NUMALL_COL, V_COL, G_COL)            \
+  ( (ARRAY)[ SUMPOS_COL ]>0                                             \
+    ? MKC_RATIO( (ARRAY)[ V_COL ], (ARRAY)[ SUMPOS_COL ] )              \
+    : MKC_RATIO( (ARRAY)[ G_COL ], (ARRAY)[ NUMALL_COL ] ) )
 void
 columns_fill(struct mkcatalog_passparams *pp)
 {
@@ -1179,69 +1197,81 @@ columns_fill(struct mkcatalog_passparams *pp)
           break;
 
         case UI_KEY_AREA:
-          ((int32_t *)colarr)[oind] = oi[OCOL_NUM];
+          ((int32_t *)colarr)[oind] = oi[OCOL_NUMALL];
           break;
 
         case UI_KEY_CLUMPSAREA:
-          ((int32_t *)colarr)[oind] = oi[OCOL_C_NUM];
+          ((int32_t *)colarr)[oind] = oi[OCOL_C_NUMALL];
+          break;
+
+        case UI_KEY_WEIGHTAREA:
+          ((int32_t *)colarr)[oind] = oi[OCOL_NUMPOS];
           break;
 
         case UI_KEY_X:
-          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_VX], oi[OCOL_SUMPOS] );
+          ((float *)colarr)[oind] = POS_V_G(oi, OCOL_SUMPOS, OCOL_NUMALL,
+                                            OCOL_VX, OCOL_GX);
           break;
 
         case UI_KEY_Y:
-          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_VY], oi[OCOL_SUMPOS] );
+          ((float *)colarr)[oind] = POS_V_G(oi, OCOL_SUMPOS, OCOL_NUMALL,
+                                            OCOL_VY, OCOL_GY);
           break;
 
         case UI_KEY_GEOX:
-          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_GX], oi[OCOL_NUM] );
+          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_GX], oi[OCOL_NUMALL] );
           break;
 
         case UI_KEY_GEOY:
-          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_GY], oi[OCOL_NUM] );
+          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_GY], oi[OCOL_NUMALL] );
           break;
 
         case UI_KEY_CLUMPSX:
-          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_C_VX],
-                                               oi[OCOL_C_SUMPOS] );
+          ((float *)colarr)[oind] = POS_V_G(oi, OCOL_C_SUMPOS, OCOL_C_NUMALL,
+                                            OCOL_C_VX, OCOL_C_GX);
           break;
 
         case UI_KEY_CLUMPSY:
-          ((float *)colarr)[oind] = MKC_RATIO(oi[OCOL_C_VY],
-                                              oi[OCOL_C_SUMPOS] );
+          ((float *)colarr)[oind] = POS_V_G(oi, OCOL_C_SUMPOS, OCOL_C_NUMALL,
+                                            OCOL_C_VY, OCOL_C_GY);
           break;
 
         case UI_KEY_CLUMPSGEOX:
-          ((float *)colarr)[oind] = MKC_RATIO(oi[OCOL_C_GX], oi[OCOL_C_NUM]);
+          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_C_GX],
+                                               oi[OCOL_C_NUMALL] );
           break;
 
         case UI_KEY_CLUMPSGEOY:
-          ((float *)colarr)[oind] = MKC_RATIO(oi[OCOL_C_GY], oi[OCOL_C_NUM]);
+          ((float *)colarr)[oind] = MKC_RATIO( oi[OCOL_C_GY],
+                                               oi[OCOL_C_NUMALL] );
           break;
 
         case UI_KEY_RA:
         case UI_KEY_DEC:
-          p->rd_vo[0][oind] = MKC_RATIO( oi[OCOL_VX], oi[OCOL_SUMPOS] );
-          p->rd_vo[1][oind] = MKC_RATIO( oi[OCOL_VY], oi[OCOL_SUMPOS] );
+          p->rd_vo[0][oind] = POS_V_G(oi, OCOL_SUMPOS, OCOL_NUMALL,
+                                      OCOL_VX, OCOL_GX);
+          p->rd_vo[1][oind] = POS_V_G(oi, OCOL_SUMPOS, OCOL_NUMALL,
+                                      OCOL_VY, OCOL_GY);
           break;
 
         case UI_KEY_GEORA:
         case UI_KEY_GEODEC:
-          p->rd_go[0][oind] = MKC_RATIO( oi[OCOL_GX], oi[OCOL_NUM] );
-          p->rd_go[1][oind] = MKC_RATIO( oi[OCOL_GY], oi[OCOL_NUM] );
+          p->rd_go[0][oind] = MKC_RATIO( oi[OCOL_GX], oi[OCOL_NUMALL] );
+          p->rd_go[1][oind] = MKC_RATIO( oi[OCOL_GY], oi[OCOL_NUMALL] );
           break;
 
         case UI_KEY_CLUMPSRA:
         case UI_KEY_CLUMPSDEC:
-          p->rd_vcc[0][oind] = MKC_RATIO( oi[OCOL_C_VX], oi[OCOL_C_SUMPOS] );
-          p->rd_vcc[1][oind] = MKC_RATIO( oi[OCOL_C_VY], oi[OCOL_C_SUMPOS] );
+          p->rd_vcc[0][oind] = POS_V_G(oi, OCOL_C_SUMPOS, OCOL_C_NUMALL,
+                                       OCOL_C_VX, OCOL_C_GX);
+          p->rd_vcc[1][oind] = POS_V_G(oi, OCOL_C_SUMPOS, OCOL_C_NUMALL,
+                                       OCOL_C_VY, OCOL_C_GY);
           break;
 
         case UI_KEY_CLUMPSGEORA:
         case UI_KEY_CLUMPSGEODEC:
-          p->rd_gcc[0][oind] = MKC_RATIO( oi[OCOL_C_GX], oi[OCOL_C_NUM] );
-          p->rd_gcc[1][oind] = MKC_RATIO( oi[OCOL_C_GY], oi[OCOL_C_NUM] );
+          p->rd_gcc[0][oind] = MKC_RATIO( oi[OCOL_C_GX], oi[OCOL_C_NUMALL] );
+          p->rd_gcc[1][oind] = MKC_RATIO( oi[OCOL_C_GY], oi[OCOL_C_NUMALL] );
           break;
 
         case UI_KEY_BRIGHTNESS:
@@ -1350,37 +1380,45 @@ columns_fill(struct mkcatalog_passparams *pp)
             break;
 
           case UI_KEY_AREA:
-            ((int32_t *)colarr)[cind]=ci[CCOL_NUM];
+            ((int32_t *)colarr)[cind]=ci[CCOL_NUMALL];
+            break;
+
+          case UI_KEY_WEIGHTAREA:
+            ((int32_t *)colarr)[cind]=ci[CCOL_NUMPOS];
             break;
 
           case UI_KEY_X:
-            ((float *)colarr)[cind] = MKC_RATIO( ci[CCOL_VX],
-                                                 ci[CCOL_SUMPOS] );
+            ((float *)colarr)[cind] = POS_V_G(ci, CCOL_SUMPOS, CCOL_NUMALL,
+                                              CCOL_VX, CCOL_GX);
             break;
 
           case UI_KEY_Y:
-            ((float *)colarr)[cind] = MKC_RATIO( ci[CCOL_VY],
-                                                 ci[CCOL_SUMPOS] );
+            ((float *)colarr)[cind] = POS_V_G(ci, CCOL_SUMPOS, CCOL_NUMALL,
+                                              CCOL_VY, CCOL_GY);
             break;
 
           case UI_KEY_GEOX:
-            ((float *)colarr)[cind] = MKC_RATIO( ci[CCOL_GX], ci[CCOL_NUM] );
+            ((float *)colarr)[cind] = MKC_RATIO( ci[CCOL_GX],
+                                                 ci[CCOL_NUMALL] );
             break;
 
           case UI_KEY_GEOY:
-            ((float *)colarr)[cind] = MKC_RATIO( ci[CCOL_GY], ci[CCOL_NUM] );
+            ((float *)colarr)[cind] = MKC_RATIO( ci[CCOL_GY],
+                                                 ci[CCOL_NUMALL] );
             break;
 
           case UI_KEY_RA:
           case UI_KEY_DEC:
-            p->rd_vc[0][cind] = MKC_RATIO( ci[CCOL_VX], ci[CCOL_SUMPOS] );
-            p->rd_vc[1][cind] = MKC_RATIO( ci[CCOL_VY], ci[CCOL_SUMPOS] );
+            p->rd_vc[0][cind] = POS_V_G(ci, CCOL_SUMPOS, CCOL_NUMALL,
+                                        CCOL_VX, CCOL_GX);
+            p->rd_vc[1][cind] = POS_V_G(ci, CCOL_SUMPOS, CCOL_NUMALL,
+                                        CCOL_VY, CCOL_GY);
             break;
 
           case UI_KEY_GEORA:
           case UI_KEY_GEODEC:
-            p->rd_gc[0][cind] = MKC_RATIO( ci[CCOL_GX], ci[CCOL_NUM] );
-            p->rd_gc[1][cind] = MKC_RATIO( ci[CCOL_GY], ci[CCOL_NUM] );
+            p->rd_gc[0][cind] = MKC_RATIO( ci[CCOL_GX], ci[CCOL_NUMALL] );
+            p->rd_gc[1][cind] = MKC_RATIO( ci[CCOL_GY], ci[CCOL_NUMALL] );
             break;
 
           case UI_KEY_BRIGHTNESS:
diff --git a/bin/mkcatalog/main.h b/bin/mkcatalog/main.h
index 8aa4aeb..e2eea74 100644
--- a/bin/mkcatalog/main.h
+++ b/bin/mkcatalog/main.h
@@ -79,12 +79,14 @@ enum objectcols
     OCOL_SUMSKY,         /* Sum of sky value on this object.          */
     OCOL_SUMSTD,         /* Sum of sky STD value on this object.      */
     OCOL_SUMPOS,         /* Sum of positive image pixels.             */
+    OCOL_NUMPOS,         /* Number of positive pixels used for wht.   */
     OCOL_GX,             /* Geometric center of object in X.          */
     OCOL_GY,             /* Geometric center of object in Y.          */
     OCOL_GXX,            /* Second order geometric variable: X*X.     */
     OCOL_GYY,            /* Second order geometric variable: Y*Y.     */
     OCOL_GXY,            /* Second order geometric variable: X*Y.     */
     OCOL_UPPERLIMIT_B,   /* Upper limit magnitude.                    */
+    OCOL_C_NUMALL,       /* Value independent no. of pixels in clumps.*/
     OCOL_C_NUM,          /* Area of clumps in this object.            */
     OCOL_C_SUM,          /* Brightness  in object clumps.             */
     OCOL_C_VX,           /* Sum of (value-sky)*x on clumps.           */
@@ -92,6 +94,7 @@ enum objectcols
     OCOL_C_GX,           /* Geometric center of clumps in object X.   */
     OCOL_C_GY,           /* Geometric center of clumps in object Y.   */
     OCOL_C_SUMPOS,       /* Sum of positive image pixels for wht.     */
+    OCOL_C_NUMPOS,       /* Num of positive image pixels for wht.     */
 
     OCOL_NUMCOLS,        /* SHOULD BE LAST: total number of columns.  */
   };
@@ -111,6 +114,7 @@ enum clumpcols
     CCOL_SUMSKY,         /* Sum of sky value on this object.          */
     CCOL_SUMSTD,         /* Sum of sky STD value on this object.      */
     CCOL_SUMPOS,         /* Sum of positive image pixels for wht.     */
+    CCOL_NUMPOS,         /* Num of positive image pixels for wht.     */
     CCOL_GX,             /* Geometric center of clump in X.           */
     CCOL_GY,             /* Geometric center of clump in Y.           */
     CCOL_GXX,            /* Second order geometric moment.            */
diff --git a/bin/mkcatalog/mkcatalog.c b/bin/mkcatalog/mkcatalog.c
index 71ae0f7..cb901cb 100644
--- a/bin/mkcatalog/mkcatalog.c
+++ b/bin/mkcatalog/mkcatalog.c
@@ -142,78 +142,80 @@ mkcatalog_first_pass(struct mkcatalog_passparams *pp)
       /* Parse the tile. */
       do
         {
-          /* If this pixel belongs to the requested object and isn't
-             NAN, then do the processing. `hasblank' is constant, so
-             when the input doesn't have any blank values, the `isnan'
-             will never be checked. */
-          if( *O==pp->object && !( p->hasblank && isnan(*I) ) )
+          /* If this pixel belongs to the requested object then do the
+             processing.  */
+          if( *O==pp->object )
             {
-
-              /* Total area (independent of threshold). */
-              ++oi[ OCOL_NUMALL ];
-
-              /* Sky subtracted value. */
-              ss = *I - *SK;
-
               /* Get the number of clumps in this object: the largest clump
                  ID over each object. */
               if( p->clumps && *C>0 )
                 pp->clumpsinobj = *C > pp->clumpsinobj ? *C : pp->clumpsinobj;
 
-              /* Only continue if the pixel is above the threshold.
+
+              /* Get the coordinates of this point. */
+              gal_dimension_index_to_coord(I-input, ndim, dsize, c);
+
+
+              /* Calculate the shifted coordinates for second order
+                 calculations. The coordinate is incremented because from
+                 now on, the positions are in the FITS standard (starting
+                 from one).
+
+                 IMPORTANT NOTE: this is a postfix increment, so after the
+                 expression (difference) is evaluated, the coordinate is
+                 going to change. This is necessary because `shift' is also
+                 starting from zero.  */
+              for(d=0;d<ndim;++d) sc[d] = c[d] - pp->shift[d];
+
+
+              /* Do the general geometric (independent of pixel value)
+                 calculations. */
+              oi[ OCOL_NUMALL ]++;
+              oi[ OCOL_GX     ] += c[1]+1;
+              oi[ OCOL_GY     ] += c[0]+1;
+              oi[ OCOL_GXX    ] += sc[1] * sc[1];
+              oi[ OCOL_GYY    ] += sc[0] * sc[0];
+              oi[ OCOL_GXY    ] += sc[1] * sc[0];
+              if(p->clumps && *C>0)
+                {
+                  oi[ OCOL_C_GX    ] += c[1]+1;
+                  oi[ OCOL_C_GY    ] += c[0]+1;
+                }
+
+
+              /* Start the pixel value related parameters.
 
                  ABOUT THE CHECK: The reason this condition is given
                  like this is that the `threshold' value is optional
-                 and we don't want to do multiple checks. The basic
-                 idea is this: when the user doesn't want any
+                 and we don't want to do multiple checks.
+
+                 The basic idea is this: when the user doesn't want any
                  thresholds applied, then `p->threshold==NAN' and any
-                 conditional that involves a NaN will fail, so its
-                 logical negation will be positive and the calculations
-                 below will be done. However, if the user does specify
-                 a threhold and the pixel is above the threshold, then
-                 (`ss < p->threshold * *ST') will be false and its
-                 logical negation will be positive, so the pixel will
-                 be included. */
-              if( !( ss < p->threshold * *ST ) )
+                 conditional that involves a NaN will fail, so its logical
+                 negation will be positive and the calculations below will
+                 be done. However, if the user does specify a threhold and
+                 the pixel is above the threshold, then (`ss < p->threshold
+                 * *ST') will be false and its logical negation will be
+                 positive, so the pixel will be included. */
+              if( !( p->hasblank && isnan(*I) )
+                  && !( (ss = *I - *SK) < p->threshold * *ST ) )
                 {
-                  /* Sum of the Sky and its STD value. */
+                  /* General flux summations. */
+                  oi[ OCOL_NUM    ]++;
+                  oi[ OCOL_SUM    ] += ss;
                   oi[ OCOL_SUMSKY ] += *SK;
                   oi[ OCOL_SUMSTD ] += *ST;
-
-                  /* Get the coordinates of this point. */
-                  gal_dimension_index_to_coord(I-input, ndim, dsize, c);
-
-                  /* Calculate the shifted coordinates for second order
-                     calculations. The coordinate is incremented
-                     because from now on, the positions are in the FITS
-                     standard (starting from one).
-
-                     IMPORTANT NOTE: this is a postfix increment, so after
-                     the expression (difference) is evaluated, the
-                     coordinate is going to change. This is necessary
-                     because `shift' is also starting from zero.    */
-                  for(d=0;d<ndim;++d) sc[d] = c[d] - pp->shift[d];
-
-                  /* Geometric positions and total number. */
-                  ++oi[ OCOL_NUM ];
-                  oi[ OCOL_SUM   ] += ss;
-                  oi[ OCOL_GX    ] += c[1]+1;
-                  oi[ OCOL_GY    ] += c[0]+1;
-                  oi[ OCOL_GXX   ] += sc[1] * sc[1];
-                  oi[ OCOL_GYY   ] += sc[0] * sc[0];
-                  oi[ OCOL_GXY   ] += sc[1] * sc[0];
                   if(p->clumps && *C>0)
                     {
-                      ++oi[ OCOL_C_NUM ];
-                      oi[ OCOL_C_SUM   ] += ss;
-                      oi[ OCOL_C_GX    ] += c[1]+1;
-                      oi[ OCOL_C_GY    ] += c[0]+1;
+                      oi[ OCOL_C_NUM ]++;
+                      oi[ OCOL_C_SUM ] += ss;
                     }
 
                   /* For flux weighted centers, we can only use positive
                      values, so do those measurements here. */
                   if( ss > 0.0f )
                     {
+                      oi[ OCOL_NUMPOS ]++;
                       oi[ OCOL_SUMPOS ] += ss;
                       oi[ OCOL_VX     ] += ss * c[1]+1;
                       oi[ OCOL_VY     ] += ss * c[0]+1;
@@ -222,6 +224,7 @@ mkcatalog_first_pass(struct mkcatalog_passparams *pp)
                       oi[ OCOL_VXY    ] += ss * sc[1] * sc[0];
                       if(p->clumps && *C>0)
                         {
+                          oi[ OCOL_C_NUMPOS ]++;
                           oi[ OCOL_C_SUMPOS ] += ss;
                           oi[ OCOL_C_VX     ] += ss * (c[1]+1);
                           oi[ OCOL_C_VY     ] += ss * (c[0]+1);
@@ -287,46 +290,43 @@ mkcatalog_second_pass(struct mkcatalog_passparams *pp)
              isn't NAN, then do the processing. `hasblank' is constant, so
              when the input doesn't have any blank values, the `isnan' will
              never be checked. */
-          if( *O==pp->object && !( p->hasblank && isnan(*I) ) )
+          if( *O==pp->object )
             {
               /* We are on a clump. */
               if(p->clumps && *C>0)
                 {
                   /* Pointer to make things easier. Note that the clump
-                     counters start from 1, but the array indexs from 0.*/
+                     labels start from 1, but the array indexs from 0.*/
                   ci=&pp->ci[ (*C-1) * CCOL_NUMCOLS ];
 
-                  /* Total area (independent of threshold). */
-                  ++ci[ CCOL_NUMALL ];
+                  /* Get the coordinates of this point. */
+                  gal_dimension_index_to_coord(I-input, ndim, dsize, c);
 
-                  /* Sky subtracted value. */
-                  ss = *I - *SK;
+                  /* Shifted coordinates for second order moments, see
+                     explanations in the first pass.*/
+                  for(d=0;d<ndim;++d) sc[d] = c[d]++ - pp->shift[d];
+
+                  /* Geometric measurements (independent of pixel value). */
+                  ci[ CCOL_NUMALL ]++;
+                  ci[ CCOL_GX     ] += c[1];
+                  ci[ CCOL_GY     ] += c[0];
+                  ci[ CCOL_GXX    ] += sc[1] * sc[1];
+                  ci[ CCOL_GYY    ] += sc[0] * sc[0];
+                  ci[ CCOL_GXY    ] += sc[1] * sc[0];
 
                   /* Only use pixels above the threshold, see explanations in
                      first pass for an explanation. */
-                  if( !( ss < p->threshold * *ST ) )
+                  if( !( p->hasblank && isnan(*I) )
+                      && !( (ss = *I - *SK) < p->threshold * *ST ) )
                     {
-                      /* Sum of the Sky and its STD value. */
+                      /* Fill in the necessary information. */
+                      ci[ CCOL_NUM    ]++;
+                      ci[ CCOL_SUM    ] += ss;
                       ci[ CCOL_SUMSKY ] += *SK;
                       ci[ CCOL_SUMSTD ] += *ST;
-
-                      /* Get the coordinates of this point. */
-                      gal_dimension_index_to_coord(I-input, ndim, dsize, c);
-
-                      /* Shifted coordinates for second order moments, see
-                         explanations in the first pass.*/
-                      for(d=0;d<ndim;++d) sc[d] = c[d]++ - pp->shift[d];
-
-                      /* Fill in the necessary information. */
-                      ++ci[ CCOL_NUM ];
-                      ci[ CCOL_SUM   ] += ss;
-                      ci[ CCOL_GX    ] += c[1];
-                      ci[ CCOL_GY    ] += c[0];
-                      ci[ CCOL_GXX   ] += sc[1] * sc[1];
-                      ci[ CCOL_GYY   ] += sc[0] * sc[0];
-                      ci[ CCOL_GXY   ] += sc[1] * sc[0];
                       if( ss > 0.0f )
                         {
+                          ci[ CCOL_NUMPOS ]++;
                           ci[ CCOL_SUMPOS ] += ss;
                           ci[ CCOL_VX     ] += ss * c[1];
                           ci[ CCOL_VY     ] += ss * c[0];
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index 0bc7270..09e02a4 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -747,7 +747,7 @@ ui_preparations_outnames(struct mkcatalogparams *p)
       else
         {
           suffix = ( p->cp.tableformat==GAL_TABLE_FORMAT_TXT
-                     ? ".txt" : ".fits" );
+                     ? "._cat.txt" : "_cat.fits" );
           p->objectsout=gal_checkset_automatic_output(&p->cp, p->inputname,
                                                       suffix);
         }
diff --git a/bin/mkcatalog/ui.h b/bin/mkcatalog/ui.h
index d7e789b..c5ab69a 100644
--- a/bin/mkcatalog/ui.h
+++ b/bin/mkcatalog/ui.h
@@ -79,6 +79,7 @@ enum option_keys_enum
   UI_KEY_OBJID,                         /* Catalog columns. */
   UI_KEY_IDINHOSTOBJ,
   UI_KEY_CLUMPSAREA,
+  UI_KEY_WEIGHTAREA,
   UI_KEY_GEOX,
   UI_KEY_GEOY,
   UI_KEY_CLUMPSX,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index b6de3cd..45ffa71 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -9067,28 +9067,26 @@ important operation.
 @cindex Cosmic rays
 @cindex Pixel mixing
 @cindex Mixing pixel values
-Convolution of an image will generally result in blurring the image
-because it mixes pixel values. In other words, if the image has sharp
-differences in neighboring pixel address@hidden astronomy, the
-only major time we confront such sharp borders in signal are cosmic
-rays. All other sources of signal in an image are already blurred by
-the atmosphere or the optics of the instrument.}, those sharp
-differences will become smoother. This has very good consequences in
-detection of signal in noise for example. In an actual observed image,
-the variation in neighboring pixel values due to noise can be very
-high. But after convolution, those variations will decrease and we
-have a better hope in detecting the possible underlying
+Convolution of an image will generally result in blurring the image because
+it mixes pixel values. In other words, if the image has sharp differences
+in neighboring pixel address@hidden astronomy, the only major time we
+confront such sharp borders in signal are cosmic rays. All other sources of
+signal in an image are already blurred by the atmosphere or the optics of
+the instrument.}, those sharp differences will become smoother. This has
+very good consequences in detection of signal in noise for example. In an
+actual observed image, the variation in neighboring pixel values due to
+noise can be very high. But after convolution, those variations will
+decrease and we have a better hope in detecting the possible underlying
 signal. Another case where convolution is extensively used is in mock
-images and modeling in general, convolution can be used to simulate
-the effect of the atmosphere or the optical system on the mock
-profiles that we create, see @ref{PSF}. Convolution is a very
-interesting and important topic in any form of signal analysis
-(including astronomical observations). So we have
address@hidden mathematical will certainly consider this
-explanation is incomplete and inaccurate. However this text is written
-for an understanding on the operations that are done on a real (not
-complex, discrete and noisy) astronomical image, not any general form
-of abstract function} explained the concepts behind it in the
+images and modeling in general, convolution can be used to simulate the
+effect of the atmosphere or the optical system on the mock profiles that we
+create, see @ref{PSF}. Convolution is a very interesting and important
+topic in any form of signal analysis (including astronomical
+observations). So we have address@hidden mathematician will
+certainly consider this explanation is incomplete and inaccurate. However
+this text is written for an understanding on the operations that are done
+on a real (not complex, discrete and noisy) astronomical image, not any
+general form of abstract function} explained the concepts behind it in the
 following sub-sections.
 
 @menu
@@ -13862,11 +13860,16 @@ if only object catalogs are required, it has the same 
effect as
 
 @item -a
 @itemx --area
-The area (number of pixels) in any clump or object.
+The raw area (number of pixels) in any clump or object independed of what
+pixel it lies over (if it is NaN/blank or unused for example).
 
 @item --clumpsarea
 [Objects] The total area of all the clumps in this object.
 
address@hidden --weightarea
+The area (number of pixels) used in the flux weighted position
+calculations.
+
 @item -x
 @itemx --x
 The flux weighted center of all objects and clumps along the first FITS
@@ -13874,8 +13877,9 @@ axis (horizontal when viewed in SAO ds9), see 
@mymath{\overline{x}} in
 @ref{Measuring elliptical parameters}. The weight has to have a positive
 value (pixel value larger than the Sky value) to be meaningful! Specially
 when doing matched photometry, this might not happen: no pixel value might
-be above the Sky value. In such cases, you can use the geometric center,
-see @option{--geox}.
+be above the Sky value. For such detections, the geometric center will be
+reported in this column (see @option{--geox}). You can use
address@hidden to see which was used.
 
 @item -y
 @itemx --y



reply via email to

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