gnuastro-devel
[Top][All Lists]

## [bug #63171] Strange patterns on warped images

 From: Mohammad Akhlaghi Subject: [bug #63171] Strange patterns on warped images Date: Thu, 6 Oct 2022 13:21:28 -0400 (EDT)

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

What an interesting scenario! There are two different factors at play here
which can be summarized in this image:

(file #53806)

1) ["Fringes"] When you simply convert a value to an unsigned integer, if it
is larger than 256 (=2^8), it overflows and its remainder (modulo) from a
multiple of 256 is kept. To see what I mean try the following commands. As you
see, how much ever you go up (as expected from the overflow logic!) the value
will be between 0 255

\$ astarithmetic 257 uint8 -q
1                             # Because 257 = 256*1 + 1

\$ astarithmetic 518 uint8 -q
6                             # Because 257 = 256*2 + 6

In the case of your image, we see that it has the following minimum and
maximum values:

\$ aststatistics img.fits --minimum --maximum
-207.176 8272.66

So the "fringing" or contour-like pattern you see in 'uint8.fits' over the
galaxy is because of overflow, and has nothing to do with Warp. To do this
properly, you should first scale your image to a range of 0 to 254 (because
255 is considered as BLANK in the unint8 type!), then call the 'uint8'
operator. Like the Arithmetic command below: I am first subtracting the image
from its minimum value (so afterwards, its minimum value is 0), then I am
dividing it by the maximum value (so the maximum is 1). Now that I know all
pixels are between 0 and 1, I multiply it by 254 to change the range from 0 to
254:

astarithmetic img.fits set-i i i minvalue - i maxvalue / 254 x uint8 \
-ouint8-correct.fits

2) [Noise changes] These also happen in the pure noise warping that you
created. These are caused by the distortion: input pixels have strongly
different sizes on the sky!

Have a look at the image below which is a zoom-in of one of the purple regions
above. You clearly see the different resolutions/smoothings. In effect the
pixel size is hugely different on such small scales!!! Since Warp uses a
"pixel mixing" based resampling
<https://www.gnu.org/software/gnuastro/manual/html_node/Resampling.html>, in
effect, it acts like a convolution, allowing you to see such things :-).

(file #53807)

This is a VERY BAD distortion pattern! I really wonder how SWARP does the job!
Pedram: here is a new section for your paper ;-). We should really go into the
detail of these extreme cases, because it is very important/interesting ;-).

_______________________________________________________

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

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

```