Astronomical Laboratory ASTR:4850, Fall 2015
by Philip Kaaret
Sections 3.1-3.9 in Handbook of CCD Astronomy, second edition, by Steve B. Howell.
Charge-coupled devices (CCDs) are extremely sensitive and accurate photon detectors, but there are limitations on their performance. In this lab, you will learn about some of those limitations and measure the performance of the Santa Barbara Instrumentation Group (SBIG) CCD cameras.
An SBIG ST-402XME camera, with power adapter and USB cable
A computer running the CCDOps software package and DS9 for image analysis
The CCD in the ST-402 can make accurate, but not perfect,
measurements of the charge accumulated in each CCD pixel.
One important limitation is the noise associated with the
electronics that amplifies and digitizes the charge signal in the
CCD readout. Even if the exact same charge is placed in a
given pixel in two different images, this noise will produce
fluctuations in the number of ADU (analog to digital units)
recorded. We can measure the noise by taking repeated images with
the same amount of charge in each pixel. Since the amount of
charge in a pixel depends on the amount of light entering that
pixel, the easiest way to get the same amount of charge is to have
no light enter the pixel. Thus, for these images, we block any
light from entering the camera by simply not opening the shutter.
Because the analog to digital converter (ADC) in the CCD reports
only positive values, while the noise fluctuations can be positive
or negative, a constant offset, called a 'bias', is added to the
ADC value. Thus, these images obtained with no light
entering the camera and with no exposure length are called 'bias'
frames. The CCD noise is the fluctuation in the ADU counts
around the constant bias value.
Even in the absence of light, charge will accumulate in each pixel. This is because the CCD is at a temperature above absolute zero and thermal fluctuations in the silicon can release electrons. This accumulation of charge is called 'dark current'. Dark current depends on the CCD temperature (as you will see in the analysis section).
You will, again, use an SBIG ST-402 camera for this lab and the CCDOps software to control it. Connect the camera to the computer and establish communication between them. Refer to your write up of the first lab in your lab notebook for details. You may want to be able to run the camera while in a remote location without Internet access, so it is useful to have this procedure documented in your notebook. If you try out a laptop during this lab, record the procedure that you used along with any essential details (like the USB port used). You might find it useful to put a copy of the CCDOps manual on your laptop.
In this lab, we will be taking only 'dark frames' – images in which no light enters the camera. We do this by telling the camera to not open its shutter while taking an image. To do this, go to the 'Grab' command and set 'Dark frame' = 'Only'. The other parameters for the Grab command should be Image size' = 'Full', 'Exposure delay' = 0, and 'Special Processing' = 'None. In this lab, you will vary the exposure time for the images (usually called 'frames', since we are not actually imaging any light). Record the necessary procedures in your lab notebook.
We will also vary the CCD temperature. In CCDOps, go to
'Camera/Setup' and turn 'Temperature Regulation' to 'On' and
'Setpoint' to 0. Set the other parameters as: 'Resolution
mode' = 'High' and 'Reuse dark frames' = 'No'. With
'Setpoint' to 0, the camera will try to cool the CCD to 0 C.
The thermoelectric cooler (TEC) in the camera can only produce a
temperature differential of about 20 C. Watch the status
display in the bottom of the CCDOps window to see the temperature
decrease. The number in parentheses after the temperature is
the TEC duty cycle: (100%) means that the TEC is on all the
time. To get a stable temperature, the duty cycle must drop
below 100%. That way the TEC can compensate for small
temperature fluctuations (this isn't so important in the lab,
where the room temperature is constant, but is a major concern
when outside). If the TEC duty cycle does not drop below
100% after a few minutes, increase the setpoint temperature
gradually until it does drop below 100%. Record the CCD
temperature and the TE value. Use the lowest temperature
that you can achieve below. You can read the current CCD
temperature and the ambient temperature using Camera/Camera Info.
To make it easier to save all your files in FITS format, you
might want to use Edit/Preferences in CCDOps and change the
default file type to FITS.
All electronics are temperature sensitive. When using a CCD
for astronomical imaging, it is important to maintain the CCD at a
constant temperature and to take all calibration frames (bias,
dark, and flat) at the same temperature as the astronomical
images. To illustrate this point, let's look at some bias
frames from the ST-402.
Set the camera temperature to the lowest temperature that you can
achieve and set the parameters of the 'Grab' command to take bias
images: set 'Dark frame' = 'Only', Image size' = 'Full',
'Exposure delay' = 0, 'Special Processing' = 'None, and 'Exposure'
= 0.040 seconds (the minimum time possible). After the CCD
has stabilized at the temperature setpoint, grab and image and
have a look. The image should be mostly dark shades of gray
with a few white dots. The white dots are 'hot'
pixels. Notice the patterns in the image (ignoring the white
dots). Does there seem to be a preferred orientation?
Now set the temperature to 25 C and repeatedly grab images as the
CCD heats up. Does the pattern change with
temperature? What you are seeing is the effect of
temperature on the electronics in the CCD and its readout.
Write down your observations and explain how the patterns that you
see related to the structure of the CCD. Feel free to repeat
the temperature cycling.
To measure the readout noise, it is best to minimize the contribution of dark current. We do this by using the minimum possible exposure time. So, let's take some so-called 'bias' frames to measure the readout noise of the ST-402.
In CCDops, set the camera
temperature to 25 C. If the ambient temperature (find
using Camera/Camera Info) is below 25 C, set the camera
temperature to the ambient temperature and use that
temperature in place of '25 C' in the rest of the data taking
below. Record the camera temperature.
Grab a dark frame, remember 'Dark
frame = 'Only', with an exposure time of 0.040 seconds.
Save the frame (or image) in FITS format with the word 'bias' in the name. You will be taking 5 identical frames, so you might want to include '1' in the name of this one. Remember to record the directory where you are saving your files.
Take 4 more bias frames and save each of them in FITS format.
Now we will take frames to measure the dark current versus exposure time.
Set the camera temperature to the same temperature that you used for the bias frames. Take dark frames with exposure times of 0, 1, 5, 20, 60, 180, and 600 seconds. (Can you grab an frame with an exposure of 0 seconds? If not, use as short a time as you can.) Save each frame in FITS format. Later you will need to know the exposure time and temperature for each frame, so you need to record this and/or encode it in the file name. Use the word 'dark' in the file names.
Before you disconnect the camera from the computer, go to the
Camera menu and run the Information command. Look over the
Camera Info screen that comes up and find the Gain (e-/ADU) for
the High readout mode. Record the gain in your lab notebook.
The read noise of the CCD causes the ADU recorded for each pixel
to differ from the ADU value that should be produced given the
charge deposited in the pixel. Using the bias frames, we can
measure the read noise by calculating the mean and standard
deviation of the pixel values (after removing hot and dead
pixels). The standard deviation is a measure of the
fluctuations of the data around the average value. It is the
square root of the average of the squared deviations from the
mean, i.e., std = sqrt(mean((x-mean(x))**2)), where **
indicates raising a number to a power. The standard
deviation is often described as the RMS (or rms) since it is the
square Root of the Mean of the Squared deviations.
We'll use python to calculate these statistics and plot a
histogram of the pixel values in our bias frames. Bring up a
copy of histimage.py from the Intro to
Python lab, save it with a new file name (maybe noise.py), and
edit it to read in one of your bias frames. In calculating
the statistics of a data set, one often prefers to discard
outlier, e.g. pixels that have high values because they are
saturated or 'hot' or pixels that have low values because they are
damaged. Run histimage.py and examine the histogram of your
pixel values. Are there outliers? In lines 41-44, we
set an allowed range for 'good' pixels values (between plow and
phi) and then make a new array, imghcut, keeping only the values
in that range. Adjust the values for plow and phi according
to your histogram and record them. Then, run histimage.py
again and record the statistics of the pixel values of your image
when keeping only the 'good' pixels. The mean value reported
is the bias value of the CCD. Record those. Examine
the same image in ds9 (or CCDOps). Is the standard deviation
dominated by systematic deviations between groups of pixels (say
along columns or rows of the CCD) or do the fluctuations look
random?
For a better measurement of the noise of the CCD, we should
remove the systematic variations between pixels and examine only
the fluctuations within individual pixels. We can do this by
looking at the difference between two bias frames. You
already have the tools to do this in Python. Use code diffimage.py to load two of your bias
frames and calculated their difference. Add in code from histimage.py to make a histogram of the
difference values and calculate their statistics. Note that
you will still want to remove outliers. With a bit of
thought, you should be able to do this automatically without
needing to plot and inspect a histogram.
Do any of your histograms contain bins with many more or many
fewer counts than the adjacent bins? What is the cause of
this? How can you fix it?
Edit the program to produce a histogram that covers only the
difference values of interest in the bias frame. You are
essentially trying to produce a plot similar to figure 3.8 (but
with the constant removed) in the textbook using your own bias
frames. You histogram should extend out to +/- about 3 to 5
times the standard deviation. Print the histogram and paste
it into your lab notebook. Record the mean and standard
deviation of the differences. The standard deviation is a
good estimate of the read noise.
We wish to measure how the average accumulated dark current in
the CCD varies with exposure time. Load the python program darktime.py into a text editor and have a
look. Edit the file names to correspond to the names that
you used in saving the dark frames. Note that the zero time
(or 0.040 second) dark frame is called the bias frame in the
code. The array darkfile contains a list of the dark frames
with exposures of 1 second or longer and the array time should
contain the corresponding exposure times.
In the main loop, the stuff after '# process the files', the
program reads in a dark frame, subtracts off the bias frame, and
then does some manipulation to get the pixel value differences
into a properly shaped array so that we can calculated the
statistics. The stuff after 'choose selection region' drops
the pixels with the lowest and highest readings in order to weed
out bad pixels. You can adjust the value of f which
sets the fraction of pixels dropped on the low and high ends.
The program the plots an image of the differences, plots a
histogram, and calculates the statistics. We ahve set the
plot mode to be non-interactive, so each time you go through the
loop and read a new file, you will need to close the plot window
to proceed. Note that you can stretch out the plot windows
to get better views of the plots (and make the labels not
overlap). The program plots the mean pixel value as a
vertical solid line and the median pixel value as a vertical
dashed line. Explain what is the difference between mean and
median in your lab notebook.
As you get to longer exposure times, you might see a second peak
and/or a large tail to high values develop. We already know
that some pixels look bad with very short exposures. In
addition, there are pixels with unusually high leakage
currents. These pixels become apparent when you use long
exposure times. As you go to longer exposures, which
provides a better estimate of the behavior of a typical pixel, the
mean or the median? Explain in your lab notebook. You
might want to put one or more plots into your lab notebook,
particularly one with a long exposure time.
After processing all the data files, the program then makes a plot of the statistic (mean or median) versus exposure time and does a linear fit. The program can be edited (uncomment either the line 'm = c_mean' or the line 'm = c_median' and also uncomment the appropriate plt.ylabel line) to use either the mean or the median. Which should you use? Record your choice and reasoning, put a copy of your plot in your lab notebook, and write down the fit parameters. What do you expect for the intercept? Is your value reasonably close? (What is the uncertainty in measuring the median?). A correlation coefficient of r = 1 indicates a perfect linear relation. Do your data present a good linear relation? What are the units of the slope? Convert the slope to electrons/pixel/second and record the value.
At first glance, dark current should not be a problem because we
can always take a dark frame with the same exposure time as our
image frames and subtract off the dark current. However, the
generation of dark current is an inherently random process.
Thus, if we take several dark frames with equal exposure, the
accumulated charge in each pixel will fluctuate. The
standard deviation or rms of these fluctuations is equal to the
square root of the number of accumulated dark current
electrons. Using your value from the previous paragraph for
the dark current electrons/pixel/second, calculate the rms
fluctuations in the dark current versus exposure time. Then
make a plot of the rms fluctations versus exposure time.
Over plot a line showing the read noise (this will be a horizontal
line). At what exposure times does read noise
dominant? At what exposure time is the read noise equal to
the fluctuations in the dark current? At what exposure times
do the dark current fluctuations dominate?
Now we will take frames to measure the dark current versus
temperature. Get the camera back from the group that you are
sharing with and set it up.
Before you disconnect the camera from the computer, go to the
Camera menu and run the Information command. Look over the
Camera Info screen that comes up and find the Gain (e-/ADU) for
the High readout mode. Record the gain in your lab notebook.
Now we wish to do the same sort of analysis as above, but looking
at the dependence of dark current on temperature rather than
time. Save darktime.py as darktemp.py and edit the program
to read the set of frames that you took to measure the dark
current versus temperature. Again look at using the
mean versus the median. Make a plot of counts (mean or
median) versus temperature. Then program in the conversions
to make a plot of dark current in terms of electrons/pixel/second
(on the y-axis with a log scale) versus temperature (on the x-axis
with a linear scale), similar to figure 3.6 in the textbook for
your CCD. Now we want to fit an exponential function to the
data, i.e. dark current = A*exp(B*temperature). You can do
this using the linregress function that you used to fit the counts
versus time data (hint it involves taking a log). Plot your
fit on your data, then print the plot and put it in your lab
notebook. From your fit parameters, calculate by what factor
the dark current decreases if the temperature decreases by 20
C. Measure the same ratio from your data and see how they
compare. Record everything and put some plots in your lab
notebook.