Sensor Models
The Sensor
classes implement the process of turning a set of photons incident at the surface
of the detector in the focal plane into an image with counts of electrons in each pixel.
The Sensor
class itself implements the simplest possible sensor model, which just converts each
photon into an electron in whatever pixel is below the location where the photon hits.
However, it also serves as a base class for other classes that implement more sophisticated
treatments of the photon to electron conversion and the drift from the conversion layer to the
bottom of the detector.
- class galsim.Sensor[source]
The base class for other sensor models, and also an implementation of the simplest possible sensor model that just converts each photon into an electron and drops it in the appropriate pixel.
- accumulate(photons, image, orig_center=None, resume=False)[source]
Accumulate the photons incident at the surface of the sensor into the appropriate pixels in the image.
Each photon has a position, which corresponds to the (x,y) position at the top of the sensor. In general, they may also have incidence directions and wavelengths, although these are not used by the base class implementation.
The base class implementation simply accumulates the photons above each pixel into that pixel.
- Parameters:
photons – A
PhotonArray
instance describing the incident photons.image – The
Image
into which the photons should be accumuated.orig_center – The
Position
of the (0,0) point in the original image coordinates. [default: (0,0)]resume – Resume accumulating on the same image as a previous call to accumulate. In the base class, this has no effect, but it can provide an efficiency gain for some derived classes. [default: False]
- Returns:
the total flux that fell onto the image.
- calculate_pixel_areas(image, orig_center=galsim.PositionI(x=0, y=0), use_flux=True)[source]
Return the pixel areas according to the given sensor.
If the pixels are all the same size, then this should just return 1.0.
But if the pixels vary in size, it should return an Image with the pixel areas relative to the nominal pixel size. The input image gives the flux values if relevant (e.g. to set the current levels of the brighter-fatter distortions).
The returned image will have the same size and bounds as the input image, and will have for its flux values the net pixel area for each pixel according to the sensor model.
- Parameters:
image – The
Image
with the current flux values.orig_center – The
Position
of the (0,0) point in the original image coordinates. [default: (0,0)]use_flux – Whether to properly handle the current flux in the image (True) or to just calculate the pixel areas for a zero-flux image (False). [default: True]
- Returns:
either 1.0 or an
Image
with the pixel areas (The base class return 1.0.)
- class galsim.SiliconSensor(name='lsst_itl_50_8', strength=1.0, rng=None, diffusion_factor=1.0, qdist=3, nrecalc=10000, treering_func=None, treering_center=galsim.PositionD(x=0.0, y=0.0), transpose=False)[source]
Bases:
Sensor
A model of a silicon-based CCD sensor that converts photons to electrons at a wavelength- dependent depth (probabilistically) and drifts them down to the wells, properly taking into account the repulsion of previously accumulated electrons (known as the brighter-fatter effect).
There are currently four up-to-date sensors shipped with GalSim, which you can specify as the
name
parameter mentioned below. The _50_ indicates 50V back-bias.- lsst_itl_50_8
The ITL sensor being used for LSST, using 8 points along each side of the pixel boundaries.
- lsst_itl_50_32
The ITL sensor being used for LSST, using 32 points along each side of the pixel boundaries. (This is more accurate than the lsst_itl_8, but slower.)
- lsst_e2v_50_8
The E2V sensor being used for LSST, using 8 points along each side of the pixel boundaries.
- lsst_e2v_50_32
The E2V sensor being used for LSST, using 32 points along each side of the pixel boundaries. (This is more accurate than the lsst_e2v_8, but slower.)
The SiliconSensor model is asymmetric in the behavior along rows and columns in the CCD. The traditional meaning of (x,y) is (col,row), and the brighter-fatter effect is stronger along the columns than across the rows, since charge flows more easily in the readout direction.
There is also an option to include “tree rings” in the SiliconSensor model, which add small distortions to the sensor pixel positions due to non-uniform background doping in the silicon sensor. The tree rings are defined by a center and a radial amplitude function. The radial function needs to be a
galsim.LookupTable
instance. Note that if you just want a simple cosine radial function, you can use the helper class methodsimple_treerings
to build theLookupTable
for you.Note that there is an option to transpose the effect if your definition of the image is to have the readout “columns” along the x direction. E.g. to conform with the LSST Camera Coordinate System definitions of x,y, which are transposed relative to the usual FITS meanings. This only affects the direction of the brighter-fatter effect. It does not change the meaning of treering_center, which should still be defined in terms of the coordinate system of the images being passed to
accumulate
.- Parameters:
name – The base name of the files which contains the sensor information, presumably calculated from the Poisson_CCD simulator, which may be specified either as an absolute path or as one of the above names that are in the
galsim.meta_data.share_dir/sensors
directory. name.cfg should be the file used to simulate the pixel distortions, and name.dat should containt the distorted pixel information. [default: ‘lsst_itl_50_8’]strength – Set the strength of the brighter-fatter effect relative to the amount specified by the Poisson simulation results. [default: 1]
rng – A
BaseDeviate
object to use for the random number generation for the stochastic aspects of the electron production and drift. [default: None, in which case one will be made for you]diffusion_factor – A factor by which to multiply the diffusion. Use 0.0 to turn off the effect of diffusion entirely. [default: 1.0]
qdist – The maximum number of pixels away to calculate the distortion due to the charge accumulation. A large value will increase accuracy but take more time. If it is increased larger than 4, the size of the Poisson simulation must be increased to match. [default: 3]
nrecalc – The number of electrons to accumulate before recalculating the distortion of the pixel shapes. [default: 10000]
treering_func – A
LookupTable
giving the tree ring pattern f(r). [default: None]treering_center – A
PositionD
object with the center of the tree ring pattern in pixel coordinates, which may be outside the pixel region. [default: None; required if treering_func is provided]transpose – Transpose the meaning of (x,y) so the brighter-fatter effect is stronger along the x direction. [default: False]
- accumulate(photons, image, orig_center=galsim.PositionI(x=0, y=0), resume=False)[source]
Accumulate the photons incident at the surface of the sensor into the appropriate pixels in the image.
- Parameters:
photons – A
PhotonArray
instance describing the incident photonsimage – The
Image
into which the photons should be accumuated.orig_center – The
Position
of the (0,0) point in the original image coordinates. [default: (0,0)]resume – Resume accumulating on the same image as a previous call to accumulate. This skips an initial (slow) calculation at the start of the accumulation to see what flux is already on the image, which can be more efficient, especially when the number of pixels is large. [default: False]
- Returns:
the total flux that fell onto the image.
- calculate_pixel_areas(image, orig_center=galsim.PositionI(x=0, y=0), use_flux=True)[source]
Create an image with the corresponding pixel areas according to the
SiliconSensor
model.The input image gives the flux values used to set the current levels of the brighter-fatter distortions.
The returned image will have the same size and bounds as the input image, and will have for its flux values the net pixel area for each pixel according to the
SiliconSensor
model.Note: The areas here are in units of the nominal pixel area. This does not account for any conversion from pixels to sky units using the image wcs (if any).
- Parameters:
image – The
Image
with the current flux values.orig_center – The
Position
of the (0,0) point in the original image coordinates. [default: (0,0)]use_flux – Whether to properly handle the current flux in the image (True) or to just calculate the pixel areas for a zero-flux image (False). [default: True] (Note that use_flux=True potentially uses a lot of memory!)
- Returns:
an
Image
with the pixel areas
- classmethod simple_treerings(amplitude=0.5, period=100.0, r_max=8000.0, dr=None)[source]
Make a simple sinusoidal tree ring pattern that can be used as the
treering_func
parameter ofSiliconSensor
.The functional form is \(f(r) = A \cos(2 \pi r/P)\) where \(A\) is the
amplitude
and \(P\) is theperiod
.- Parameters:
amplitude – The amplitude of the tree ring pattern distortion. Typically this is less than 0.01 pixels. [default: 0.5]
period – The period of the tree ring distortion pattern, in pixels. [default: 100.]
r_max – The maximum value of r to store in the lookup table. [default: 8000]
dr – The spacing to use for the r values. [default: period/100]