[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 170cd121: MakeProfiles: properly account for N
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 170cd121: MakeProfiles: properly account for NaN pixels in custom inputs |
Date: |
Sun, 9 Oct 2022 16:54:27 -0400 (EDT) |
branch: master
commit 170cd1217cc75425118d663b9e2104688c9088a0
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
MakeProfiles: properly account for NaN pixels in custom inputs
Until now, when a custom input (profile or image) had a NaN pixel and the
user hadn't given the '--mcolnocustimg' or '--mcolnocustprof' options,
MakeProfiles would create a fully NaN image.
With this commit, the problem has been fixed in the step that we calculate
the sum of the raw profile: we now only add pixels to the sum that are not
NaN.
This bug was reported by Nafise Sedighi.
This fixes bug #63189.
---
NEWS | 2 ++
bin/mkprof/oneprofile.c | 2 +-
doc/announce-acknowledge.txt | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 7306630c..6a0c4493 100644
--- a/NEWS
+++ b/NEWS
@@ -277,6 +277,8 @@ See the end of the file for license conditions.
with values close to saturation-level.
bug #63022: psf-scale-factor not saving the result in the output file,
found and fixed by Raul Infante-Sainz.
+ bug #63189: MakeProfiles custom profiles become NaN with a single row
+ being NaN, reported by Nafise Sedighi.
diff --git a/bin/mkprof/oneprofile.c b/bin/mkprof/oneprofile.c
index a5340807..673359b4 100644
--- a/bin/mkprof/oneprofile.c
+++ b/bin/mkprof/oneprofile.c
@@ -848,7 +848,7 @@ oneprofile_make(struct mkonthread *mkp)
{
/* First get the sum of all the pixels in the profile. */
ff=(f=mkp->ibq->image->array) + mkp->ibq->image->size;
- sum=0.0f; do sum+=*f++; while(f<ff);
+ sum=0.0f; do sum+= isnan(*f) ? 0.0f : *f; while(++f<ff);
/* Correct the fraction of brightness that was calculated
accurately (not using the pixel center). */
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 2d87d3b2..53b8b205 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -6,6 +6,7 @@ Sepideh Eskandarlou
Giulia Golini
Raul Infante-Sainz
Teet Kuutma
+Nafise Sedighi
Richard Stallman
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 170cd121: MakeProfiles: properly account for NaN pixels in custom inputs,
Mohammad Akhlaghi <=