Simulating Images

In class, we talked about how a telescope’s optics form an image at a focal plane and a telescope’s detector records that image. We’ve added two cartoon functions to henrietta that help us understand the basics of this process: one that uses online star catalogs and your inputs to (very approximately) simulate a patch of the sky seen through the optics of a telescope, and one that simulates a detector recording that image.

In [ ]:
import matplotlib.pyplot as plt, numpy as np
from henrietta import imaging

Simulate the Optics of Our Telescope

The simulate_optics function produces a simulation of the image that would appear at the focal plane of a telescope, expressed in units of photons/s/pixel. These images are “perfect”, in the sense that they are an expectation for the rate at which photons will be hitting a detector.

In [ ]:
fluximage = imaging.simulate_optics(target='GJ 1132',
                                    collectingarea=1.0,
                                    pixelscale=21,
                                    fov=180,
                                    background=0.0)

The plt.imshow function (with its many options!) can display that image for us to peruse.

In [ ]:
plt.imshow(fluximage)
plt.colorbar(label='photons/s/pixel');

Simulate the Detector Behind Our Telescope

The simulate_detector function takes an image at the focal plane (in photons/s), and simulates the total number of photons the detector would record. These are noisy images, with the effects of photon noise included.

In [ ]:
photonimage = imaging.simulate_detector(fluximage,
                                        exptime=1.0,
                                        quantumefficiency=0.001,
                                        readnoise=10.0)
plt.imshow(photonimage)
plt.colorbar(label='photons/pixel');

If you run simulate_detector several times, you’ll see you keep getting slightly different images. The function is simulating the actual detection of photons, and because we know photon-counting measurements always have uncertainties associated with them (\(\sigma = \sqrt{N}\))ca

Simulate Your Own Star, with your Own Telescope

Here are some ways you might think about playing with these tools: Pick a star and simulate some images. How does a flux image (photons/s/pixel) look different with Kepler, TESS, or a cell phone camera? How does the appearance of a photon image (photons/pixel) change if you change the exposure time? What challenges would be unique to each telescope? Play with the background keyword in simulate_optics; why is it difficult to see stars during the day (on Earth)?