[Top][All Lists]

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

[gnuastro-commits] master d428942 2/2: MakeCatalog: correctly using aver

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d428942 2/2: MakeCatalog: correctly using average river flux x clump area
Date: Mon, 25 Nov 2019 15:13:37 -0500 (EST)

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

    MakeCatalog: correctly using average river flux x clump area
    Until now, due to some previous mistake in editing MakeCatalog, it was
    mistakenly subtracting the total river flux (around each clump) from the
    total clump flux when calculating the S/N! But this is wrong!!! It should
    be like this: the total clump flux should be divided by the mean river
    flux, multiplied by the number of clump pixels used. This resulted in
    negative S/N values in some situations.
    With this commit, it has been implemented properly.
    This bug was found by Joseph Putko.
    This fixes bug #57301.
 NEWS                    | 1 +
 bin/mkcatalog/columns.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 938cb10..66fef15 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ See the end of the file for license conditions.
 ** Bugs fixed
   bug #57300: MakeCatalog memory crash when input dataset has units.
+  bug #57301: MakeCatalog using river sum instead of mean times by clump area.
diff --git a/bin/mkcatalog/columns.c b/bin/mkcatalog/columns.c
index 666f1c3..eadd88d 100644
--- a/bin/mkcatalog/columns.c
+++ b/bin/mkcatalog/columns.c
@@ -1597,8 +1597,10 @@ columns_sn(struct mkcatalogparams *p, double *row, int 
   /* When grown clumps are requested from NoiseChisel, some "clumps" will
      completely cover their objects and there will be no rivers. So if this
      is a clump, and the river area is 0, we should treat the S/N as a an
-     object. */
-  double O = (o0c1 && row[ CCOL_RIV_NUM ]) ? row[ CCOL_RIV_SUM ] : 0.0 ;
+     object (and set the outer flux to 0.0). */
+  double O = ( (o0c1 && row[ CCOL_RIV_NUM ])
+               ? (row[ CCOL_NUM ]*row[ CCOL_RIV_SUM ]/row[ CCOL_RIV_NUM ])
+               : 0.0 );
   /* Return the derived value. */
   return sqrt(1/p->cpscorr) * (I-O) / columns_brightness_error(p, row, o0c1);

reply via email to

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