Readout Noise and Dark Current

Astronomical Laboratory ASTR:4850, Spring 2018
by Philip Kaaret

Reading

Equipment

Introduction

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 Orion StarShoot CCD cameras.

Readout Noise and Dark Current

A CCD 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.  Images obtained with no light entering the camera and with the minimum possible exposure length are called 'bias' frames.  The CCD noise is the fluctuation in the ADU counts around the 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 find out for yourself). Typically when taking astronomical images, one takes dark frames with the same exposure and at the same CCD temperature used in imaging the astronomical target so that the dark current contribution to the target frames can be subtracted. The use of dark and bias frames is discussed further in the 'Signal to noise' lab.

Setting up the Camera

You will, again, use an Orion StarShoot camera for this lab and the Camera Studio 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, remember to connect the +12V for the TEC. 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.  You might find it useful to put a copy of the Camera Studio manual on your laptop.

In this lab, we will only be taking images in which no light enters the camera. The StarShoot cameras do not have a shutter, so we must cover their aperture manually. You can either put a cover directly on the camera or on the telescope (if the camera is attached to a telescope). In either case, make sure that the cover seals tightly. It is worthwhile to check that your dark images don't change between having the room lights on versus off.

It is important to take all of your images with the same settings. In Camera Studio, go to the 'Camera Control' tab and check that Offset = 127, Gain = 185, and 'Fast Readout' is not checked.

To take dark frames, go to the Capture tab and set 'Type' to 'Dark'. The program will then prompt you to cover the camera. Make sure that 'Bin' is set to '1x1' and adjust 'Exposure(s)' to the desired value. Then click the 'Single' button. For bias frames, the procedure is the same with the 'Type' set to 'Bias'. The exposure time is then set to 1 millisecond and can't be adjusted. Record the necessary procedures in your lab notebook.

We will also vary the CCD temperature. In Camera Studio, go to 'Camera Control' and record the starting 'CCD Temperature' value. Click on 'Cooler On', adjust 'Target' to the temperature that you wish to reach, then press the 'Set' button. The thermoelectric cooler (TEC) in the camera can only produce a temperature differential of about 10 C.  Watch the 'Power' number in the 'Camera Control' tab, this is the percentage of the maximum possible power supplied to the TEC, 100% means that the TEC is at max power 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 Power value. Comparing to the starting temperature, calculate the maximum temperature difference you can achieve with your camera.

Bias and Dark Frames

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 StarShoot camera and look at how the image changes with temperature.

The interface of Camera Studio makes it a little difficult to compare images so we'll have to manually configure it. With the CCD at room temperature, take a bias image. In the 'Histogram' tab, set the range to 'High' and take another image. Record the values for black and white. Then change to 'User' and enter those two values. As you take the next set of bias frames keep the 'User' settings in the 'Histogram' tab fixed so you can see the changes with temperature.

Set the camera temperature to the lowest temperature that you can achieve. After the CCD has stabilized at the temperature setpoint, take a Bias frame and have a look.  The image should be mostly dark shades of gray. There may be a few white dots that pixels that produce large amounts of charge even in the absence of light ('hot' pixels).  Notice the patterns in the image (ignoring the white dots). Are there vertical or horizontal striations?  If you zoom in, what do you see? Now turn off cooling and repeatedly grab bias frames 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. Note that the CCD is not square. Thus, by looking at the CCD images and the datasheet, you should be able to figure out how the CCD is read out and how that corresponds to the axes of your images.

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 StarShoot.

Now we will take frames to measure the dark current versus exposure time and more bias frames.

When you're done, turn off the camera cooler and press the 'Disconnect' button, then disconnect the USB cable from the camera.

Measuring the Read Noise in ADU

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 42-46, 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.  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 may 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. The gain for the ICX419ALL is 0.79 e-/ADU. Using the gain, convert your standard deviation values to electrons. Record the value in your lab notebook. Are you impressed about how low the read noise is?  Record your findings in your lab notebook. You may want to try this with a few pairs of bias frames.


Dark Current versus Time

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.  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. 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, a tail to high values, or an asymmetry in the distribution 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? Should you instead fit a linear relation with zero intercept? 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.  In your write up, compare the read noise versus the noise due to dark current. At what exposure times does read noise dominate?  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?

Dark Current versus Temperature

Now we will take frames to measure the dark current versus  temperature.

When you're done, turn off cooler and disconnect the camera.

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 if you manipulate your data a bit first. 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 10 C.  Measure the same ratio from your data and see how they compare. You might also try fitting the equation given in figure 3.6 (note that the temperatures in the equation are in Kelvin). Record everything and put some plots in your lab notebook.