b-remy / gems

GEnerative Morphology for Shear
MIT License
0 stars 0 forks source link

Cosmos dataset #15

Open b-remy opened 2 years ago

b-remy commented 2 years ago

Create a tensorflow-dataset of galsim cosmos images.

Regarding the delta psf I am building an effective psf taking the maximum Fourier absolute coefficients and deconvolving it from each psf.

psfs = []
for i in range(ngal):
  psf = cat.makeGalaxy(i).original_psf
  psf_stamp = np.abs(psf.drawKImage(nx=self.builder_config.stamp_size, 
                                     ny=self.builder_config.stamp_size, 
                                     scale=2*np.pi/(self.builder_config.stamp_size*0.03)).array).astype('float32')
  psfs.append(psf_stamp)

effective_psf = np.stack(psfs).max(axis=0)
effective_psf = gs.InterpolatedKImage(gs.ImageCD(effective_psf, scale=2*np.pi/(self.builder_config.stamp_size*self.builder_config.pixel_scale)))
effective_psf = gs.InterpolatedImage(gs.Image(effective_psf.drawImage(nx=self.builder_config.stamp_size,
                                                                ny=self.builder_config.stamp_size,scale=self.builder_config.pixel_scale)))
image

With the galaxy convolved with the effective psf and the delta psf, the user should be able to recover the observed galaxy image.