Friday, December 12, 2014

Photometry with AIP4WIN: a Tutorial
Part 4 - Image Calibration

By R.D. Boozer

The following three images depict actual final master frames produced when AIP4WIN processed the supplied raw FITS files.

Figure 14: The final master bias frame.

Figure 15: The final scaling master dark frame

Figure 16: Final master flat-field frame with the V filter.

The master bias and scaling master dark frames shown in Figures 14 and 15 do not really reveal any important information to a human viewing them.  They don’t need to.  They exist solely for the software to optimize the image by eliminating electronically generated artefacts that are beyond a human being’s control.

However, the master flat-field frame is a different story since it may sometimes reveal problems that are the result of human negligence.  In the illustration depicting the master flat-field frame, I have labelled a number of common mostly minor issues that seldom cause serious problems, since the purpose of the master flat-field frame is to counter those effects.  Nevertheless, sometimes imperfections happen due to simple carelessness and may be so severe that flat-fielding will have difficulty fully correcting them.  Such is probably the case with the small solid grey oval labelled “?” that appears near the bottom of the frame whose darker color indicates that pixels within it got a much lower photon hit rate than they should have.  As shall be mentioned later, in regard to an unrelated issue wherein I suspected a bug in AIP4WIN, I sent copies of my master bias, master dark, and master flat-field frames to Richard Berry in his role as lead user supporter of AIP4WIN.  In a side comment, Mr. Berry brought notice to the oval saying, “… [it] looks suspiciously like someone sneezed on the optical window of the CCD camera.”  Though the flat-field frame may correct for most of the inaccuracy caused by such carelessness, it by no means does a perfect job.

The reader may have noticed another tab in the series in the Calibration Setup Tool that is labelled Defect.  This is used to repair cosmetic problems on images that are not used for scientific purposes.  Applying this function to images used for astrometry or photometry will compromise the integrity of the image data. (Berry and Burnell 204)
All V filter images were shot with an integration time of 20 seconds.  The created master bias frame, scaling master dark frame and V filter master flat-field frame were used to calibrate every V filter stellar image via the Auto-calibrate option under the Calibrate menu.  An uncalibrated V filter image that has just been loaded is displayed in Figure 17 with calibration imminent.

Figure 17: A raw image is about to be calibrated.

As soon as the Auto-calibrate option is clicked, all of the master calibration files are applied to the raw stellar image.  That is, the master bias frame is subtracted from it, the scaling master dark frame is scaled to match the image’s exposure time and then subtracted, and the image’s pixels have the previously described flat-field scaling algorithm applied to them using the master flat-field frame.  An image that has been fully calibrated in such a manner is shown in Figure 18.

Figure 18: A fully calibrated image.

The letter ‘V’ in the middle of the filename shown in the title bar above the image designates that it is a V filter image.  Of course for I filter and R filter images, there will be either an ‘I’ or ‘R’ in that position.  The rightmost two digits indicate where in the chronological sequence that an image fits; i.e., image 03 above will be followed by image 04, etc. I added “CF” to the filename to indicate that it had been calibrated with bias and dark frames and with flat-fielding applied.  I was initially disturbed when I saw that the calibrated image came up on the screen with a low contrast or “washed out” appearance and I suspected either a bug in AIP4WIN or that I prepared one or more of the master frames incorrectly.  It was at this point when I sent copies of his master frames and an image calibrated with them to Richard Berry, co-author of and lead user supporter for AIP4WIN.   Berry offered assurance that I had produced a good calibrated image and went on to remark in the same email, “Always think QUANTITATIVELY with astronomical images -- never trust the appearance on the screen.  Though I found Berry’s comments somewhat reassuring, I felt the need to empirically prove that the calibrated image was significantly better than the original.  After some consideration, I came up with the idea of seeing if there was a significant improvement in signal-to-noise ratio going from the raw image to the calibrated one.

Figure 19: Getting the SNR of a star in the raw image.

As shown in Figure 19, the Single Star Photometry function was used on a raw image.  It was invoked under the Measure menu by clicking the Photometry option and then choosing the Single Star suboption.  The last action caused the depicted dialog box to appear.  After a star is clicked in the image, a number of data are given under the Details tab, one of which is the signal-to-noise ratio of the selected star that is indicated to be around 65.  Next an identical series of actions were repeated for the calibrated image using the same star.

Figure 20: Getting the SNR of the same star in the calibrated image.

The SNR of the same star in the calibrated image is about 152.  Approximately 2.4 times greater than in the raw image!  It appears that calibration was indeed a success.

Two V filter images were immediately rejected without even checking them I was told beforehand that Gliese 876 was saturated in those images: X2253V2470028.fits, and X2253V2470048.fits.   It should also be mentioned that all other images exposed with all filters were examined to see whether or not they contained a saturated star image.  The procedure that I followed for determining this condition will now be outlined.

Figure 21: Checking for saturation of Gliese 876.

First, the image to be checked was loaded and the Single Star Photometry function was invoked as described earlier; however, the Result tab was used this time.  The brightest star in the image (that was always Gliese 876) was clicked.  In the case of all other V images, I found that the peak pixel value for that star was significantly less than the saturation value of 65535.  As an educated guess, I would say that since the flat frame cannot do a perfect correction for pixel variation, any image should be rejected if the peak of the target star is higher than the upper 50,000s.   In Figure 21, one can see that the star’s peak pixel value is 41973.9 and so the image is a good candidate for photometry.

In the V filter images, the target star, Gliese 876, is the most prominent star.  In a few of the images, either only one star other than the target star is visible or some others were fairly faint.  In all of the rest of the images four other stars are prominently visible.   Figure 22 depicts one of the worst images where there is only one star other than Gliese 876 that is plainly visible and that is the star to the far right.

Figure 22: One of several V images that show only one other star than Gliese 876.

Why are there some images where only the target star and one other star are prominent, though in the remaining images the other stars are plainly visible?  If seeing conditions were relatively constant throughout the night, there should be the same number of prominent stars visible in each frame, since the images were all shot with the same integration time.

The two worst offenders are images X2253V2470001 and X2253V2470004.   To investigate what is going on, I looked closely at these images and compared them to images where more stars were prominent.

For example, the fact that only the brightest stars are showing in image X2253V2470004 might lead me to suspect that a thin cloud layer obscures the other stars.  But is there a way to empirically prove that?  To get the necessary evidence to check this hypothesis, a test was done.  A comparison was made between image number X2253V2470004 (which is depicted in Figure 22 as a one of the frames showing only Gliese 876 and the comparison star) and image X2253V2470005 (that is one of the frames showing at least five prominent stars).

The light profile of the star to the right of Gliese 876 in the five star image X2253V2470005 appears in Figure 23.

Figure 23: Light profile of a star from an image showing several stars.

The above pictured dialog box was invoked by going to the Measure menu, clicking the Star Image Tool option, selecting the Shape tab and finally clicking the star to be measured.  This causes a plot of ADU counts for the star at increasing pixel radii from the centre of the star.

Now compare the plot above to the plot of the light profile of the same star in the two star image X2253V2470004 that follows in Figure 24.

Figure 24: Light profile of C1 from an image showing only two stars.

Notice how the light profile of the same star obtained from the image with several stars is relatively tight and thin, whilst the other light profile from the image with only two stars has a curve that is thicker and more diffuse.  The latter curve is exactly the kind of curve one would expect to see if the starlight is being diffused by a cloud!  Light that would have been thinly concentrated at each particular radius is being scattered by cloud particles over several radii.  X2253V2470001 is another image with only two prominent stars and it too showed a “fuzzy” light profile similar to Figure 24.

The light profile of the same star in images X2253V2470003, X2253V2470045 and X2253V2470049 also shows a lot of fuzziness, but the curve line is not as thick in these and would indicate that the cloud layer was thinner than it was when images X2253V2470001 and X2253V2470004 were taken.  The inescapable conclusion: a cloud layer is the culprit for the severe magnitude discrepancies.

It is a well established precedent that accurate differential photometry may be carried out through “haze or light clouds” (Berry and Burnell 293)  Given that fact, was the haze or cloud level thin enough in the remaining images to allow the possibility of valid results?  The accepted practice to check for this condition is to make sure that the target star and at least one other star has a signal-to-noise ratio of 100 or greater.  (Berry and Burnell 296)  This issue is very important because SNRs of 100 or higher are required to obtain accurate data on a light curve with an amplitude around 0.1 magnitudes or below, such as extrasolar planetary transits. (Warner 34)  After performing this check on all of the V filter images, the only images that did not meet this qualification were X2253V2470001, X2253V2470003, X2253V2470045 and X2253V2470049.  Therefore, if these are excluded from the set, what is left is a set of images suitable for differential photometry for this project.  However, even these images are such that the remaining 3 prominent stars have SNRs far below 100, meaning a restriction to having only one comparison star.

Because there were no comparison images of parts of the sky other than the field containing the target, it is obvious that the University of Tasmania observers intended differential photometry to be used in their analysis.  In my opinion this was a wise decision because differential photometry has three primary advantages: 1) accurate differential photometry may be done through thin clouds, 2) it is simpler to implement than other methods (Warner 32) and 3) atmospheric extinction issues affect it less than any of the other photometric methods.  In fact, as long as the target and comparison star have similar colors, atmospheric extinction effects are essentially totally eliminated!   This condition is true because all stars in the image are of necessity shot through the same filter, at the same time and are close enough to each other that they are thus subject to essentially the same airmass. (Berry and Burnell 279, Warner 32-33)  Unfortunately, it is not always possible for the target star and comparison star to be of similar colour, and this issue will be discussed later.

The importance of point number 3 above cannot be over emphasized.  It implies some important principles that will be empirically obvious in the final photometric data shown later in this tutorial.  The most basic of these principles is that the difference between the observed magnitudes of the comparison star and target star is relatively insensitive to atmospheric changes such as cloud variation and airmass extinction.  Since the comparison star is considered to be of constant brightness, any variation in the difference of the magnitudes should be coming only from the target star.  However, changes in cloud cover and airmass will cause wide variations in the observed raw magnitude of the target star.  Ergo, the difference in magnitudes between the comparison star and the target star is a much more reliable indicator of real changes in the magnitude of the target star than the target star’s observed raw magnitude.

In the next instalment of this tutorial, the method of setting up the actual differential photometry using the Magnitude Measurement Tool will be described in detail.

Berry, Richard and James Burnell, Handbook of Astronomical Image Processing, (2006) Willmann-Bell, Inc., Richmond, Virginia, USA

Warner, Brian D., A Practical Guide to Light Curve Photometry and Analysis, (2006) Springer Science + Business Media, Inc, New York, New York, USA

Copyright 2014 R.D. Boozer

Monday, November 3, 2014

The Great SLS Debate

On Sunday, November 16 at 4PM Eastern Standard time, the globally popular online program The Space Show will host a live debate regarding the merits of NASA’s controversial rocket known as the Space Launch System, AKA SLS.  Arguing for SLS will be John Hunt (a former military aerospace professional), while the contrary position will be supported by Rick Boozer (Space Development Steering Committee member, astrophysicist and author of the book, The Plundering of NASA).  Dr. David Livingston will be the host and moderator of the debate.

Its supporters claim that SLS will allow NASA to return to the Moon and go to points beyond. Its detractors claim it will actually prevent the achievement of that goal (wasting many billions of dollars of taxpayer money in the process) and thus refer to SLS as “The Rocket to Nowhere”.  It is the latter faction’s contention that there are more modern, more economical, safer and easier to implement alternatives to SLS for American deep space travel.

Tune in to see which side makes the best case about how our nation’s future in space should be conducted.  A recording of the debate will be available for free download a couple of days after it airs.

Friday, September 26, 2014

Photometry with AIP4WIN: a Tutorial – Part 3
Flat-field preparation

By R.D. Boozer
As mentioned earlier, flat-field frames are created to remove the bad effects of any optical defects in the telescope/camera system.  The two most common methods of shooting flat-field frames are 1) shooting a twilight sky and 2) using what is called a light box (a simple artificially lit box that can be constructed by the user).  Both of these methods are described extensively in Berry and Burnell’s book along with instructions on how to implement them; therefore, there is no need for me to cover those details here.  Instead, I will cover what the observer is to do with the flat-field frames after they are shot.

Before discussion of the implementation of flat-field frames, it should be mentioned that there were several sets of supplied stellar images, with each set taken with a different optical filter.  Those were V, R and I filters which are centered on 550 nm, 650 mn, and 800 nm wavelengths respectively. (Warner 24)   Magnitudes measured with the V filter will roughly correlate to traditional visual magnitudes.  Magnitudes with the R or red filter are measured in the longest wavelengths visible to the human eye, whilst I filter magnitudes are obtained in near infrared light. Later within a reference framework, there will also be mention of U and B filters centered on a 365 nm wavelength and 440 nm wavelength respectively, with U corresponding to near ultraviolet and B being shorter wavelength visible light that appears primarily blue.  (Warner 23)  There may also be mention of a color index, which is the magnitude of a star measured in one filter subtracted from the same star’s magnitude in another filter. (Warner 29)  The reason for obtaining images in such varying wavebands will eventually be explained.

Any flat-field frames that are to be used on a stellar image must have been exposed through the same filter as the image to which it is to be applied.  Because most of the supplied stellar images were taken using the V filter, the creation of a master flat-field frame will be demonstrated using V filter raw flat-field frames.

Another point that needs to be made is that all flat-field frames should ideally be exposed with an integration time such that most of the pixels contain roughly half the saturation value for a pixel.  This level of exposure ensures that enough light has been absorbed to have a strong enough signal, but not close enough to saturation that the light response in the image is no longer linear. (Berry and Burnell 182)  Given this fact, I went about checking each of the raw flat-field frames to see if they met this important criterion before starting the calibration setup.  The explanation of the flat-field part of the calibration setup will be continued after the description of the half-saturation evaluation (that was done earlier) of the flat-field frames.

According to the instructions supplied for the assignment, the saturation level of the CCD sensor used is 65k, which for computer equipment such as a CCD chip is 216 or 65536.  Given this statement, I can attest the following facts from his previous career as a software engineer.  Since a reading of 0 is always considered to be the lowest value in the range, the actual value range for a pixel of the CCD chip would be 0 to 65k-1 or 0 to 65535 ADU (this is still 65k possibilities).  So nothing will register higher than 65535 ADU and thus this value would indicate absolute saturation.  The following screen capture image illustrates how each raw flat-field frame was checked to see that the pixels it contained had values somewhere in the vicinity of 65k divided by 2 or 32768 ADU.

First, the raw flat-field frame was loaded via the File menu as one would load any other image.  Once the image was loaded, the Pixel Tool option under the Measure menu was invoked.  The Rectangle from corner radio button is clicked so that the user can drag the mouse to define the area in the image that he/she wants to check, excluding the unexposed vertical black strips to either side of the actual exposed image.

Figure 10: Making sure a flat frame’s pixels are near half saturation.

The minimum value of 17845 would be one of the stray occasional darkest pixels that have below normal sensitivity and can essentially be ignored, especially since this is one of the things for which the flat-field frame was created to compensate.   What is important is the median ADU value of 35727, which indicates a value such that approximately half of the pixels in the image should have an exposure above that value and half below.  Considering that fact along with the indication that the maximum pixel ADU value in the image is 39262, it then appears that this is a fairly well exposed flat-field frame.  Remember, a value only roughly near the ideal of one half saturation is necessary; therefore, this flat-frame is adequate.  Indeed, when I checked every raw flat-field frame for every filter in this manner, all of them were exposed at a level adequately near the half saturation value.  Again, all of this was done before the Calibration Setup Tool was invoked.

Now continuing the discussion of the Calibration Setup where it was left off, the Flat tab is clicked and produces what is shown in the next illustration.

Figure 11: The default appearance of the Flat-field frame tab.

Clicking the Select Flat Frame(s) button begins the selection of the raw flat-field frames for the production of a master flat-field frame.  Again, the actual selection process is similar to the one followed during the selection of raw bias frames; therefore, that detail will not be shown.  All of the V filter flat-field frames were of 25-second exposure and, as shown earlier, this was a sufficient amount of integration time to fill the pixels to approximately half saturation.  After the raw flat-field frames are chosen, the Flat tab appears similar to thusly:

Figure 12: The raw flat-field frames have been selected.

It is normally considered optimal to shoot at least 16 raw flat-field frames to obtain the highest quality master flat-field frame.  (Berry and Burnell 182; AAVSO 3.4)   Only 13 V filter raw flat-field frames were supplied.  There could have been an equal number of what are called flat darks which might improve the final images.  These are raw flat-field frames where the twilight sky is used as the uniform light source and have the same integration time as the regular flat-field frames.  With these 32 flats (16 flats + 16 flat darks), typical master flat-field frames have a signal to noise ratio of around 600. (Berry and Burnell 182)  An SNR of 500 or better is needed to obtain 0.01 magnitudes accuracy.  (AAVSO 3.4)  But with the paucity of flats that were supplied, it will be good fortune if the SNR of the master flat is half of that.  However, even given only fairly transparent seeing conditions, Gliese 876 would be a special case where planetary transit photometry may not require such extremely precise magnitude resolutions, for reasons that will be explained later.

Had dark flats been supplied, the Subtract Dark Flat box would be checked and the Select Flat Dark(s) button clicked to allow the selecting of the raw flat darks.  Instead, the user goes directly to clicking the Process Flat Frame(s) button to make the software automatically create the master flat-field frame via averaging of the raw flat-field frames.  A result similar to what you see below presents itself after that action.

Figure 13:  The master flat-field frame has been created and may be saved.

Of course, the user may now click the Save as Master Flat button to make a permanent copy of the newly generated master flat-field frame.  The Applied Flatfield Correction box was automatically checked and indicates that any stellar image calibrated by AIP4WIN will have the master flat-field frame automatically applied to it.  Of course, if for some reason the user decides (for some reason) he/she does not want the master flat applied, the box may be unchecked.  But for photometry, you definitely want it applied.

Understanding how the master flat-field frame is applied to the image is important.  But before this is discussed, the reader may be wondering, “What purpose do the Median Combine and Normalize Median Combine radio buttons serve?”

Some observers contend that there is a way to produce a better flat-field frame than by using a uniform artificial light source and/or flat dark frames taken at twilight.  Instead of a series of exposures from the two aforementioned relatively uniform light sources, they take a number of exposures of different areas of the dark night sky whilst making sure that none of the exposures contain a bright object.  A median combine of those exposures is then done.  Since disparate parts of the sky are being merged, any particular stellar object in a frame will be removed by the median operation since it will not appear in other frames.  Proponents of this method say it gives a more uniformly illuminated master flat-field frame than traditional methods. (Brown 1)

According to AIP4WIN’s built-in help documentation, a normalized median combine is used when the only flat-field frames shot are dark flats taken at twilight.  In this case, the flat darks are scaled to produce a common average value and then median combined.

But once a master flat-field frame has been generated, how does AIP4WIN apply it to the image during calibration?  After the bias-removed dark frame has been subtracted from the stellar image, an operation is done on each pixel in the stellar image.  This operation consists of dividing the value of a stellar image pixel by a ratio that is equal to the ADU value contained in the corresponding pixel in the flat-field frame by the average pixel value of the central region of the flat field frame.  The reason why the average of only the central region is used rather than the average of the whole flat-field frame is because it is assumed that the values at the outer edges of the field are going to be consistently lower than central pixels due to vignetting and that vignetting is part of what is to be eliminated. (Berry and Burnell 189)

Why does this procedure work?  If the above-stated ratio were gotten from a perfectly flat frame, then that ratio of the average value to the value of a pixel would always be one.  However, because of vignetting, inhomogeneous pixel sensitivity, etc., a one value for any pixel is seldom the case.  In the instance of a pixel with low sensitivity or that is shaded by a dust particle on the camera’s optical window, then the pixel value in the master flat will be low.  Thus, the ratio for that pixel in the flat frame will be greater than one and the value of the corresponding pixel in the stellar image will be boosted upward to what it should be when it is multiplied by the ratio. (Berry and Burnell 190)

In the next instalment of this series of articles, I will reveal the visual appearance of the master bias, dark and flat-field frames and how to use the software to apply them for calibrating an astronomical image.

Berry, Richard and James Burnell, Handbook of Astronomical Image Processing, (2006) Willmann-Bell, Inc., Richmond, Virginia, USA
Brown, Michael, Flat Fielding Dithered Data,  (1996)
Warner, Brian D., A Practical Guide to Light Curve Photometry and Analysis, (2006) Springer Science + Business Media, Inc, New York, New York, USA

Copyright 2014 R.D. Boozer