gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 232a598: New --mcolisbrightness option for Mak


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 232a598: New --mcolisbrightness option for MakeProfiles
Date: Thu, 27 Jul 2017 12:23:51 -0400 (EDT)

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

    New --mcolisbrightness option for MakeProfiles
    
    It might happen that the user knows the total brightness (sum of pixel
    values) of the profiles desired, but doesn't want to go through the trouble
    of converting it to a magnitude (which also requires a zeropoint). With
    this commit, the new `--mcolisbrightness' option will tell MakeProfiles to
    interpret the value in `--mcol' as total brightness, not magnitude.
---
 NEWS                    |  4 ++++
 bin/mkprof/args.h       | 15 ++++++++++++++-
 bin/mkprof/main.h       |  1 +
 bin/mkprof/oneprofile.c |  6 ++++--
 bin/mkprof/ui.c         | 12 +++++++++++-
 bin/mkprof/ui.h         |  1 +
 doc/gnuastro.texi       | 13 +++++++++++++
 7 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 3304cc3..8d23e44 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,10 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   each pixel. This may be used to define your own profiles that are not
   currently supported in MakeProfiles.
 
+  MakeProfiles: with the new `--mcolisbrightness' ("mcol-is-brightness")
+  option, the `--mcol' values of the catalog will be interpretted as total
+  brightness (sum of pixel values), not magnitude.
+
 ** Removed features
 
 ** Changed features
diff --git a/bin/mkprof/args.h b/bin/mkprof/args.h
index 7f3a824..931d909 100644
--- a/bin/mkprof/args.h
+++ b/bin/mkprof/args.h
@@ -244,6 +244,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET
     },
     {
+      "mcolisbrightness",
+      UI_KEY_MCOLISBRIGHTNESS,
+      0,
+      0,
+      "mcol is total brightness, not magnitude.",
+      ARGS_GROUP_PROFILES,
+      &p->mcolisbrightness,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
       "shift",
       UI_KEY_SHIFT,
       "INT[, ...]",
@@ -280,7 +293,7 @@ struct argp_option program_options[] =
       &p->zeropoint,
       GAL_TYPE_FLOAT32,
       GAL_OPTIONS_RANGE_ANY,
-      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
     {
diff --git a/bin/mkprof/main.h b/bin/mkprof/main.h
index 5f58583..88cfe3a 100644
--- a/bin/mkprof/main.h
+++ b/bin/mkprof/main.h
@@ -142,6 +142,7 @@ struct mkprofparams
   char                *mcol;  /* Magnitude column.                        */
   char                *tcol;  /* Truncation of the profiles.              */
   uint8_t       mforflatpix;  /* mcol is flat pixel value (f is 4 or 5).  */
+  uint8_t  mcolisbrightness;  /* mcol is total brightness not magnitude.  */
   gal_data_t         *crpix;  /* CRPIX FITS header keywords.              */
   gal_data_t         *crval;  /* CRVAL FITS header keywords.              */
   gal_data_t         *cdelt;  /* For CDELTi FITS header keywords.         */
diff --git a/bin/mkprof/oneprofile.c b/bin/mkprof/oneprofile.c
index d756e42..33f84dd 100644
--- a/bin/mkprof/oneprofile.c
+++ b/bin/mkprof/oneprofile.c
@@ -501,8 +501,10 @@ oneprof_set_prof_params(struct mkonthread *mkp)
   int tp=p->tunitinp;
   size_t id=mkp->ibq->id;
 
-  /* Fill the most basic dimension and profile agnostic parameters. */
-  mkp->brightness = pow( 10, (p->zeropoint - p->m[id]) / 2.5f );
+  /* Fill the most basic profile agnostic parameters. */
+  mkp->brightness = ( p->mcolisbrightness
+                      ? p->m[id]
+                      : pow( 10, (p->zeropoint - p->m[id]) / 2.5f ) );
   mkp->ibq->ispsf = p->kernel ? 1 : oneprofile_ispsf(p->f[id]);
   mkp->func       = mkp->ibq->func = p->f[id];
 
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 41fa790..ee15b3a 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -196,7 +196,8 @@ ui_initialize_options(struct mkprofparams *p,
   cp->coptions           = gal_commonopts_options;
 
   /* Default program parameters. */
-  p->cp.type=GAL_TYPE_FLOAT32;
+  p->zeropoint           = NAN;
+  p->cp.type             = GAL_TYPE_FLOAT32;
 
 
   /* Modify the common options for this program. */
@@ -543,6 +544,15 @@ ui_read_check_only_options(struct mkprofparams *p)
               "coordinate columns");
     }
 
+  /* The zeropoint magnitude is only necessary when `mcolisbrightness' is
+     not called.  */
+  if( p->mcolisbrightness==0 && isnan(p->zeropoint) )
+    error(EXIT_FAILURE, 0, "no zeropoint magnitude given. A zeropoint "
+          "magnitude is necessary when `--mcolisbrightness' is not called "
+          "(i.e., when the contents of `--mcol' must be interpretted as "
+          "a magnitude, not brightness).");
+
+
   /* Make sure no zero value is given for the `--naxis' option (only when
      it is necessary). */
   if(p->dsize && p->backname==NULL)
diff --git a/bin/mkprof/ui.h b/bin/mkprof/ui.h
index e11cd3e..4aa48b0 100644
--- a/bin/mkprof/ui.h
+++ b/bin/mkprof/ui.h
@@ -59,6 +59,7 @@ enum option_keys_enum
   /* Only with long version. */
   UI_KEY_PSFINIMG        = 1000,
   UI_KEY_MAGATPEAK,
+  UI_KEY_MCOLISBRIGHTNESS,
   UI_KEY_MODE,
   UI_KEY_CCOL,
   UI_KEY_FCOL,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index cbf3e87..bfa68bc 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -14982,6 +14982,19 @@ scaled up based on the oversampling scale in your 
configuration files (see
 @ref{Configuration files}) unless you have accounted for oversampling in
 your catalog.
 
address@hidden --mcolisbrightness
+The value given in the ``magnitude column'' (specified by @option{--mcol},
+see @ref{MakeProfiles catalog}) must be interpretted as brightness, not
+magnitude. The zeropoint magnitude (value to the @option{--zeropoint}
+option) is ignored and the given value must have the same units as the
+input dataset's pixels.
+
+Recall that the total profile magnitude or brightness that is specified
+with in the @option{--mcol} column of the input catalog is not an
+integration to infinity, but the actual sum of pixels in the profile (until
+the desired truncation radius). See @ref{Profile magnitude} for more on
+this point.
+
 @item --magatpeak
 The magnitude column in the catalog (see @ref{MakeProfiles catalog})
 will be used to find the brightness only for the peak profile pixel,



reply via email to

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