taskGNU Astronomy Utilities - Tasks: task #13565, Add non-linear warpings.

 
 

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

task #13565: Add non-linear warpings.

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Mon 20 Apr 2015 06:31:32 AM UTC
 
Should Start On:  Sun 19 Apr 2015 03:00:00 PM UTC Should be Finished on:  Sun 19 Apr 2015 03:00:00 PM UTC
Category:  Warp Priority:  3 - Low
Item Group:  New feature Status:  In Progress
Privacy:  Public Percent Complete:  60%
Assigned to:  pedram Open/Closed:  Open
Effort:  0.00

( Jump to the original submission )

Wed 09 Feb 2022 06:40:56 PM UTC, comment #6: 

OK forget it, I am uploading it here :-)

Pedram Ashofteh Ardakani <pedram>
Project Member
Wed 09 Feb 2022 06:31:35 PM UTC, comment #5: 

OK, it looks like the 'tpv-aligned-warp.fits' file was not uploaded successfully. I am submitting it now. It looks like savannah does not indicate if the file is uploaded completely before submitting. So I will wait a bit before submitting this comment.

Pedram Ashofteh Ardakani <pedram>
Project Member
Wed 09 Feb 2022 06:25:33 PM UTC, comment #4: 

Hi all. I have been working on nonlinear warp with Mohammad on this git branch.

You can see a comparison between the original image (file tpv.fits), SWARP output (file tpv-aligned-swarp.fits), and gnuastro's still in development warp program (file tpv-aligned-warp.fits).

Warp is using the 'gal_wcs_img_to_world' and 'gal_wcs_world_to_img' functions based on WCSLIB to put the nonlinear distortions into effect.

Here is a summary of what goes on under the hood. First, we project all four corners of the input image from pixel coordinates to RA and Dec using 'gal_wcs_img_to_world'. This puts the nonlinear distortions into effect. With this, we can find out the min and max RA and Dec values for this image. Then, using the user-given pixel scale (or the average of both pixel scales by default), the output image size is defined.

Now that the output image size is determined, we sweep the output image pixels one by one and project them back to the original image to see how much of each input image pixels is covered by the corresponding output image. For instance, see (file coverage.jpg).

In image (file coverage.jpg) it is shown that the 200th pixel of the output image, is covering pixels 611, 612, 633, and 634 of the input image. The 200th pixel corners are shown in points 0, 1, 2, and 3 marked with 'x' in cyan color. The smaller red boxes show the input image pixel center, with their number on the left, and value after the ':'. For example, the top left red input pixel is the 633th pixel, with value 2724.98. The larger red box shows all input pixels that are partially covered by the output pixel.

Now, the percentage of overlap between the output pixel (connect the cyan points in anti-clockwise order by their number) and the input pixels are calculated. For example, pixel 633 has the most, and 611 the least coverage percentage. Let's say that the output pixel is covering about 70% of pixel 633. In this case, we check pixel 633's value (i.e. 2724.98) and multiply by the amount of coverage (i.e. 0.7). Then, we'd do the same for the other three. In the final step, all four values are added up and stored in pixel 200 of the output image.

Note that if the pixel coverage is too small, we'll use NaN for that pixel. For instance, when the output pixel is not covering any of the input pixel (yes, this happens on outer perimeter of the image!).

The final step is to correct the output image's WCS, which is a work in progress. You can use astwarp in its early stage for astrometry as soon as the WCS is calculated (we're almost there).

Again, you can inspect the source code on this git branch. Any comments would be appreciated.

Please let me know if you have any questions or concerns.

(file #52827, file #52828,

Pedram Ashofteh Ardakani <pedram>
Project Member
Mon 16 Mar 2020 05:52:59 PM UTC, comment #3: 

By the way, another good program that can be a good reference are SWarp (source on Github) and SCAMP (source on Github). The good news is that both these programs are in C and they are very commonly used many astronomical projects.

Even though its in C, the problem is that all the good code in these software are locked inside of them. We need to study that code (as well as the other nice software mentioned before) and write this job in a modular C library format that is usable generally and without so many dependencies ;-).

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Mon 16 Mar 2020 02:44:20 AM UTC, comment #2: 

Thanks for the nice review. Generally in astronomy data (the FITS standard), the World Coordinate System (WCS, Section 8 of that paper, see references in the first paragraph of that section) also has standards to define distortions.

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Sun 15 Mar 2020 10:32:20 PM UTC, comment #1: 

This paper gives a very nice method to correct optical distortion, which can also fix the sky distortion problem. The Wikipedia page also suggest a similar way but its a bit complex. In all these methods there is the distortion coefficient(k) is required. Now this paper provides an analytical way to find the coefficient. But it's complex to implement(thoughts?). We can just ask the user to provide these coefficients based on their own calibrations.

 

For celestial coordinate mapping this Wikipedia section provides good transformations required. I think we might need to use and/or modify the `wcs' library for its implementation.

For weak lensing this paper seems to pose many challenges on its implementation, so we can let go of this for the time being.

Sachin Kumar Singh <sks_15>
Project Member
Mon 20 Apr 2015 06:31:32 AM UTC, original submission:  

Currently only homographic (linear) warpings are included. Allow for non-linear warpings for applications like correcting optical distortion, celestial coordinate mapping or weak lensing.

Mohammad Akhlaghi <makhlaghi>
Project Administrator

 

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

Attached Files
file #52827:  tpv.fits added by pedram (1MiB - image/fits)
file #52828:  tpv-aligned-swarp.fits added by pedram (1MiB - image/fits)
file #52829:  coverage.jpg added by pedram (73KiB - 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 pedram (Updated the item)
  • -email is unavailable- added by sks_15 (Posted a comment)
  • -email is unavailable- added by makhlaghi (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-09 pedram Attached File- Added tpv.fits, #52827
        Attached File- Added tpv-aligned-swarp.fits, #52828
        Attached File- Added coverage.jpg, #52829
        StatusPostponed In Progress
        Percent Complete0% 60%
        Assigned toNone pedram

    Back to the top


    Powered by Savane 3.9