bugGNU Astronomy Utilities - Bugs: bug #62009, Mode becomes nan for large, pure...


You are not allowed to post comments on this tracker with your current authentication level.

bug #62009: Mode becomes nan for large, pure noise images

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Tue 08 Feb 2022 10:26:36 AM UTC
Category:  Statistics Severity:  3 - Normal
Item Group:  Output not reasonable Status:  Postponed
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Tue 08 Feb 2022 10:26:36 AM UTC, original submission:  

When a sufficiently large image with raw noise is given to Statistics to find its mode of its pixel distribution, it fails (returning a NaN). This bug can be reproduced with this command (running it multiple times will use a different random number generator; and therefore a different noised value for every pixel):

astarithmetic 2048 4096 2 makenew 10 mknoise-sigma --output=noise-large.fits

aststatistics noise-large.fits --mode

With Gnuastro 0.16.143-1427d (see [1] below), I tried the command above many times, and in all cases, the output of Statistics was NaN!

However, when I made a smaller noised image with the commands below, it worked perfectly:

astarithmetic 1000 2000 2 makenew 10 mknoise-sigma --output=noise-small.fits

aststatistics noise-small.fits --mode

Again, repeating this multiple times will mostly work: I did get a NaN for this size when the random number generator was 'ranlxs1', with a seed of  '1645053800' or '1644372467'. But generally it worked (for example with seeds of '1644613667', '1645245226' or '1644502467'). For how to set seeds, see the Generating random numbers section of the book.

We need to see what is happening with the mode-finding algorithm that it can't find the mode in these ideal cases (where the mode is approximately in the center, but with many points)!

[1] While writing this report, I found and fixed bug #62008, so please reproduce this bug with a more recent version of Gnuastro.

Mohammad Akhlaghi <makhlaghi>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Submitted the item)
  • -email is unavailable- added by makhlaghi

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-08 makhlaghi Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code