Open b-remy opened 2 years ago
We consider here real galaxies from the COSMOS 23.5 catalog. In order to demonstrate model bias we fit a Sersic model on two set of observations:
We remove galaxies such that n < 0.4
or half_light_radius > .3
to get a correct SNR. Gaussian noise of standard deviation 0.01 is added on top of COSMOS stamp noise realization.
Intrinsic e parameters:
Simulations
Residuals
Intrinsic e parameters:
Simulations
Residuals
Wow, that is awesome!!!
Something we were wondering is whether there was a pattern in the residuals for the realistic dataset due to something else that the profile discrepancy.
A way to check this is to generate the same image with galsim only for both the real image and the sersic fit and look at the residuals (code to generate the residual image). We can observe the same residuals as for our model fitting measurement.
hummm the code is a little bit confusing to me, a lot is going on, can you just draw the real galaxy and subtract the parametric one? No added noise so it should be like 5 lines of code
Here is when I only draw the galaxies convolved with their psf (no added noise).
I can make the code even simpler but I wanted to look at the same galaxies as in my example above.
Right right, I just wanted to see clearly the exact steps going into making both parametric and real galaxies. In like 5 lines, just drawing one galaxy is enough for instance. I think I saw a few things that may not be quite right but it was hard to tell as there were 3 different gal objects every time (and that I didn't sleep much ^^')
Ok, here is the top left galaxy for instance
ind = 2
galp = cat.makeGalaxy(ind, gal_type='parametric')
galr = cat.makeGalaxy(ind, gal_type='real')
psf = galr.original_psf
convr = galsim.Convolve(galr, psf) # real gal
convp = galsim.Convolve(galp, psf) # parametric gal
imr = convr.drawImage(nx=64, ny=64, scale=0.03).array
imp = convp.drawImage(nx=64, ny=64, scale=0.03).array
figure(figsize=(12,4))
subplot(131)
title('real gal')
imshow(imr)
colorbar()
subplot(132)
title('sersic fit')
imshow(imp)
colorbar()
subplot(133)
title('residuals')
imshow(imr-imp)
colorbar()
Ok, so the first thing I saw is that you want to use the method 'no_pixel' to draw the galaxies, b cause the pixel response is already included in the PSF most likely
And I remembered something similar from some work a long time ago, see this notebook https://github.com/McWilliamsCenter/deep_galaxy_models/blob/master/Figure_autoencode.ipynb
And I remembered something similar from some work a long time ago, see this notebook https://github.com/McWilliamsCenter/deep_galaxy_models/blob/master/Figure_autoencode.ipynb
gal = cosmos_cat.makeGalaxy(i, gal_type='real', noise_pad_size=0.8*PIXEL_SCALE*STAMP_SIZE)
psf = gal.original_psf
real = galsim.Convolve(psf, gal)
real.drawImage(im_real, method='no_pixel', use_true_center=False);
# Drawing galaxy from parametric model
param_gal = cosmos_cat.makeGalaxy(i, gal_type='parametric')
param = galsim.Convolve(psf, param_gal)
param.drawImage(im_param, method='no_pixel', use_true_center=False);
It does not seem to change much the result...
ind = 2
galp = cat.makeGalaxy(ind, gal_type='parametric')
galr = cat.makeGalaxy(ind, gal_type='real', noise_pad_size=64*np.sqrt(2)*0.03)
psf = galr.original_psf
convr = galsim.Convolve(psf, galr) # real gal
convp = galsim.Convolve(psf, galp) # parametric gal
imr = convr.drawImage(nx=64, ny=64, scale=0.03, method='no_pixel', use_true_center=False).array
imp = convp.drawImage(nx=64, ny=64, scale=0.03, method='no_pixel', use_true_center=False).array
figure(figsize=(12,4))
subplot(131)
title('real gal')
imshow(imr)
colorbar()
subplot(132)
title('sersic fit')
imshow(imp)
colorbar()
subplot(133)
title('residuals')
imshow(imr-imp)
colorbar()
So it looks like there is an offset in the galsim sersic fit centroid!
I added a centroid shift variable to my model (810ebda) and just ran a MAP for the field above. It fixed the dipole pattern in the residuals :-)
galsim sersic fit
After fitting the centroid with a simple gradient descent
=> So I guess, I will now try to sample the centroid offset in the same time as the other parameters to check the model bias.
Aaaaah that looks much better!
This issue is to report results of experiments aiming to demonstrate the model bias when trying to estimate shear with a forward model.