Skip to content

whitenNoise not working properly with COSMOSCatalog real galaxies #1071

@xuod

Description

@xuod

Hi,
I'm trying to whiten the noise in images from the COSMOS catalog and it seems not to scale properly with the pixel scale and (maybe) the PSF fwhm I'm using. Below is a snippet reproducing what I'm finding.

@rmjarvis thinks that might be due to the noise object not scaling properly, so I tried to dilate the noise object by the ratio of pixel scales, which seems to improve things (not sure how to quantify that).

import galsim

nx = 256
pixel_scale = 0.2

cat = galsim.COSMOSCatalog()
gal = cat.makeGalaxy(index=245, gal_type='real', noise_pad_size=nx*pixel_scale)
PSF = galsim.Kolmogorov(fwhm=0.15)
gal_psf = galsim.Convolve([gal, PSF])

im1 = gal_psf.drawImage(scale=pixel_scale, nx=nx, ny=nx)
im2 = im1.copy()
im1.whitenNoise(gal_psf.noise)

fig, axes = plt.subplots(1, 3, figsize=(12,3))
im = axes[0].imshow(im2.array)
plt.colorbar(im, ax=axes[0])
im = axes[1].imshow(im1.array)
plt.colorbar(im, ax=axes[1])
im = axes[2].imshow(im1.array-im2.array)
plt.colorbar(im, ax=axes[2])


im1 = gal_psf.drawImage(scale=pixel_scale, nx=nx, ny=nx)
im2 = im1.copy()
im1.whitenNoise(gal_psf.noise.dilate(0.03/pixel_scale))

fig, axes = plt.subplots(1, 3, figsize=(12,3))
im = axes[0].imshow(im2.array)
plt.colorbar(im, ax=axes[0])
im = axes[1].imshow(im1.array)
plt.colorbar(im, ax=axes[1])
im = axes[2].imshow(im1.array-im2.array)
plt.colorbar(im, ax=axes[2])

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug reportBug reportcorrelated noiseRelated to the handling of correlated noise.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions