[Top][All Lists]

[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: Wed, 12 Oct 2022 05:18:19 -0400 (EDT)

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

Nice catch Raul! I forgot about '--envseed' 🤦

Here's a cleaner version of the previous code. Now you can easily read the
image properties from environment and use them to Warp or SWarp the image. Of
course this is just for quick analysis, and you should be careful only to run
these when environment variables are set. If not, they will produce errors
(before doing anything).

# Set the random seed for arith noise, don't forget to use '--envseed'.
export GSL_RNG_TYPE=ranlxs1
export GSL_RNG_SEED=1665844464

# Set pixel scale, image size, and center values for Warp and SWarp.
CDELT=0.555594  # in arcsec
WIDTH='700,700' # in pixels

  swarp "$1" -IMAGEOUT_NAME "$2" \

  astwarp "$1" --width $WIDTH --widthinpix \
          --center $CENTER --cdelt ${CDELT}/3600 -o "$2"

  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

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

I also found out using crop will produce very tiny dot patterns on the image.
The difference is very small and negligible. But it is there. They look like
Fourier transform side-effects, see file 'ones-pv-warp.jpg'.

To check this, I used the original 'ones.fits' image with a 700 by 700 crop of
image center 'crop/ones.fits', and a crop of the original image size (to check
if indeed astcrop is making that pattern or if it is a side-effect of working
on a smaller crop of the image). You can find the region file attached as

I chose 700x700 since it could hold 9 squares of the pattern seen in
m51-noise-pv.fits (file #53838).

So I guess you can ignore this pattern if you see it in the cropped images.

mkdir crop
astcrop m51.fits -h1 --center 109.5309438,40.17599612 \
        --width 700,700 --widthinpix --mode wcs -o crop/m51.fits
cd crop
astarithmetic m51.fits -h1 set-i i i / -o ones.fits
RUN_SWARP_ON_TO ones.fits ones-swarp.fits
RUN_ASTWARP_ON_TO ones.fits ones-warp.fits

## The large circle

This circle is completely tied with the PV coefficients. I tried altering
several coefficients, and it completely changed shape. So in essence, Warp is
using WCSLIB to accurately calculate the distortion effects; which create
these patterns.

(file #53841, file #53842)


Additional Item Attachment:

File name: ones-pv-warp.jpg               Size:82 KB

File name: ones-pv.reg                    Size:1 KB


Reply to this item at:


Message sent via Savannah

reply via email to

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