gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #63171] Strange patterns on warped images


From: Pedram Ashofteh Ardakani
Subject: [bug #63171] Strange patterns on warped images
Date: Tue, 11 Oct 2022 16:16:03 -0400 (EDT)

Follow-up Comment #13, bug #63171 (project gnuastro):

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.

Thank you both Mohammad and Raul for your replies!

Mohammad, I kept working on the big images, but I'll do it with the smaller
ones as you suggested as well! Thanks for the tip :-)

Raul you've done a great job with this investigation :-)

I've got some INTERESTING results :-) But I don't know how to put the
images under each section (comment#7), so please refer to them and scroll
back up while reading this.

## Considerations

First, while making the noise, I thought maybe using the same random seed
could be beneficial, so I exported the GSL_RNG_SEED for reproducible
results.

Second, I found out my 'grep' alias which has the '--color=always' option,
is not letting 'astfits' actually '--delete' the PV coefficients! That's
why I added the '--color=never' option.

Third, just removing the PV coefficients weren't enough! Please don't
forget to update the CTYPE1 and CTYPE2 values to a TAN projection as well!

Fourth, when investigating the images with ds9 regions, I chose the 'box'
shape, and set the size to 100x100 and angle to '0' manually. That is
because using 'circles' on 'square' pixels can mess up the statistics
easily!

Now the code I used after Raul's additions (essentially they're the same,
just with taking the notes above into account):

## Initialization


# DRY! To keep things tidy and error-free
RUN_SWARP_ON_TO ()
{
  swarp "$1" -SUBTRACT_BACK N \
             -IMAGEOUT_NAME "$2" \
             -CENTER_TYPE MANUAL \
             -PIXELSCALE_TYPE MANUAL \
             -IMAGE_SIZE 9245,9245   \
             -PIXEL_SCALE 0.555594   \
             -CENTER 109.5309438,40.17599612
}
RUN_ASTWARP_ON_TO ()
{
  astwarp "$1" --cdelt 0.555594/3600 -o "$2"  \
               --width 9245,9245 --widthinpix \
               --center 109.5309438,40.17599612
}

REMOVE_PV_FROM_TO ()
{
  cp "$1" "$2"

  # Remove all PV keywords from file
  PKEYS=$(astfits "$1" -h1 --printkeynames | grep --color=never ^PV)
  for pv in $PKEYS; do
    astfits "$2" -h1 --delete $pv
  done

  # Update the projection from TPV to TAN
  astfits "$2" -h1 --update CTYPE1,RA---TAN --update CTYPE2,DEC--TAN
}


## Ones with PV


# To make the noise.fits file reproducible
export GSL_RNG_SEED=1665844464

# Create an image with ones
astarithmetic m51.fits -h1 set-i i i / -o ones.fits

# SWarp and Warp _with_ PV
RUN_SWARP_ON_TO   ones.fits ones-swarp.fits
RUN_ASTWARP_ON_TO ones.fits ones-warp.fits


Look at m51-ones-pv.jpg file#53834 (hopefully I've got the number correct!)

Indeed, as Raul pointed out we can see a circle in the middle. I've pointed
out the scale values. Just using 'Statistics' you can see the properties:


aststatistics ones-warp.fits -h1

Statistics
-------
Input: ones-warp.fits (hdu: 1)
-------
  Number of elements:                      84820444
  Minimum:                                 0.994662
  Maximum:                                 1.02064
  Mode:                                    0.9948816299
  Mode quantile:                           0.01426795189
  Median:                                  1.00243
  Mean:                                    1.002846947
  Standard deviation:                      0.005231166437



## Ones without the PV


# Remove the PV parameters
REMOVE_PV_FROM_TO ones.fits ones-no-pv.fits

# SWarp and Warp _without_ PV
RUN_ASTWARP_ON_TO ones-no-pv.fits ones-no-pv-warp.fits
RUN_SWARP_ON_TO   ones-no-pv.fits ones-no-pv-swarp.fits


Look at m51-ones-no-pv.jpg file#53835

Warp has this strange pixel distribution. But the difference is of order
10e-6. I guess it is because of the edges of the image (I will try it out
again as Mohammad suggested, now with the functions, it is very easy, we
only have to reset the center and size for RUN_SWARP_ON_TO and
RUN_ASTWARP_ON_TO
functions).


## Noise with PV


# Create an image with noise
astarithmetic m51.fits -h1 set-i i i / 10 mknoise-sigma -o noise.fits

# SWarp and Warp _with_ PV
RUN_ASTWARP_ON_TO noise.fits noise-warp.fits
RUN_SWARP_ON_TO   noise.fits noise-swarp.fits


Look at m51-noise-pv.jpg file#53836

Indeed, again BOTH SWarp and Warp have this pattern on them. I think this
is not a 'dot' pattern. This looks like the sky grid to me! You'll get what
I mean after seeing the next output (thanks Raul for creating these
wonderful examples).

## Noise without PV


# Remove the PV parameters
REMOVE_PV_FROM_TO noise.fits noise-no-pv.fits

# SWarp and Warp _without_ PV
RUN_ASTWARP_ON_TO noise-no-pv.fits noise-no-pv-warp.fits
RUN_SWARP_ON_TO   noise-no-pv.fits noise-no-pv-swarp.fits


Look at m51-noise-no-pv.jpg file#53837

The pattern is here AGAIN! But this time, it is NOT distorted! It looks
like this is a low-level WCSLIB sky-grid calculation kind of effect.

## Conclusion

This pattern does NOT emerge from the distortions or Warp. It is
lower-level!

## Question

Why is Warp creating that spot in 'ones with PV' section? The difference
from the edges to the center is about 0.03 (~3%), where the edges have the
larger values.

(file #53837, file #53838, file #53839, file #53840)

    _______________________________________________________

Additional Item Attachment:

File name: m51-ones-pv.jpg                Size:72 KB
    <https://file.savannah.gnu.org/file/m51-ones-pv.jpg?file_id=53837>

File name: m51-noise-pv.jpg               Size:494 KB
    <https://file.savannah.gnu.org/file/m51-noise-pv.jpg?file_id=53838>

File name: m51-ones-no-pv.jpg             Size:77 KB
    <https://file.savannah.gnu.org/file/m51-ones-no-pv.jpg?file_id=53839>

File name: m51-noise-no-pv.jpg            Size:498 KB
    <https://file.savannah.gnu.org/file/m51-noise-no-pv.jpg?file_id=53840>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63171>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]