bugGNU Astronomy Utilities - Bugs: bug #65561, Projections to infinity in Warp

 
 

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

bug #65561: Projections to infinity in Warp

Submitter:  Giacomo Lorenzetti <glorenzetti>
Submitted:  Fri 05 Apr 2024 05:26:24 PM UTC
   
 
Category:  Warp Severity:  3 - Normal
Item Group:  Crash Status:  Fixed
Privacy:  Public Assigned to:  glorenzetti
Open/Closed:  Closed

Fri 12 Apr 2024 08:20:52 PM UTC, comment #5: 

Thanks a lot for the nice fix Giacomo, the Commits b17743906 and 262eb66fb have been merged into the 'master' branch and I verified that they fix the problem.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 09 Apr 2024 03:43:33 PM UTC, comment #4: 

Sorry, the steps written in the first message are not correct. Here are the correct ones:

$ astarithmetic 5000 5000 2 makenew 10 mknoise-sigma -o img.fits
$ astwarp img.fits --shear=0.2 --project=0.001,0.0005


The difference with the introductory message is in the pic's size: small figures are not affected by the bug (given those shear and project values). The reason is that in the mentioned case the problematic points are on a line with a negative slope and a positive intercept, hence affected pics are those that are big enough to "touch" that line.

Regarding the fix, we have decided a different approach, that doesn't led to an error message but that ignore those pixels, with negligible effects on the output.
Incidentally, we have found an optimization. It is implemented in a different commit, given that it doesn't seem to have an active role in solving the bug. The optimization highlights a misbehaviour (already present): it doesn't seem to affect sensibly the output, hence it will be addressed later, with low priority.

The suggested commits are stored in this branch: https://gitlab.cefca.es/glorenzetti/gnuastro/-/tree/warp_speedup_pr?ref_type=heads
(The fix alone is also present in the divzero_pr branch, if needed)

Giacomo Lorenzetti <glorenzetti>
Group Member
Sun 07 Apr 2024 10:45:13 AM UTC, comment #3: 

I also cloned your branch and ran the test in your branch. Interestingly, the error message wasn't printed and Warp finished successfully (like Gnuastro 0.22.26-75d7dd that produced the output of the comment below).

To see what is causing this strange situation, I just added the following line before the 'if(d==0.0f)' check in your branch (to see all the seperate numbers that go into the construction of 'd'). I also added the '-N1' option to warp so it runs on a single thread (and order is meaningful in the outputs)


  printf("%s: %f, %f, %f, %f, %f\n", __func__, t[6], v[0], t[7],
         v[1], t[8]);


The first thing I noticed was that more than 44108 lines were printed, showing that this function is indeed run four times for every pixel, not just the four corners of the whole image.

To help find the root cause for this strange situation, can you check to see if this bug also happens on your system, if you have a 3x3 pixel image? That would help debug the problem with simple printed values like this.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sun 07 Apr 2024 10:26:49 AM UTC, comment #2: 

Thanks Giacomo! After trying the problematic command, it worked without any delay on my computer and finished in 0.03 seconds! Below you can see a screenshot of the output:



We should investigate why this is happening on one computer and not another!

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 05 Apr 2024 05:35:16 PM UTC, comment #1: 
Giacomo Lorenzetti <glorenzetti>
Group Member
Fri 05 Apr 2024 05:26:24 PM UTC, original submission:  

Warping matrices such as:


$ astarithmetic 100 100 2 makenew 10 mknoise-sigma -o img.fits
$ astwarp img.fits --shear=0.2 --project=0.001,0.0005


Generates a projection to infinity (i.e. a division by zero). Due to undefined behaviours, the program fails to terminate.

Giacomo Lorenzetti <glorenzetti>
Group Member

 

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

Attached Files
file #55925:  shear-project.jpeg added by makhlaghi (144KiB - image/jpeg)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-12 makhlaghi StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2024-04-07 makhlaghi Attached File- Added shear-project.jpeg, #55925

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code