gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master bdaa44b 1/7: Library (arithmetic.h): sum opera


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master bdaa44b 1/7: Library (arithmetic.h): sum operator uses pixels in data with blank
Date: Mon, 4 Oct 2021 18:51:28 -0400 (EDT)

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

    Library (arithmetic.h): sum operator uses pixels in data with blank
    
    Until now, when the input to the 'sum' operator of the arithmetic library
    (and thus the Arithmetic program as well as column arithmetic in Table) was
    a floating point image that had blank values, all its pixels would be
    ignored!
    
    After looking into the code, I noticed that the problem was in the part
    that we check for blank images: instead of comparing each element with
    itself (to identify the NaN nature of the pixel), it was mistakenly always
    comparing with the first pixel! So unless a pixel value was non-NaN and it
    was exactly equal to the first image pixel, it would be ignored (assumed as
    blank!) in the summation process.
    
    With this commit, this coding typo has been corrected and the 'sum'
    operator works properly.
    
    This bug was found and reported by Giulia Golini and Raúl Infante-Sainz.
    
    This fixes bug #61244.
---
 NEWS                         | 3 +++
 THANKS                       | 1 +
 doc/announce-acknowledge.txt | 1 +
 lib/arithmetic.c             | 4 ++--
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 2f1beea..5050e42 100644
--- a/NEWS
+++ b/NEWS
@@ -156,6 +156,9 @@ See the end of the file for license conditions.
               before value, found and fixed by Sepideh Eskandarlou.
   bug #61192: BuildProgram custom program linking problems on Debian-based
               OSs, reported by Raúl Infante-Sainz.
+  bug #61244: Sum operator in arithmetic ignoring floating point images
+              with blank values, found and reported by Giulia Golini and
+              Raúl Infante-Sainz.
 
 
 
diff --git a/THANKS b/THANKS
index 6a0d777..d3b516c 100644
--- a/THANKS
+++ b/THANKS
@@ -46,6 +46,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Andrés García-Serra Romero           alu0101451923@ull.edu.es
     Zohreh Ghaffari                      zoh.ghaffari@gmail.com
     Thérèse Godefroy                     godef.th@free.fr
+    Giulia Golini                        giulia.golini@gmail.com
     Madusha Gunawardhana                 gunawardhana@strw.leidenuniv.nl
     Bruno Haible                         bruno@clisp.org
     Stephen Hamer                        stephen.hamer@univ-lyon1.fr
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index d168bbf..089bb2f 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -4,6 +4,7 @@ Alejandro Serrano Borlaff
 Fernando Buitrago
 Mark Calabretta
 Zohreh Ghaffari
+Giulia Golini
 Leslie Hunt
 Raúl Infante-Sainz
 Matthias Kluge
diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index ec646c4..ba77b23 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -1124,8 +1124,8 @@ struct multioperandparams
             /* Only integers and non-NaN floats: v==v is 1. */          \
             if(p->hasblank[i])                                          \
               use = ( b==b                                              \
-                      ? ( a[i][j]!=b     ? 1 : 0 )       /* Integer */  \
-                      : ( a[i][j]==*a[i] ? 1 : 0 ) );    /* Float   */  \
+                      ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
+                      : ( a[i][j]==a[i][j] ? 1 : 0 ) );  /* Float   */  \
             else use=1;                                                 \
                                                                         \
             /* Use in sum if necessary. */                              \



reply via email to

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