CCD Photometry with Mathematica

Introduction Reduction Conversions Dates Display Image Headers Image Load Image Save Photometry

Table of Contents

This Mathematica package can be downloaded from the Wolfram Research Information Center

History and Uses

     CCD photometry is a fairly new method for measuring the brightness of astronomical objects.  Older methods employed the use of photometers which require a significant amount of calibration.  CCD cameras are much easier to use and the results are easier to visualize.  The drawback is that CCD cameras suffer from a lower time resolution than photometers which can be problematic if the light variations of the astronomical source occur over short time intervals.

FITS

     This package provides a number of useful tools for reducing and processing CCD image data stored in FITS format.  FITS is a standard data format used in the astronomical community.  Unlike many other formats, FITS data contain headers and data sections.  The header contains information that is often vital to the interpretation and identification of the data contained in the file.  FITS stands for Flexible Image Transport System.  This name can be a bit confusing if the FITS file contains only a header and no data.  Additionally, unlike other bitmap formats such as GIF  or JPEG, the data in a FITS file is not a bitmap, but typically contains tensors of data.  Multiple data sets and header can exist in a single FITS file.  
     Since FITS supports so many different structures, this makes it difficult to create an automated package to handle all FITS files.  Certain assumptions must be made, such as the name of the fields in the header.  For CCD photometry of variable stars, the time that the image was started is vital to the analysis.  In the examples provided, the start time of the image is kept in a filed called "UT" for Universal Time.  The code in this package specifically looks for this filed and parses its value to construct a more standard Mathematica time expression.  If a FITS file from a different observatory were used, the field may be named "STARTTIME", in which case this package would not work without modifications.  Proper analysis of FITS data requires some knowledge of the contents of the file.
     The examples used here make use of a few FITS files created at the NURO (National Undergraduate Research Observatroy) facility in Flagstaff, AZ.  These images were used in the construction of the code for this package so they should work fine.

CCD Image Reduction

     CCD image reduction is a vital step in process of data acquisition.  To get good results, you need equipment that is free of irregularites and uncontaminated data.  Neither of these occur in reality, at least not completely.  The best that can be hoped for is that the error can de detected and compensated for.  This is where CCD image reduction comes in.  CCD chips are like any other electronic device, they can get dirty and they have inherent noise associated with moving electrons.  Also, the chip itself may suffer from irregularities in the sensitivity across the surface.  Some areas of the chip are more sensitive to light than others.  Also, dust can settle on the chip and along the image plane which can block light.  These all need to be accounted for.
      The first step is to realize that a CCD chip is basically an array of photoelectric electron counters.  Since the chip has an applied voltage, there is a bias voltage that must be subtracted from all measurements.  Failure to account for this would result in measured electron counts that are higher than the actual signal.  Second, CCD chips can also detect thermal electrons which result in random noise that increases with exposure and temperature.  Failure to account for this will also result in artificially heightened electron counts.  Lastly, since the chip is an array of discrete components, it should be expected that not every component will be as sensitive to light as another.  As mentioned before, dirt and dust can also block light from efficiently hitting fixed areas of the chip.  What can we do?

Bias Voltage - The Zero Frame

     Since the chip has a voltage applied to it, or bias, this effect needs to be measured.  This can be accomplished with a "zero frame".  This is an "image" taken with the CCD with a zero-length exposure.  This means it receives no signal from the sky and is so short that there is no measurable thermal noise to account for.  A series of such frames can be taken and then averaged, thus giving the average bias across the CCD.  This frame will be subtracted from every frame during the reduction process.

Thermal Noise - The Dark Frame

     Since CCD chips are sensitive to electrons, random electrons can contaminate the data.  Only electrons generated from the photoelectric effect of photons hitting the chip are desired.  So, for a given exposure length, we need to know how much thermal noise builds up across the chip.  If we expose the chip for a finite time period, but leave the shudder closed, we should be able to measure this effect.  Thermal noise has a random nature so an average of such "dark" frames is typically needed.  Of course this will also contain the bias voltage signal, but this will be subtracted.  A final step that reduces the effect of thermal noise is to cool the chip as much as possible to limit the presence of such noise as much as possible.  The images used in examples in this package were taken with a liquid nitrogen cooled CCD camera, operating at about -110 Fahrenheight.  The result was a nearly negligible thermal noise count so no dark frame was acquired.  

Chip Irregularities - The Flat-Field Frame

     The final source of error that can be accounted for is the fact that the chip is not uniformly sensitive to light across its surface.  Some "pixels" are simply not as efficient at converting photons to electrons as others.  Dirt or dust grains lying on the chip or on filters in the light path reduce the sensitivity of some pixels.  If we had a map of these sensitivity variations, we could measure the variation and raise or lower the pixel values to compensate.  The flat-field frame is used for this purpose.  Typically, the camera is pointed at an area of the sky that is uniformly illuminated and is called a "sky-flat".  This is best done just after sunset, but before the stars appear.  If a short exposure is taken, the you would expect a uniformly illuminated image or field.  Instead, you get an image with small "doughnut-like" artifacts and large areas that look darker than others.  We can take this image, subtract the bias frame, and then normalize all of the pixel values.  Then, we can divide the bias-subtracted image frame by the flat-field frame and get a result free of irregularities in chip sensitivity. In effect, we are multiplying each pixel by a factor necessary to bring its sensitivity to the same level as the others.

CCD Photometry

     Once the image frame has been reduced, it is now ready for data extraction.  With old photometers, a photoelectric tube with a fixed aperture is pointed in the direction of the light path.  Any light coming through the aperture falls on photoelectric pads and causes a cascading effect of electrons which eventually count high enough to be measured.  The current is measured and later converted to a brightness measurement by comparing the current to that generated by a known "standard" star that is preferably non-variable.  If this "standard" star is located relatively far from the star of interest, then the amount of atmosphere the light has travelled through will be different than the light from the star of interest.  An extinction coefficient must be calculated.  Also, what about differences in the cloud coverage between these stars.  There is almost always some level of clouds in the air, even if it can't be seen easily.
     CCD photometry has an advantage in that the comparison star is typically in the same field as the star of interest and so the extinction coefficient is not necessary.  One common method employed by CCD astronomers is differential photometry with a star in the same field.  This has two advantages. The first is that no extinction coefficient is needed.  Secondly, any clouds that affect the image will effectively affect all stars in the frame by the same amount since the field of view is typically small.  It is not the brightness of the star itslf we are interested in, it is the difference in brightness between the star of interest and a comparison star.  Even if thin clouds do roll in, as long as both stars are visible through them, the difference between them should remain unaffected.
     Brightness measurements are calculated based on the sum of the pixels of interest, also known as the signal.  In all forms of photometry, the signal-to-noise ratio (S/N) of the data is often good to know.  A low S/N ratio means that the remaining random noise in the background is now on the order of the signal.  The signal may have random fluctuations that contribute more and more significantly to the measurement.
     One remaining issue that affects all forms of photometry and is difficult to account for is the cosmic ray. Cosmic rays are high energy particles that penetrate the atmosphere and originate in events such as supernovae, quasars, and other high energy events. Cosmic rays are very evident in a CCD image frame and usually appear as very bright pixels or very narrow sets of  bright pixels that are not in preceding images or images that follow.  They are quite frequent and are randomly distributed.  However, they can create a significant "artificial" signal spike if they fall on one of the pixels being measured.  One method of decreasing the effect of cosmic rays is to run a median filter over the image, but this actually blurs and alters the data so it should be used with care.

HOME


Created by Mathematica  (October 24, 2004) Valid XHTML 1.1!