gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 6a5e7351: MakeCatalog: new --river-min and --r


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 6a5e7351: MakeCatalog: new --river-min and --river-max measurements
Date: Fri, 11 Aug 2023 06:45:05 -0400 (EDT)

branch: master
commit 6a5e73519cf4320d67bf48da1807dd4b23dc56da
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    MakeCatalog: new --river-min and --river-max measurements
    
    Until now, MakeCatalog only provided the mean river value around the
    clumps. However, in some cases, the minimum and/or maximum values can also
    be useful when analysing the clumps.
    
    With this commit, two new measurements have been added to MakeCatalog for
    these two operations.
---
 NEWS                    |  5 +++++
 bin/mkcatalog/args.h    | 28 ++++++++++++++++++++++++++++
 bin/mkcatalog/columns.c | 36 ++++++++++++++++++++++++++++++++++++
 bin/mkcatalog/main.h    |  2 ++
 bin/mkcatalog/parse.c   | 14 ++++++++++++++
 bin/mkcatalog/ui.c      |  2 ++
 bin/mkcatalog/ui.h      |  2 ++
 doc/gnuastro.texi       | 11 ++++++++---
 8 files changed, 97 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index cd347055..a5bdb100 100644
--- a/NEWS
+++ b/NEWS
@@ -60,6 +60,11 @@ See the end of the file for license conditions.
     Gnuastro could only read TIFF files). This step was written by Fathma
     Mehnoor.
 
+  MakeCatalog:
+  - New measurements:
+    --river-min: minimum river value around a clump.
+    --river-max: minimum river value around a clump.
+
   Table:
   --info-num-cols: print the number of the input table's columns and abort.
   --info-num-rows: print the number of the input table's rows and abort.
diff --git a/bin/mkcatalog/args.h b/bin/mkcatalog/args.h
index 774b64c8..62cc7f55 100644
--- a/bin/mkcatalog/args.h
+++ b/bin/mkcatalog/args.h
@@ -1326,6 +1326,34 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET,
       ui_column_codes_ll
     },
+    {
+      "river-min",
+      UI_KEY_RIVERMIN,
+      0,
+      0,
+      "Minimum river value around clump.",
+      UI_GROUP_COLUMNS_BRIGHTNESS,
+      0,
+      GAL_TYPE_INVALID,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_column_codes_ll
+    },
+    {
+      "river-max",
+      UI_KEY_RIVERMAX,
+      0,
+      0,
+      "Maximum river value around clump.",
+      UI_GROUP_COLUMNS_BRIGHTNESS,
+      0,
+      GAL_TYPE_INVALID,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      ui_column_codes_ll
+    },
     {
       "sn",
       UI_KEY_SN,
diff --git a/bin/mkcatalog/columns.c b/bin/mkcatalog/columns.c
index d6a576da..d598b047 100644
--- a/bin/mkcatalog/columns.c
+++ b/bin/mkcatalog/columns.c
@@ -1619,6 +1619,32 @@ columns_define_alloc(struct mkcatalogparams *p)
           ciflag[ CCOL_RIV_NUM ] = ciflag[ CCOL_RIV_SUM ] = 1;
           break;
 
+        case UI_KEY_RIVERMIN:
+          name           = "RIVER_MIN";
+          unit           = MKCATALOG_NO_UNIT;
+          ocomment       = NULL;
+          ccomment       = "Minimum river value surrounding this clump.";
+          otype          = GAL_TYPE_INVALID;
+          ctype          = GAL_TYPE_FLOAT32;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_GENERAL;
+          disp_width     = 10;
+          disp_precision = 5;
+          ciflag[ CCOL_RIV_NUM ] = ciflag[ CCOL_RIV_MIN ] = 1;
+          break;
+
+        case UI_KEY_RIVERMAX:
+          name           = "RIVER_MAX";
+          unit           = MKCATALOG_NO_UNIT;
+          ocomment       = NULL;
+          ccomment       = "Maximum river value surrounding this clump.";
+          otype          = GAL_TYPE_INVALID;
+          ctype          = GAL_TYPE_FLOAT32;
+          disp_fmt       = GAL_TABLE_DISPLAY_FMT_GENERAL;
+          disp_width     = 10;
+          disp_precision = 5;
+          ciflag[ CCOL_RIV_NUM ] = ciflag[ CCOL_RIV_MAX ] = 1;
+          break;
+
         case UI_KEY_RIVERNUM:
           name           = "RIVER_NUM";
           unit           = "counter";
@@ -3374,6 +3400,16 @@ columns_fill(struct mkcatalog_passparams *pp)
                                      : NAN );
             break;
 
+          case UI_KEY_RIVERMIN:
+            ((float *)colarr)[cind] = ( ci[ CCOL_RIV_NUM]
+                                        ? ci[ CCOL_RIV_MIN ] : NAN );
+            break;
+
+          case UI_KEY_RIVERMAX:
+            ((float *)colarr)[cind] = ( ci[ CCOL_RIV_NUM]
+                                        ? ci[ CCOL_RIV_MAX ] : NAN );
+            break;
+
           case UI_KEY_RIVERNUM:
             ((int32_t *)colarr)[cind] = ci[ CCOL_RIV_NUM ];
             break;
diff --git a/bin/mkcatalog/main.h b/bin/mkcatalog/main.h
index 3d002c9c..14b036a2 100644
--- a/bin/mkcatalog/main.h
+++ b/bin/mkcatalog/main.h
@@ -165,6 +165,8 @@ enum clumpcols
     CCOL_SIGCLIPMEDIAN,  /* Sigma-clipped mean of this clump.         */
     CCOL_RIV_NUM,        /* Num river pixels around this clump.       */
     CCOL_RIV_SUM,        /* Sum of rivers around clump.               */
+    CCOL_RIV_MIN,        /* Minimum of rivers around clump.           */
+    CCOL_RIV_MAX,        /* Maximum of rivers around clump.           */
     CCOL_RIV_SUM_VAR,    /* Variance of sum (for error measurements). */
     CCOL_VX,             /* Sum of (value-sky) * x.                   */
     CCOL_VY,             /* Sum of (value-sky) * y.                   */
diff --git a/bin/mkcatalog/parse.c b/bin/mkcatalog/parse.c
index 63bc4fdc..a7a6e0d0 100644
--- a/bin/mkcatalog/parse.c
+++ b/bin/mkcatalog/parse.c
@@ -1053,9 +1053,23 @@ parse_clumps(struct mkcatalog_passparams *pp)
                                if(cif[ CCOL_RIV_NUM  ])
                                  cir[ CCOL_RIV_NUM ]++;
 
+                               /* Total sum of values in river. */
                                if(cif[ CCOL_RIV_SUM  ])
                                  cir[ CCOL_RIV_SUM ] += *V;
 
+                               /* Minimum river value. */
+                               if(cif[CCOL_RIV_MIN])
+                                 if(cir[CCOL_RIV_NUM]==1
+                                    || *V < cir[CCOL_RIV_MIN])
+                                   cir[CCOL_RIV_MIN]=*V;
+
+                               /* Maximum river value. */
+                               if(cif[CCOL_RIV_MAX])
+                                 if(cir[CCOL_RIV_NUM]==1
+                                    || *V > cir[CCOL_RIV_MAX])
+                                   cir[CCOL_RIV_MAX]=*V;
+
+                               /* Sum of variances within river. */
                                if(cif[ CCOL_RIV_SUM_VAR  ])
                                  {
                                    sval = ( pp->st_std
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index f3dced2a..c8e97f80 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -1123,6 +1123,8 @@ ui_necessary_inputs(struct mkcatalogparams *p, int 
*values, int *sky,
           case CCOL_SIGCLIPSTD:       *values        = 1;          break;
           case CCOL_RIV_NUM:          /* Only clump labels. */     break;
           case CCOL_RIV_SUM:          *values        = 1;          break;
+          case CCOL_RIV_MIN:          *values        = 1;          break;
+          case CCOL_RIV_MAX:          *values        = 1;          break;
           case CCOL_RIV_SUM_VAR:      *values = *std = 1;          break;
           case CCOL_VX:               *values        = 1;          break;
           case CCOL_VY:               *values        = 1;          break;
diff --git a/bin/mkcatalog/ui.h b/bin/mkcatalog/ui.h
index c28bda7a..8927fbad 100644
--- a/bin/mkcatalog/ui.h
+++ b/bin/mkcatalog/ui.h
@@ -167,6 +167,8 @@ enum option_keys_enum
   UI_KEY_UPPERLIMITSKEW,
   UI_KEY_RIVERMEAN,
   UI_KEY_RIVERNUM,
+  UI_KEY_RIVERMIN,
+  UI_KEY_RIVERMAX,
   UI_KEY_SKY,
   UI_KEY_SKYSTD,
   UI_KEY_SIGCLIPNUMBER,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index a1883c6c..23828ac1 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -28395,7 +28395,7 @@ This can be a good measure to see how much you can 
trust the random measurements
 
 @item --river-mean
 [Clumps] The average of the river pixel values around this clump.
-River pixels were defined in Akhlaghi and Ichikawa 2015.
+River pixels were defined in @url{https://arxiv.org/abs/1505.01664, Akhlaghi 
and Ichikawa 2015}.
 In short they are the pixels immediately outside of the clumps.
 This value is used internally to find the sum (or magnitude) and signal to 
noise ratio of the clumps.
 It can generally also be used as a scale to gauge the base (ambient) flux 
surrounding the clump.
@@ -28403,8 +28403,13 @@ In case there was no river pixels, then this column 
will have the value of the S
 So note that this value is @emph{not} sky subtracted.
 
 @item --river-num
-[Clumps] The number of river pixels around this clump, see
-@option{--river-mean}.
+[Clumps] The number of river pixels around this clump, see 
@option{--river-mean}.
+
+@item --river-min
+[Clumps] Minimum river value around this clump, see @option{--river-mean}.
+
+@item --river-max
+[Clumps] Maximum river value around this clump, see @option{--river-mean}.
 
 @item --sn
 The Signal to noise ratio (S/N) of all clumps or objects.



reply via email to

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