Astronomy 302

Lecture 7

How to Reduce CCD data and Calculate S/N




1.0 The composition of the Counts in a pixel


We can think of a pixel (of a CCD or IR array) as having 3 major components that need to be carefully considered to remove the signature of the detector to reveal the photons detected from the astronomical Object itself.

Counts (in ADUs) on one pixel = BIAS (ADUs) + Dark Current (electrons/gain) + Object (photons/gain)         (1)

The BIAS is the DC offset level for the on-chip amplifiers. A BIAS frame is the average of say 10 images with the
CCD with the shutter closed and the exposure time set to zero.

The Dark Current is the thermal noise of the amplifier, it linearly increases with time. A DARK frame is  the same exposure time as your OBJECT frame but with the shutter closed.

            DC = (RateDC * t)/g       in  ADUs              (2)

where:  RateDC is DC electrons/sec of that pixel, g=amplifer gain electons/ADU, t=exposure time

The Object frames collect photons through the Telescope and camera optics. The Object counts increase linearly with time and are effected by the FLAT field (relative Quantum efficiency between pixels, QE) of the system.

           Object = (FLAT*RateObject * t)/g      in ADUs      (3)

where: FLAT is the relative QE of the pixel compared to the mean of all pixels, RateObject is the rate of photons falling on that pixel

A FLAT image is that of a uniformly illuminated screen (or sky) which has had its BIAS or DARK removed and normalized to a mean of one.

2.0 Basic Data Reduction

     Our goal is to isolate the counts from our object, from (1) we see

Object counts = (RAW - BIAS)

     If  have significant Dark Current then

Object counts = (RAW - DARK)     (bright sky conditions "SKY" frames are used instead of DARK, like in the IR)

    Then we need to normalized the QE across the array so, we need to divide out a normalized image of a uniform white source (or FLAT field)

Object = (RAW - BIAS) / FLAT        --------- works for most cold CCDs    (4)

or

Object = (RAW - DARK) / FLAT       ----------- works for uncooled CCDs with high dark current  (5)

or

Object = (RAW - SKY) / FLAT         ----------  works in the IR (6)


3.0 Gain of the Detector

We need to measure the gain of the CCD to understand how many actual photons we are detecting.

the number of photons from an object:
N = t*Rate

Say this "object" is a FLAT frame

For a CCD with a low DARK  then equ (4) applies

so from (3) we see that the number of Photons from a FLAT frame of counts F and Bias frame of B counts is:

N = g* (F - B)        photons

now we also know that sigma(N) = root(N)                      (8)

we know that if we have 2 flat frames (F1 and F2) and 2 BIAS frames (B1 and B2) we know that the
the sigma of F1-F2

since F = N/g + B

so sigma(F1-F2) = [(sigma(N1-N2)/g)2 + (sigma(B1-B2)2 ]1/2

hence sigma(N1-N2)/g = [(sigma(F1-F2))2 - (sigma(B1-B2))2]1/2

therefore:
       sigma(N1-N2) = g
[(sigma(F1-F2))2 - (sigma(B1-B2))2]1/2                    (10)

Now  it is clear that propagation of errors yields:

        sigma(N1-N2) = [(sigmaN1)2 + (sigmaN2)2]1/2        

and from (8) (
Poisson noise) we can rewrite this as:

       
sigma(N1-N2) = [N1 + N2]1/2 

since N1 = g*(F1-B1) and N2= g*(F2-B2) we can rewrite the above as:

       
sigma(N1-N2) = g1/2*[F1-B1 + F2-B2]1/2          

     hence

       
sigma(N1-N2) = g1/2*[(F1+F2) - (B1+B2)]1/2                      (11)

So equating (10) and (11) yields

  g = [(F1+F2) - (B1+B2)]  /  [(sigma(F1-F2))2 - (sigma(B1-B2))2 ]   electrons/ADU  (12)

      
Therefore by assuming Poisson statistics hold, we can easily measure a mean gain (g) for the CCD
from 2 consecutive identical exposure time dome flats images (F1 and F2) and 2 consecutive BIAS frames (B1 and B2)

Typically the gain is from 1 - 10 electrons/ADU it just depends on the CCD.

if you had only F1 and F2 and you knew what the read noise was
and what the BIAS level was (but did *not* have any BIAS frames)
how could you rewrite equ (12) ?


3.0 Readnoise of the Detector

We need to measure the readnoise (R) of the CCD to see how noisy it is.
Everytime you readout a charge on the amplifier there is an additional noise added into your image that has an rms value of R (the read noise).

The only "noise" source in BIAS frames is the readnoise of the Amplifier. There is no light and no thermal noise since the exposure is so short.

therefore 
           sigma(B) = R/g                                                          (13)
where R is the readnoise of the amplifier in electrons rms

The BIAS is typically steady (especially over short times). Hence we can simply estimate the readnoise from a pair of consecutive BIAS frames (B1 and B2).

         sigma(B1-B2) = [(sigma(B1))2+(sigma(B2))2]1/2 

from (13) we can rewrite the above as:

         sigma(B1-B2) = [(R/g)2 + (R/g)2]1/2     =   root(2)R/g       (14)    

hence we can solve for R as:

         R =  sigma(B1-B2)*g / root(2)     in rms electrons                              (15)

For a good CCD  R is typically 5-3 electrons rms, it goes up as the amplifier is read out more quickly.
It is the the main limiting factor for sky coverage of adaptive optics wavefront sensors (why?).
It is also sometime the limiting noise for very high resolution spectroscopic obsevations of faint sources (why?).

Why does equ (15) suggest that taking more than one BIAS frame is a good idea ? What is noise source of concern?



4.0 Calculating S/N for a Detector

We need to also understand how to calculate the S/N for a detector.

This is a critical calculation for any telescope proposal (hint you will need to do this in your proposals)


let   Signal = N                   (16)

where N is the number of photons from the direction of the science target over npix pixels,
Nsky are the number of photon from the sky over one background pixel.

Typically npix=pi*(radius of Phot aperture)2 / (pixel size)2
IF radius=FWHM then ~65% of the PSF light is enclosed in our Phot aperture,
a circle of radius = 3 FWHM gathers almost all the light from a star... but includes too many sky pixels for faint sources, so using radius = FWHM is better. For very faint sources (compared to the sky) we can even use radius = FWHM/2
(in other words the light inside the seeing disk), in this case only ~30% of the photons are collected but we reduce the number of sky photons by ~4x ... (see example below)

Noise2 = (sigmaN)2 + npix*(sigma(Nsky))2 + npix*(sigma(DC))2 + npix*(sigma(R))2

    where DC is the dark current collected over one pixel,
               Nsky are the number of photon from the sky over one background pixel,
               and R is the rms readnoise/ pixel,
              


Since all but the Readnoise are Poisson we can then rewrite the above as

Noise2 = (N + npix(Nsky + DC + R2))           (17)

Therefore from (16) and (17)

S/N =  N / [N + npix(Nsky + DC + R2)]1/2             (18)


Now lets consider some simple limiting cases:

5.0 Calculating S/N for Limiting Cases


1) Bright Star (Photon noise limited): If N is large then S/N ~ root(N) --- this is the optimal noise case.

2) Bright Sky (Background noise limited): If the sky is very bright then S/N ~ N/root(npix*Nsky)  < 1 and so we must take many sky frames and "beat" down the sky noise (but you must also spend the same amount of time on your source as well). This is typical for IR observations or on a bright night (near full moon) with a CCD.

3) Short Exposure (Read Noise limited): For short exposures, the dominate noise term is R (since t is small). In this case S/N ~ N/R    hence you want a low read noise CCD, or a bright source....

4) Warm CCD (Dark Current limited or money limited):  here S/N ~ N/root(npix*DC)  --- try cooling your CCD as much as possible

5.0 Calculating S/N with Exposure Times

From (18) above we introduce the exposure time (t) if we consider that #of photons  = N*QE*t
where now N=#photons/s from the scource--it is now a rate! and  QE is the total QE=(Transmission*CCD QE) of the system

therefore we can rewrite (18) with rates as:

S/N =  N*QE*t / [N*QE*t + npix(Nsky*QE*t + DC*t + R2)]1/2             (18)


So now give a source flux in Jy or magnitudes we can calculate the S/N for the source for a given
exposure time!

Example:
If we have a D=1.1 meter telescope, with a 70% QE CCD and a 80% transmission Optical system,
and  you have a "gray" night where the sky is V=18 mag/arcsec2,
and the DC is 22 e/pix/hour
and the read noise is 5e rms
and you have 1.5 arcsec seeing and 0.25" pixels unbinned
then how much S/N will you get on a V=21 mag source in 120 seconds ?

since Vega (V=0) has
9.6e10 photons/s/m2/micron at 0.555 microns (in V filter) and V has a rough bandwidth of 0.089 microns, therefore:
Ntotal ~ 9.6e10*10**(21/-2.5)*3.14*(1.1/2)**2.0*(0.089) = 32.3 photons/s

But say only ~30% of these fall within the FWHM= 1.5" seeing disk,
(in other words our phot aperture has radius = FWHM/2 ) then
N = 0.3*32.3 = 9.69 photons/s from a V=21 mag source inside our 1.5" phot aperture

QE = 0.7*0.8 = 0.56
t = 120 s
npix = 3.14*(1.5"/2)**2.0/(0.25"**2.0) = 28.3 pixels
Nsky ~
9.6e10*10**(18/-2.5)*3.14*(1.1/2)**2.0*(0.089)*(0.25"**2.0) = 32.00 sky photons/s/pix
DC = 22/(60*60) = 0.006 e/s/pix
R = 5 e rms

So our signal is
N*QE*t = 9.69*0.56*120.0 = 651.2 photons collected in 120s in our 1.5" aperture

But our noise is (651.2+ 28.3*(
32.0*0.56*120 + 0.006*120 + 5**2.0))**0.5 =  249.5 photons of noise
(NOTE that the dominate noise term is from the bright sky (which is ~93x brighter than source on each pixel)!)

Hence our S/N = 651.2/249.5 = 2.6 which is pretty marginal (remember Project 1)
the noise in magnitudes would be 1/(S/N) ~ +/-0.38 mag (almost 40% phot error).

CASE 1 (Better seeing)
Now if the seeing got twice as good what happens to the S/N ?
in this case the seeing disk is 0.75" (which is pretty good) and so npix is smaller by 4x
hence in the background limited case S/N would get ~2x better.... hence S/N~5

CASE 2 (Darker Sky)
Now if the sky was very dark (23 mag/arcsec2) what would happen to the S/N ?
Again in the background limited case if the Sky is 100x darker the noise is root(100) lower
and so the S/N is 10x better! Hence S/N ~ 26 !

>>> this is why it is so important to have a dark site for CCD observations (and no Moon)

So depending on the darkness of the sky and the seeing one can have factors of 50x difference in the S/N of CCD for a faint target!


CASE 3 (Increasing the Phot aperture)
Now if we want all the light from the star (not just 30% inside the seeing disk) we need to set our aperture to radius= 3*FWHM. Then we have ~3x more signal! But npix is 36x bigger! Hence  S/N~N/root(npix) so it gets 2x smaller!
Hence, with a radius=4.5" aperture the S/N falls to just 1.3 which is not possible to detect...

CASE 4 (Smoothing the data)
As we found in Project 1 smoothing the data can help. Since the sky noise varies from pixel to pixel (FWHM=1 pix) but the star has flux over a FWHM=6 pix patch we can decrease the sky noise by averaging (or smoothing) sky pixels together. In this manner a S/N=2.6 detection can look like a much higher S/N detection since the sky noise can be suppressed by smoothing compared to FWHM=6pix spatial scales.



Homework (due on Monday)
Question 1:

1(a) Calculate the S/N of a V=25 mag star at the 6.5 m MMT and the 8.0m Gemini South Telescope
Assume:
Seeing is 1.5" at Gemini and 0.8" at the MMT
pixels are 0.4" at both telescopes
the sky is V=22 mag/arcsec2 at both sites
DC is 10e/pix/hour for Both CCDs
The total transmission of all optics is 80% for both
The QE is 90% for the MMT CCD but only 70% at Gemini
The readnoise is 3 electrons for both CCDs

Try the case of phot aperture radius = FWHM/2 and t=120s exposure

1 (b) which telescope is better? Why?


Question 2: Produce an analytic expression for equ (18) for t as a function of S/N
e.g. t=f(S/N)