PhoSim Tutorial 22: How to Use Custom Truth Images and Match its Intensity and Scale

Previously Tutorial 16  demonstrated how to use a custom truth image as an arbitrary input. There the scale (WCS) as well as the intensity (magnitude) was specified by the user. This is very useful when using an image just as an example of an object that could occur in the Universe. Then the user can scale it in size and intensity, and even use the same truth image many times in a large field. 

However, there is also a common situation where you actually want to simulate the truth image as observed, and simulate it through a new telescope system. There the intensity and scale is not arbitrary, and you might want to have PhoSim match the observed size and intensity exactly. This can be modified by hand using the interfaces described in Tutorial 16, but the calculation is complex so there is a script that can do this for you.

In this example, we use green filter image of Antennae Galaxies again. We then use the script with the following command:

python tools/make_catalog.py green.fits 60

This script takes the input image makes a new catalog. The new catalog will have an exposure time of 60 seconds in this case. It will calculate the target intensity by using the exposure time in the image and the zeropoint that is defined in the header. The script makes a new image in an input image in data/images/temp.fits. The script also makes a new catalog in /examples/temp.txt. Inspecting this file you will find the line:

object 0 180.471657 -18.882025 16.649 ../sky/sed_flat.txt 0 0 0 0 0 0 temp.fits -1 0 none none 

Here it has calculated the target magnitude of 16.69 and note that the scale is -1, which instructs PhoSim to automatically search and match WCS if it is available in header. You can then run this catalog with the command:

./phosim examples/temp.txt -c examples/nobackground

The output image is:

PhoSim Automatic Antennae Galaxies Input

The WCS information that PhoSim needs to figure out the scale and rotation is usually in the header and is straight-forward. In some rare cases, you may have to do this by hand. However, the zero point and exposure information is not necessarily standardized throughout astronomy, unfortunately. If you know this information you can add the following arguments to the script

python tools/make_catalog.py green.fits 60 3000 z 25

Here the zeropoint is 25 and the exposure time of the input image is set to 3000 seconds.

If the zeropoint is unknown completely, then a crude zeropoint can be estimated from aperture of the telescope which was used to obtain the input image. We can replace “z” in above example with “a” and instead give the aperture(in cm) of the telescope from which the input image was taken (say 240cm as is the case with Hubble) as with the following command:

python tools/make_catalog.py /home/anirban/blue.fits 60 3000 a 240

If the program is unable to find exposure or zeropoint in header it will prompt the user for the same with appropriate messages.