Closed andrevitorelli closed 3 years ago
Thanks @andrevitorelli for looking into this! I'm looking at the notebook on the main branch but I'm not sur I can find all the images you are refering to, I don't see an metacal_image
. Also, I think image_shear
is not necessary in the second part of the notebook.
Could you make a trimmed down version of that notebook, which only shows the differences you are getting? So, no metacal, just drawing a galaxy and convolving it with GalSim and GalFlow
I'd be interested to look at it.
@andrevitorelli I've simplified your notebook a bit further, and added a section that just tests whether you can draw the kimage and compute the inverse FFT, even without looking at PSF convolution https://github.com/CosmoStat/autometacal/blob/u/andrevitorelli%2Fmcal_imags/notebooks/reconvolve_shift_example.ipynb
So, it appears that it's a problem of convention, and center can shift by 1/2 pixels. To use the same convention with drawImage and drawKimage, you should use use_true_center=False
in drawImage, apparently
it's a bit annoying.... because the ifft is shifted compared to the input pixel image.... so, another way to fix the problem, is to apply a phase shift to the fourier image to unshift the image by 1/2 pixels.
Also, yeah, this should only be a problem for even images..... odd images should be ok... but it's better if our code works in both cases :-)
@andrevitorelli so is this resolved now?
@EiffL Not yet, I was trying to test a few things first.
@andrevitorelli so is this resolved now?
I don't know, since the whole metacal functions are not working on images from the dataset (at all). I have some hints why, but I haven't been able to solve it yet. Also, at times, when the profile is sharp, there are still visible effects on the residuals that seem not to come from the offset (since they are present with either odd or even number of pixels). So either:
But I guess the issue can be technically closed as "outdated".
sooo I'm gonna flag this as solved for now
On the metacal_proof_of_concept-Fourier notebook, there is always a problem with the residuals between the input image and the reconvolved image. This is a problem due to some shift, created by the
use_true_center
keyword. The "input image" (image_shear
) is created with it set toFalse
, but the "observation image" (obs_imag
original profile+psf+noise) with it set toTrue
. The "observation image" is used to do the metacal procedure, but when compared to the reconvolved image we have this shift in the residuals (it always appears, but if you have a smaller radius galaxy it becomes clearer than the original example). If I get the residuals frommetacal_image - image_shear
, I have none, just noise. If I get it frommetacal_image - obs_imag
, I have the shift. No combination of setting the use_true_center between the images solves this, I either get shifts from both, or fromobs_imag
. Something happens after we go from theobs_imag
to the kspace image withdrawKimage
that does not reproduce the effect of theuse_true_center
. To check that: run the notebook withgal_r0 = 1.0
(second notebook cell), and change theuse_true_center
fromimage_shear
orobs_imag
at will.