taskGNU Astronomy Utilities - Tasks: task #16272, FITS image to display area change...

 
 

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

task #16272: FITS image to display area change due to distortion

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Thu 06 Oct 2022 05:43:49 PM UTC
   
 
Should Start On:  Wed 05 Oct 2022 11:00:00 PM UTC Should be Finished on:  Wed 05 Oct 2022 11:00:00 PM UTC
Category:  Fits Priority:  5 - Normal
Item Group:  Enhancement Status:  Done
Privacy:  Public Assigned to:  pedram
Percent Complete:  100% Open/Closed:  Closed
Effort:  0.00

Jump to the original submission

Sun 16 Oct 2022 10:56:31 PM UTC, comment #6: 

Thanks a lot Pedram! It has been merged to the master branch as Commit 7b8861d4a.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sun 16 Oct 2022 04:12:11 PM UTC, comment #5: 

Thank you for your feedback, here is the updated commit [1]. It has quite many changes, but it is rebased on 'master' and in squashed to one commit for easier review. Thanks in advance 🙌 I'll put some results in bug #63171 as well 🧑‍💻

[1] https://codeberg.org/pedramardakani/gnuastro/src/branch/fits-pixelonarea

P.S: Commit message

Author: Pedram Ashofteh-Ardakani <pedramardakani@pm.me>
Date:   Fri Oct 14 19:49:54 2022 +0330

    Fits, Warp, and Book: add '--pixareaonwcs'
   
    Until now, the users could read the pixel area value determined by the WCS
    keywords using the '--pixelarea' option. However they had no way of knowing
    how much of an area (in degrees) each input image pixel has. Knowing this
    variable could help with better understanding origin of the gradients on
    the aligned (warped) image.
   
    Although the pixel area value does not vary too much in small distances,
    this difference will create a gradient in images when taking the "accurate"
    pixel area (i.e. each pixel calculated individually from its corners in
    World Coordinates).
   
    The new '--pixareaonwcs' function serves the purpose to show the users
    the most accurate pixel area calculated completely based on pixels corners
    in its given WCS. Since '--pixareaonwcs' is actually an alias for Warp's
    '--edgesampling', users can pass integers greater than zero '0' to improve
    the accuracy even more. But they must know that this will increase
    computation time and the memory needed.
   
    These changes were made in this commit as well:
   
    - Change the 'warp_wcsalign_init_vertices' output from 'gal_data_t' to
      'void' since we have already defined its output (vertices) in
      'gal_warp_wcsalign_t' as the 'vertices' internal variable; Hence, we
      don't need to pass the pointer anymore.
   
    - Added the 'warp_check_basic_params' and 'warp_wcsalign_init_internals' to
      prevent repeating these initializations in the newly defined
      'gal_warp_pixelarea_onwcs' function.
   
    - The 'keyword.h' file of the Fits program held the boilerplate 'HEADER_H'
      value. This commit fixes it to the correct 'KEYWORD_H' value.
   
    - Fixed the typo in the comments of 'bin/fits/main.c' file.
   
    - In the gnuastro manual, now the typo in the library linked lists of
      strings section for the 'gal_list_str_last' which returns a
      'gal_list_str_t *' and not a 'size_t' is fixed.
   
    - Print timing reports if program is not in '--quiet' mode.
   
    - Write the configuration parameters in HDU '1' of the output image.
   
    - Write the documentation updating both Fits and Warp, with examples.
   
    - Update my name in previous text with a hyphen and place the missing 'h'
      in a few cases. So the correct form would be "Pedram Ashofteh-Ardakani"

Pedram Ashofteh-Ardakani <pedram>
Group Member
Thu 13 Oct 2022 09:14:09 AM UTC, comment #4: 

Sure, I'll fix it right away :) Thanks for your reply!

Pedram Ashofteh-Ardakani <pedram>
Group Member
Wed 12 Oct 2022 03:20:23 PM UTC, comment #3: 

Thanks Pedram. Just one thing: visualizing the distortion is not just useful for warping, it is generally useful in many different scenarios. That is why I recommended to add this option to the Fits program, not the Warp program (similar to how '--skycoverage' is an option to the Fits program).

When you get the chance, can you add this feature in the FITS program and keep it separate from Warp?

I just had a fast look at the code and couldn't find the time to look at it in detail. So sorry if I missed this. But if I understood this properly, the output of the current implementation is the same size as the output of Warp. However, as mentioned in the initial suggestion: "The output 'pixarea.fits' will have the same size and same WCS as the input ...".

Mohammad Akhlaghi <makhlaghi>
Group administrator
Mon 10 Oct 2022 02:45:33 PM UTC, comment #2: 

Done. Here's the developing branch [1].

[1] https://codeberg.org/pedramardakani/gnuastro/src/branch/pixelonarea

Pedram Ashofteh-Ardakani <pedram>
Group Member
Mon 10 Oct 2022 07:19:04 AM UTC, comment #1: 

Sure Mohammad, this looks interesting. I'll start working on this ASAP 🐝

Pedram Ashofteh-Ardakani <pedram>
Group Member
Thu 06 Oct 2022 05:43:49 PM UTC, original submission:  

Distortion (or even projection on large scales) causes different pixels to have different sizes on the World Coordinate System. With DS9, we can see the effect of the distortions on the coordinate system as lines, but we don't see the changes in area on a per-pixel case. However, this is important to understand when confronted with a new image with a new distortion (see bug #63171).

Therefore it wold be good to have an option in the Fits program for this job, that would be called like this:


$ astfits img.fits --pixareaonwcs --output=pixarea.fits


The output 'pixarea.fits' will have the same size and same WCS as the input, however, the pixel values will show the area of that pixel on the WCS (for example if the two CUNITi values are 'deg', it the pixel values will be in units of deg^2; this can be multiplied by 3600x3600 to be in units of arcsec^2, or divided by the pixel scale to show change in units of pixels). The resulting grid should clearly show the distortion pattern.

Thanks to the features in the newly added warp.c and warp.h library, we already have functions to calculate the WCS coordinates all the pixel edges. We can then use the polygon area functions to calculate the area of the polygon of each input pixel on the sphere (in the case of celestial coordinates).

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 pedram (Posted a comment)
  • -email is unavailable- added by pedram
  • -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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-16 makhlaghi StatusPostponed Done
        Percent Complete50% 100%
        Open/ClosedOpen Closed
    2022-10-16 pedram Percent Complete0% 50%
    2022-10-10 pedram Carbon-Copy- Added pedram

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code