gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 2f44992 1/2: Library (arithmetic.h): using 0 f


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2f44992 1/2: Library (arithmetic.h): using 0 for sigclip-number instead of blank
Date: Sat, 18 Dec 2021 14:56:48 -0500 (EST)

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

    Library (arithmetic.h): using 0 for sigclip-number instead of blank
    
    Until now (in the previous commit), we simply used NaN for all the
    'sigclip-*' operators of the arithmetic library. However, for the
    'sigclip-number' operator, blank is meaningless! Its just a counter and a
    counter is 0 for the case that there is no data.
    
    With this commit, when 'sigclip-number' is used and there is no data,
    instead of a NaN, we write 0.
---
 lib/arithmetic.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index bff7456..4c13bb5 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -1323,7 +1323,7 @@ struct multioperandparams
         /* Read the necessay values from each input. */                 \
         for(i=0;i<p->dnum;++i) pixs[n++]=a[i][j];                       \
                                                                         \
-        /* If there are any elements, measure the  */                   \
+        /* If there are any usable elements, measure the  */            \
         if(n)                                                           \
           {                                                             \
             /* Calculate the sigma-clip and write it in. */             \
@@ -1348,8 +1348,10 @@ struct multioperandparams
             cont->size=cont->dsize[0]=p->dnum;                          \
           }                                                             \
         else                                                            \
-          o[j]=NAN; /* Not using 'b' because input can be inter, but */ \
-      }                                   /* output is always float. */ \
+          o[j] = ( p->operator==GAL_ARITHMETIC_OP_SIGCLIP_NUMBER        \
+                   ? 0.0    /* Not using 'b' because input can be an */ \
+                   : NAN );   /* integer but output is always float. */ \
+      }                                                                 \
                                                                         \
     /* Clean up (note that 'pixs' is inside of 'cont'). */              \
     gal_data_free(cont);                                                \



reply via email to

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