GNU Astronomy Utilities - Bugs: bug #48978, Bad coordinates in polygon mode do...
You are not allowed to post comments on this tracker with your current authentication level.
bug #48978: Bad coordinates in polygon mode do not abort
Submitter: | Mohammad Akhlaghi <makhlaghi> | ||
Submitted: | Fri 02 Sep 2016 05:21:34 PM UTC | ||
Category: | Crop | Severity: | 4 - Important |
Item Group: | Output not reasonable | Status: | Fixed |
Privacy: | Public | Assigned to: | vvm |
Open/Closed: | Closed |
Tue 03 Jan 2017 04:24:54 PM UTC, comment #3: |
Mohammad Akhlaghi <makhlaghi> |
Mon 02 Jan 2017 08:25:06 PM UTC, comment #2: I've tested the patch for a while. it looked good for catching extra characters as you wrote in your post (extra dot) and cases like putting accidentally editing in VIM a bash script (e.g, sometimes I type extra 'i' when changing VIM mode: "polygon=1.01i:2.0").
|
Vladimir Markelov <vvm> |
Mon 02 Jan 2017 08:19:33 PM UTC, comment #1: Hi! I'm back with a small patch for parsing polygon point list. I assumed that the polygon point list is always a list of floating point numbers separated with ',' and ':'.
|
Vladimir Markelov <vvm> |
Fri 02 Sep 2016 05:21:34 PM UTC, original submission:
In the values to the `--polygon' option, when a coordinate has two `.'s in it, ImageCrop will not halt with an error. Instead, it will continue and not give any error at all.
|
Mohammad Akhlaghi <makhlaghi> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
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 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2017-01-03 | makhlaghi | Status | In Progress | Fixed | |
Assigned to | None | vvm | |||
Open/Closed | Open | Closed | |||
2017-01-02 | vvm | Status | Confirmed | In Progress |
Powered by Savane 3.13-758e.
Corresponding source code
Thanks a lot Vladimir, I also checked with a few other bad numbers, and it works. Thanks also for the very complete and thorough commit message. It has been pushed to the main repo.
I just added some comments above your correction in the code, so the reader can get an idea of the purpose of this check without having to look up the history or mentally building scenarios. I also added some blank lines in the commit message for fitting better with the other commits.
The issue you raised about the negative number was interesting. Its not a bug, ImageCrop was working! Let me explain: In the FITS standard, we define the pixel resolution (in units of degree/pixel) using the `PC1_1' and `PC2_2' header keywords (when the image is aligned with the celestial grid). You can see them with Gnuastro's Header program:
This says that each pixel is -1.66666666245874E-06, or that each degree is 600000 pixels (this is roughly the Hubble Space Telescope resolution). So by changing the polygon vertice from `1.0013217' to `-1.0013217', you have practically asked for the vertice to be 2 degrees below what it was meant to be and the image would be more than one million pixels along one dimension.
To confirm this, I done this change (and added the `--keepblankcenter' option, since the center will be blank and ImageCrop will delete it by default) and waited a little. On my system after about 30 seconds, the final image was made. It was 4.6GB and had a size of 960 x 1202018 pixels!
So fortunately this wasn't a bug, but you did raise an important point: A sanity check can be defined when we are in WCS mode (`p->wcsmode==1'), just before adding the coordinate to the list (with `gal_linkedlist_add_to_tdll'). In general, the right ascension (or first coordinate) should be between `0<=RA<360' and the declination should be between `-90<Dec<90'. Since you raised this limits issue could you implement this small check and post it as a task?