gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 08360c4: MakeCatalog can take a variance image


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 08360c4: MakeCatalog can take a variance image instead of standard deviation
Date: Tue, 20 Mar 2018 11:59:16 -0400 (EDT)

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

    MakeCatalog can take a variance image instead of standard deviation
    
    Some surveys provide the weight image in units of variance, not standard
    deviation. So until now the user had to run Arithmetic to take its square
    root and convert it to standard deviation, then feed the image into
    MakeCatalog. Since this step is so trivial and an extra file can be really
    annoying (especially on large files), a new option called `--variance' is
    now available in MakeCatalog. When it is called, MakeCatalog will take the
    square root of the input STD image prior to processing it.
    
    Also, the NEWS file format was updated to a more clear to find format with
    only one line per option/library/bug in the release.
---
 NEWS                      | 67 +++++++++++++++++++----------------------------
 bin/mkcatalog/args.h      | 13 +++++++++
 bin/mkcatalog/main.h      |  1 +
 bin/mkcatalog/mkcatalog.c | 10 +++++++
 bin/mkcatalog/ui.h        |  1 +
 doc/gnuastro.texi         |  8 +++++-
 6 files changed, 59 insertions(+), 41 deletions(-)

diff --git a/NEWS b/NEWS
index f53ebb3..18fd17f 100644
--- a/NEWS
+++ b/NEWS
@@ -5,25 +5,19 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
 ** New features
 
-  ConvertType: TIFF images can also be used as input into ConvertType,
-  therefore libtiff has been added as a new optional dependency.
+  ConvertType:
+    - TIFF images can also be used as input.
 
-  MakeCatalog: The new `--mean' and `--median' options will calculate the
-  mean and median pixel value within an object or clump respectively.
+  MakeCatalog:
+    --variance: input STD image is variance (so take square root before use).
+    --mean: calculate the mean pixel value within an object or clump.
+    --median: calculate the median pixel value within an object or clump.
+    --upperlimitsigma: position in random distribution (in units of sigma).
+    --upperlimitquantile: position in random distribution (quantile).
+    --upperlimitonesigma: 1sigma value of the random distribution.
 
-  MakeCatalog: The new `--upperlimitsigma' and `--upperlimitquantile'
-  columns will report the postion of the object's brightness with respect
-  to the distribution of randomly measured values. The former as a multiple
-  of sigma and the latter as a quantile. Also, `--upperlimitonesigma' will
-  return the 1-sigma value of the randomly placed upper limit magnitudes
-  (irrespective of the value given to `--upnsigma').
-
-  NoiseChisel: a value of `none' to the `--kernel' option will disable
-  convolution.
-
-  Statistics: the new `--manualbinrange' allows the bins in histograms or
-  cumulative frequency plots to be set outside the minimum or maximum
-  values of the dataset.
+  Statistics:
+    --manualbinrange: histogram or CFP range can be outside of distribution.
 
   Libraries:
     gal_array_read: read from file with all known formats (FITS, TIFF, etc).
@@ -48,12 +42,14 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
 ** Changed features
 
-  Fits: The `--comment' and `--history' command may be called multiple
-  times to write multiple COMMENT/HISTORY keywords into the input FITS
-  file.
+  Fits:
+    --history: can be called/written multiple times in one run.
+    --comment: can be called/written multiple times in one run.
 
-  Libraries:
+  NoiseChisel:
+    --kernel: value `none' will disable convolution.
 
+  Libraries:
    - `gal_fits_img_read': now only reads the data not the WCS, therefore it
      no longer needs the last two arguments. A subsequent call to
      `gal_wcs_read' can be used to read the WCS information in the file.
@@ -68,25 +64,16 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
 ** Bug fixes
 
-  Many unused result warnings for asprintf in some compilers (bug #52979).
-
-  Configure time CPPFLAGS and LDFLAGS don't pass to BuildProgram (bug #53122).
-
-  Crash when printing values with the `--onlyversion' option (bug #53142).
-
-  NULL value of onlyversion option causing a crash (bug #53147).
-
-  Match output directory ignored when making multiple files (bug #53226).
-
-  Statistics program bad results on integer columns with limits (bug #53230).
-
-  NoiseChisel crash when no growth is possible (bug #53268).
-
-  MakeCatalog parses area larger than clump (bug #53295).
-
-  NoiseChisel crash when there is no detection (bug #53304).
-
-  Fits crash on keyword editing (except --delete) (bug #53312).
+  bug #52979: Many unused result warnings for asprintf in some compilers.
+  bug #53122: Configure time CPPFLAGS and LDFLAGS don't pass to BuildProgram.
+  bug #53142: Crash when printing values with the `--onlyversion' option.
+  bug #53147: NULL value of onlyversion option causing a crash.
+  bug #53226: Match output directory ignored when making multiple files.
+  bug #53230: Statistics program bad results on integer columns with limits.
+  bug #53268: NoiseChisel crash when no growth is possible.
+  bug #53295: MakeCatalog parses area larger than clump.
+  bug #53304: NoiseChisel crash when there is no detection.
+  bug #53312: Fits crash on keyword editing (except --delete).
 
 
 
diff --git a/bin/mkcatalog/args.h b/bin/mkcatalog/args.h
index 3a547fe..0389d72 100644
--- a/bin/mkcatalog/args.h
+++ b/bin/mkcatalog/args.h
@@ -175,6 +175,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "variance",
+      UI_KEY_VARIANCE,
+      0,
+      0,
+      "Image given as STD is actually variance.",
+      GAL_OPTIONS_GROUP_INPUT,
+      &p->variance,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
 
 
 
diff --git a/bin/mkcatalog/main.h b/bin/mkcatalog/main.h
index 5fb5ed0..5e6e6ad 100644
--- a/bin/mkcatalog/main.h
+++ b/bin/mkcatalog/main.h
@@ -155,6 +155,7 @@ struct mkcatalogparams
 
   float             zeropoint;  /* Zero-point magnitude of object.      */
   uint8_t       skysubtracted;  /* If image is already sky subtracted.  */
+  uint8_t            variance;  /* Input STD file is actually variance. */
   float             threshold;  /* Only use values above this threshold.*/
   float           sfmagnsigma;  /* Surface brightness multiple of sigma.*/
   float             sfmagarea;  /* Surface brightness area (arcsec^2).  */
diff --git a/bin/mkcatalog/mkcatalog.c b/bin/mkcatalog/mkcatalog.c
index 29e0ae7..9e224f6 100644
--- a/bin/mkcatalog/mkcatalog.c
+++ b/bin/mkcatalog/mkcatalog.c
@@ -1098,6 +1098,16 @@ mkcatalog_write_outputs(struct mkcatalogparams *p)
 void
 mkcatalog(struct mkcatalogparams *p)
 {
+  float *f, *fp;
+
+  /* If the given standard deviation array is actually variance, then take
+     its square root. */
+  if(p->variance)
+    {
+      fp = (f=p->std->array) + p->std->size;
+      do *f=sqrt(*f); while(++f<fp);
+    }
+
   /* When more than one thread is to be used, initialize the mutex: we need
      it to assign a column to the clumps in the final catalog. */
   if( p->cp.numthreads > 1 ) pthread_mutex_init(&p->mutex, NULL);
diff --git a/bin/mkcatalog/ui.h b/bin/mkcatalog/ui.h
index c161970..b8ef3e5 100644
--- a/bin/mkcatalog/ui.h
+++ b/bin/mkcatalog/ui.h
@@ -86,6 +86,7 @@ enum option_keys_enum
   UI_KEY_SKYHDU,
   UI_KEY_STDHDU,
   UI_KEY_ZEROPOINT,
+  UI_KEY_VARIANCE,
   UI_KEY_SFMAGNSIGMA,
   UI_KEY_SFMAGAREA,
   UI_KEY_UPMASKFILE,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 6fbd54e..beeace8 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -15306,11 +15306,17 @@ The HDU of the Sky value image.
 
 @item -t STR
 @itemx --stdfile=STR
-File name of image keeping the Sky value standard deviation for each pixel.
+File name of image keeping the Sky value standard deviation for each
+pixel. With the @option{--variance} option you can tell MakeCatalog to
+interpret this image as a variance image, not standard deviation.
 
 @item --stdhdu=STR
 The HDU of the Sky value standard deviation image.
 
address@hidden --variance
+The image given to @option{--stdfile} has the variance of every pixel, not
+standard deviation.
+
 @end table
 
 



reply via email to

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