What are Flats? How do you take them? How are they applied? I keep seeing these questions in novice astrophotography forums. This post is intended to answer this questions in basic terms and not get too bogged down in the details. The concepts of what flats are and how they’re applied are pretty easy, and I’ll cover some basic methods of taking flats. However, I think you’ll find there’s a lot of of technical detail and technique to master to be able to routinely take good flats.
So what are flats and what are they for? Flats, like Dark Frames, are images taken to correct for defects in the imaging system. Flats are meant to correct for imperfections in the optical path to the camera. Flats can correct for issues like:
- dust motes on the camera sensor or filters
- vignette caused by small filters or focal reducers
- the usual uneven brightness near the center of the FOV
The way flats work is that a image is taken of a plain white field and exposed so the camera sensor is about half saturated (half way to being over-exposed). The reason for exposing this much is so there is enough data, and not too much data, to allow math to be performed that will give meaningful results.
The math that will occur when applying the flat is that every pixel value (PV) on the “flat” will be divided by the average of all the PVs of the flat. What this does is “normalize” the image. So for example if a given PV is equal to the average value the result for that pixel would be 1. If a given pixel is brighter than the average, the result will be bigger than 1, and if the given pixel is dim, then the result will be less than 1. Then each pixel of this normalized image is divided into the corresponding pixel of your Light Frames. You can see that what this does is brighten spots on the Light Frame that were dark because of dust or vignette, and darken areas where the optics made for a bright area. Here are some example photos:
Here is the darn ugly Flat taken for this session:
This is the Light Frame (already dark subtracted). See the center glow and dust motes:
The Flat math is done and here is the result:
I think you can see that applying the flat did a pretty good job of cleaning up the image.
Note that applying flats is not complicated for us end users. Whatever stacking software you use should handle the math transparently as part of the image calibration process. However for illustration, if doing a basic calibration, the usual process steps that incorporate Flats would be:
- Gather the individual Lights, Darks, Flats, and Flat-Darks you intend to use.
- Stack the Darks and Flat-Darks into a master Dark and master Flat-Dark.
- Subtract the master Flat-Darks from the individual Flats.
- Stack the individual subtracted Flats to a master Flat.
- Subtract the master Dark from the individual Light frames.
- Normalize and divide the master Flat into the individual Light frames.
- Stack the Light frames.
This process varies a little depending on whether you’re using a One Shot Color or monochromatic imager, and various software packages may choose different methods to optimize the processing time. However, I think you can see from the above how the sequence will correct for many of the intrinsic errors in your images. Again, most software packages have calibration routines that will accept the list of Lights, Darks, Flats, etc., and do all the calibration in the background. So, it’s not hard….. The hard part (and it’s not really hard) is taking decent flats in the first place.
So, how do you take Flats? The details of the process for taking flats varies depending on your setup and camera. There are some important points:
Flats need to be taken at the same focus and camera orientation as the lights. After all, the point is to show the discrepancies within the optical train used to capture the image. So everything should be in the same position as when the Lights were taken.
However, a key point that comes up over and again, is how long to expose the flat. As mentioned at the start, the average brightness of the exposure should reach about half saturation. Maybe a better way to think about it would be. that a flat should be exposed so that all the pixel values should be in the linear range of the sensor. As such, setting the exposure to about half way to the saturation level will keep the PVs as much as possible in the linear range. So, if you’re displaying the result on a 16 bit scale, then setting the exposure so the central portion of the frame at near 30,000 is appropriate. I seem to get good results with central area readings anywhere from 20,000 to 35,000. If using a historgram to judge, the bulk of the data should be in the middle, well away from the ends. The pic below might be what you’d see if you were capturing flats in Nebulosity:
As if you didn’t have enough to worry about…. here’s another, Color Balance. It’s best to have a true white light source. This is actually a little difficult, but know that it doesn’t have to be perfect.
- If shooting color images with filters, the light source color balance is not critical. Flats are typically taken for each filter and the exposure time of the flats may be adjusted for each filter to reach the half saturation level.
- If using a One Shot Color (OSC) camera, the balance is more important. The source should have strong content of each color (R, G, & B). This is necessary because the OSC imager will be capturing all the colors at once, so you can’t control the exposure time for each color, and yet each color must be well represented in the data.
A very handy utility to check this is in a progam called Fitswork. Fitswork is free (at least at the time of this writing it is) and it available HERE. There is a function in that program called “Show a Pixelline as Diagram”. It will show the PVs on line you draw across the image. Here is an example:
In this case the RGB balance is just fine. I’ve had light sources for taking flats that were badly red deficient and it was very difficult to correct the image. So if you’re using an OSC camera, be sure to check your light source.
Okay, so a couple ways to shoot flats:
- My favorite… T-shirt flats: With your camera at focus and in the same position of your Lights, drape a layer or two of a clean T-shirt over your objective. with a rubber band or other elastic, make sure there are no wrinkles. Point the scope to clear sky away from the sun. Adjust the exposure level to hit the half saturation point and then capture enough images to stack to a clean master, 8 to 20 frames should be enough. I like to adjust the light getting to the camera (by where I point the scope, or number of cloth layers) so I can set the exposure time somewhere between 0.5 to 2 seconds.
- If I can’t wait ’til dawn: I use a laptop screen positioned close to the scope objective. I just get the laptop to display a white screen (open a text editor for example), point the scope at it, adjust the exposure and shoot. It works well. Some folks also drape a T-shirt over the objective to help diffuse the light more.
- You can also shoot twilight flats where you just point into the twilight at dusk or dawn. At just the right time so it’s not so dark that stars show, and dark enough that you can set a reasonable length exposure (0.1 secs or longer). I’ve found this method difficult.
Whew… I thought this was easy, I hope this is enough to get you going. I’ll update this a bit more in the future if needed. Please provide comment if you see errors or have input on improving the writeup.