Setup
- MacOS 10.12.6
- Python 2.7
- Galsim 1.4.4
- Numpy 1.13.1
- Astropy 1.3.3
- Fitsio
Goal
My goal is to take simulated wide field HST images (12288*12288 pixels, roughly 600MB in .fits format) and add the WFIRST detector features to it.
Problem
Unfortunately, I have faced difficulties reading the fits files.
The main question is how to turn fits images in the way that we can manipulate them by galsim.
I've tried
I have tried galsim fits method ‘galsim.fits.read(“fine_name.fits”)’ and I‘ve got :
galsim.Image(bounds=galsim.BoundsI(xmin=1, xmax=12288, ymin=1, ymax=12288), array=
array([[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
...,
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.]], dtype=float32), wcs=galsim.PixelScale(1.0))
I have tried fitsio.read(“file_name.fits”)
as well but still, I am not able to convolve PSFs through 'galsim.Convolve' or add detector features.
-Thanks
If you read the docstring for galsim.fits.read, you will see that it returns a galsim.Image, as you have found with your experiment. To create a GSObject, you need to instantiate a galsim.InterpolatedImage, which will allow you to convolve and do other operations. You can read the docstring for galsim.InterpolatedImage, and/or look at galsim demo11.py to see an example of this being done in practice (reading in an image file into an InterpolatedImage and convolving with something else).
Detector features do get added to images, not GSObjects. For an example of this, see GalSim's demo13.py.
Questions of basic GalSim usage are covered in the Quick Reference Guide https://github.com/GalSim-developers/GalSim/blob/releases/1.4/doc/GalSim_Quick_Reference.pdf and the demos in the GalSim repository.