gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 682eb3bf: Library (arithmetic): mknoise-poisso


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 682eb3bf: Library (arithmetic): mknoise-poisson using each pixel for scatter
Date: Wed, 3 May 2023 09:59:38 -0400 (EDT)

branch: master
commit 682eb3bf112ba48db02f38c7d33f80a2a0b6b9c4
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Library (arithmetic): mknoise-poisson using each pixel for scatter
    
    Until now, the 'mknoise-poisson' operator of Arithmetic was using only the
    first pixel/element of the input dataset (image or table column) to define
    the scatter of its Poisson distribution (which is approximated with a
    Gaussian where the background is added to each pixel value). This was a
    mistake in the coding!
    
    With this commit, it now properly uses each separate pixel to define the
    scatter and loop goes over that also.
    
    This bug was reported by Irene Pintos Castro.
    
    This fixes bug #64138.
---
 NEWS                         | 2 ++
 doc/announce-acknowledge.txt | 2 +-
 lib/arithmetic.c             | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 5d79a663..d4a98199 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ See the end of the file for license conditions.
 ** Changed features
 
 ** Bugs fixed
+  bug #64138: Arithmetic's mknoise-poisson only using first pixel value.
+              Reported by Irene Pintos Castro.
 
 
 
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 8754433c..f31500d7 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,6 +1,6 @@
 Alphabetically ordered list to acknowledge in the next release.
 
-
+Irene Pintos Castro
 
 
 
diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index 66fd9d45..af4edd37 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -875,7 +875,7 @@ arithmetic_mknoise(int operator, int flags, gal_data_t *in,
           d[i] += gsl_ran_gaussian(rng, arg_v);
           break;
         case GAL_ARITHMETIC_OP_MKNOISE_POISSON:
-          d[i] += arg_v + gsl_ran_gaussian(rng, sqrt( arg_v + *d ));
+          d[i] += arg_v + gsl_ran_gaussian(rng, sqrt( arg_v + d[i] ));
           break;
         case GAL_ARITHMETIC_OP_MKNOISE_UNIFORM:
           d[i] += ( (gsl_rng_uniform(rng)*arg_v) - (arg_v/2) );



reply via email to

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