gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 9e1348f: Interpolate library: reset flag to pr


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 9e1348f: Interpolate library: reset flag to properly sort neighbors
Date: Tue, 19 Feb 2019 15:48:48 -0500 (EST)

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

    Interpolate library: reset flag to properly sort neighbors
    
    Until now, in `gal_interpolate_close_neighbors', we weren't re-initializing
    the flags of the interpolated neighbors prior to interpolation. As a
    result, after finding the median value for the first time on each thread,
    no other value was sorted any more (the median finding function would
    assume it is already sorted because of the flag!).
    
    This directly affected NoiseChisel in a very bad way: On the tiles where
    outlier values fell right in the middle of the list of good neighbor
    values, the outlier would be reported as the median (because the median is
    the middle value!). In practice, this caused diamond like structures around
    outlier tiles during NoiseChisel's threshold finding and Sky estimation
    steps.
    
    The fix to the problem was a single line before calling the median function
    to reseting the sort and blank flags of the input dataset.
    
    This bug came up during a discussion with Roberto Baena Gallé.
    
    This fixes bug #55740.
---
 NEWS                         | 1 +
 THANKS                       | 1 +
 doc/announce-acknowledge.txt | 1 +
 lib/interpolate.c            | 4 +++-
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index ab729be..50bf5bd 100644
--- a/NEWS
+++ b/NEWS
@@ -117,6 +117,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   bug #55478: Memory mapping crashes when .gnuastro is not writable.
   bug #55491: NoiseChisel crash when no tiles good for quantile thresholding.
   bug #55544: Arithmetic's output WCS with where operator is not as expected.
+  bug #55740: Diamond shapes in nearst-ngb interpolation affecting NoiseChisel.
 
 
 
diff --git a/THANKS b/THANKS
index 6f34d21..c803745 100644
--- a/THANKS
+++ b/THANKS
@@ -18,6 +18,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Valentina Abril-melgarejo            address@hidden
     Marjan Akbari                        address@hidden
     Roland Bacon                         address@hidden
+    Roberto Baena Gallé                  address@hidden
     Karl Berry                           address@hidden
     Leindert Boogaard                    address@hidden
     Nicolas Bouché                       address@hidden
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 8e5463a..02c7b76 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,5 +1,6 @@
 Alphabetically ordered list to acknowledge in the next release.
 
+Roberto Baena Gallé
 Leindert Boogaard
 Raúl Infante Sainz
 David Valls-Gabaud
diff --git a/lib/interpolate.c b/lib/interpolate.c
index 8cd99c5..8277afc 100644
--- a/lib/interpolate.c
+++ b/lib/interpolate.c
@@ -257,7 +257,9 @@ interpolate_close_neighbors_on_thread(void *in_prm)
       tout=prm->out;
       for(tnear=nearest; tnear!=NULL; tnear=tnear->next)
         {
-          /* Find the median and copy it. */
+          /* Find the median and copy it, but first, reset the flags (which
+             remain from the last time). */
+          tnear->flag &= ~(GAL_DATA_FLAG_SORT_CH | GAL_DATA_FLAG_BLANK_CH);
           median=gal_statistics_median(tnear, 1);
           memcpy(gal_pointer_increment(tout->array, fullind, tout->type),
                  median->array, gal_type_sizeof(tout->type));



reply via email to

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