Taking Flat Frames with ACP - Introduction

ACP can automate the task of acquiring flat frames using one of two techniques:

Whether taking sky or dome flats, ACP will automatically adjust the exposure interval for filter transmissivity, and in the case of sky flats, for the changing sky brightness. Either system takes advantage of a flat plan that specifies the filters, binning, counts, and rotator positions, changes focus for each filter, and collects all of your flats in a single automated operation. The flat process can also slew your telescope to a "dew-avoidance" position after flats are acquired. See Dew Avoidance Post Slewing. Finally, you can control the naming and folder location of the flat frames, see AutoFlat File and Folder Customization.

noteSee Getting Started and Routine Use - The Easy Way for step by step instructions... but we recommend you don't use ACP's automatic flat features until you have familiarized yourself with the tools and process flow. It's also much easier to use from the web browser interface!

About Automatic Sky Flats (see below for panel/screen flats)

If you've ever tried to take sky flats yourself, you know how difficult it is to automatically get quality sky flats with the right ADU, and still get enough flats to be useful. ACP includes a standard script AutoFlat.vbs which automates the task of acquiring high-quality sky-flats at dusk and dawn. Normally, you won't need to run this script yourself; it's managed by your ACP observing plan when the #DUSKFLATS/#DAWNFLATS directives are included in the observing plan.

How Sky Flat Acquisition Works Automatically

ACP acquires sky flats using the minimum gradient position in the sky. This position is on the solar circle near the zenith, offset in the anti-solar direction by 15 degrees. This is close enough for most uses, including precision photometry. For more information and the theory behind this selection, see The Flat Sky: Calibration and Background Uniformity in Wide-Field Astronomical Images, Chromey & Hasselbacher, PASP 108: 944-949, October 1996. Click on the link then scroll down to Printing Options, select Print Whole Paper, then click Send PDF. The paper will appear in your browser if you have Acrobat Reader installed. Thanks to the NASA Astrophysics Data System for making this available online.

If the time is before dusk, the sequence starts with the Sun 1 degree above the horizon at dusk. This is always too bright. Exposures start at the user-specified minimum duration (the shortest possible without shutter vignetting). Using the first combination of filter and binning (flat set) in the flat plan, minimum-duration exposures are repeatedly taken at 1 minute intervals until (at the minimum exposure duration) the mean background ADU falls within the user-desired range for flats.

At this point, flat acquisition continues, with the exposure duration being automatically adjusted for the decreasing light, until the prescribed numbers of flats for that flat set have been acquired. Before taking each flat, the telescope is moved in azimuth a random amount, up to one degree in either direction from the ideal location, so that any stars that might become visible are dithered and will be eliminated by later median combining of flat frames. This process is repeated for each flat set in the flat plan, or until it is too dark to reach the desired mean ADU range for the flat set in the flat plan. During gaps where it is too bright for the next flat set, the 1-minute wait loop is re-entered. Flat acquisition for three binnings and five filters should be complete within a half-hour after sunset.

If it's night and before dawn, the process is reversed, starting with the Sun 9 degrees below the horizon, at dawn.

About Dome/Screen and Artificial Light (Panel) Flats

If you have a lighted flat-box, EL panel like the Optec/Alnitak FlipFlat or FlatMan, a lighted screen, or white area on your dome, etc., you can have ACP acquire automated flats using this light source instead of the sky. All that's needed is a way to control the light source from a command line program on the observatory computer. This has lots of advantages over sky flats, not the least of which that it is not time-sensitive. Depending on light leakage, you could take flats at any time day or night, rain or shine.

How Dome or Artificial Light Flat Acquisition Works

The flat plan for light source flats is identical to that for sky flats. Similar to the sky flat process, as ACP acquires flats using the light source, it will automatically adjust the exposure to maintain the mean background ADU within the limits you specify as you change filters. If you have a variable brightness light source, and its brightness can be controlled via its command line program, you can specify light source brightness for each filter in the configuration data, and for each requested binning level 1-4 to account for the sensitivity differences. Thus you can have the light source much brighter for narrowband filters than for wideband ones, and brighter for bin-1 than for bin-2, etc. In any case, ACP will adjust the exposure to achieve the desired mean background ADU. Thus the light source brightness is not at all critical, as you will find out.

Here are some things to be aware of when using the panel or screen flat modes:

Getting Started

The flat process depends on a configuration file AutoFlatConfig.txt (in the ACP config file folder, Public Documents\ACP Config). We have provided a sample to use as a starting point: SampleAutoFlatConfig.txt. You must enter values in the format for your system's language. If your system uses comma for the decimal point, enter fractional numbers that way! Here's what you need to do:

  1. Open SampleAutoFlatConfig.txt in Notepad or any ANSI text editor.
  2. Remove the ";REMOVE THIS LINE" line -- it's used to double check that you did adjust the settings!
  3. Save this document into the same folder as AutoFlatConfig.txt (leave the sample one intact).

OK, are you ready? Click this button to open SampleAutoFlatConfig.txt in Notepad now.

note Upgrading from a previous version of ACP? If so, we recommend that you print out your current AutoFlatConfig.txt and use it as a guide to make a new AutoFlatConfig.txt from the provided/current SampleAutoFlatConfig.txt as described above. Note that CompressFlats is gone!

In any case, the items you must edit for your system are:

  1. Main Section
  2. Sky Flats Section
  3. Flat Panel or Screen Section
    Before editing this, run your light control program in a command window and make sure you can control the panel or screen and write down the exact commands given to do that. Testing this now will save you pain later.
  4. Prepare a flat plan and save it as defaultflat.txt in your default plans folder (typically My Documents\ACP Astronomy\Plans).

Testing Sky Flats

This is a test procedure only. See Routine Use below for the normal way Autoflats are acquired.

  1. Wait until late afternoon or early morning, and then start AutoFlat.vbs in the ACP console. If you saved your flat plan as defaultflat.txt as recommended above, it will be ready to run with no further input from you. Otherwise it will ask you for a flat plan to use. Either way, ACP will wait until the sun is close to the right elevation and start measuring, waiting for just the right conditions, then it will start acquiring high-quality sky flats according to the schedule in your flat plan.
    notePlease note, this is a test procedure! Normally, you will not run AutoFlat.vbs yourself! It is automatically used by the main image acquisition system behind the scenes, as described in Routine Use below.

  2. After AutoFlat.vbs completes, review the AutoFlat-xxx.log file (in the AutoFlat sub-folder of your default Images folder). Look at the exposure durations used for each flat set.
  3. If you find that, during dusk, the flat ADU values are consistently lower than the desired ADU, and/or at dawn the ADU values are consistently higher than the target background ADU, you can adjust the ADUAcceleration_xx User Setup settings in AutoFlatConfig.txt. Lower the PM one a bit and raise the AM one a bit. The default values are 0.95 and 1.05 respectively. Try changing them to 0.9 and 1.1. The goal is to get the ADU values close to the desired ADU value. After you make a change, you can see if you made things better by comparing its log with previous logs. These acceleration constants are used to make up for the fact that your imager doesn't instantly download images. The slower your imager is, the more you'll have to adjust the constants in the direction just described.

Routine Use - The Easy Way

With all of its flexibility, the AutoFlat system can be confusing if you're an ACP beginner. Fortunately, there's an easy way to do a night's run with both dusk and dawn flats. The key is to first complete the one-time Getting Started section above, where you create and refine a standard set of flats to be taken at dusk and dawn. Once you've done that, you don't need to run AutoFlat.vbs yourself again!

Assuming you want to do both dusk and dawn flats:

  1. Put #DUSKFLATS at the beginning of your ACP observing plan.
  2. Right below that, before any targets, put a #WAITUNTIL 1, hh:mm directive (note the "1"), with the time at which you want to start observing. If you don't do this, ACP will start observing immediately after the dusk flats, when the sky is still too bright! For example:
    #DUSKFLATS
    #WAITUNTIL 1, 03:00  ; Start observing at 0300 UT
  3. Put #DAWNFLATS at the very bottom of your ACP observing plan.
  4. If you want the observatory to be shut down after taking dawn flats, put #SHUTDOWN anywhere in the plan. The best place is right before the #DAWNFLATS so you can easily see it.

That's it! With the above conditions, ACP will do your dusk flats, and then start your observing plan which will wait until the right time to start observing. When your observing plan completes, it will wait till dawn then acquire your dawn flats. Of course, you have to start your observing early enough (a half hour before sunset is fine). Here is a sample LRGB observing plan with automatic sky-flat support and observatory shutdown.

Flat Plans

AutoFlat.vbs takes flats according to a flat plan file which you must prepare. You can generate flat plans from observing plans created using ACP Planner, or write flat plans with Notepad. You can keep these flat plans for repeated use. Often, just 2 or 3 flat plans are enough for many observing tasks.

The format of the flat plan is one line per flat set. A flat set consists of a combination of count, filter, binning, and (optionally) rotator equatorial position angle, in that order separated by commas. The order of flat sets must be as they would be taken at dusk - with the filter/binning resulting in the lowest sensitivity used first (when the sky is brightest).

noteFilter sensitivity for sky-flats is not the same as for night imaging. Often Red will be the least sensitive. For sky-flats, you are imaging a blue sky! Also, higher binning is much more sensitive so list your lowest binning levels first, regardless of the filter. See Flat Set Ordering below.

For example, assuming you have Red, Green, Blue, and Clear filters (in order of increasing sensitivity), and need only binning 1 flats for Clear and only binning 2 flats for the others (typical LRGB astro-imaging scenario), 5 each, and don't have a rotator, then your flat plan might look like this:
5,Clear,1
5,Red,2
5,Green,2
5,Blue,2

You can start lines with a ";" and these will be considered a comment. You can also put comments on live plan lines, starting with a ";". In both cases, comments are ignored. As stated above the rotator PA is optional, and may be omitted (as it was in the above example). In order to make a plan more readable, you can include any number of spaces in the flat set specs. With the addition of comments and spaces, a more readable version of the above flat plan might look like this:

; Bob's flats for 17-Jan-2006
5,  Clear, 1                   ; Clear at binning 1 is least sensitive
5,  Red,   2                   ; Red is least sensitive relative to filters alone
5,  Green, 2   
5,  Blue,  2                   ; Blue at binning 2 is most sensitive

If You Have No Filters

If your imager has no filters, just leave the filter field in the flat plan empty. Remember higher binning is much more sensitive, so list binning 1 first! For example:

; Bob's flats for 17-Jan-2006
5,,        1                   ; 5 flats at binning 1
5,,        2                   ; 5 flats at binning 2

Flat Plan Input

AutoFlat.vbs normally runs under control of AcquireImages.vbs. In this normal mode of usage it expects to find a default/standard flat plan in your Plans folder (typically My Documents\ACP Astronomy\Plans):

noteUntil you get familiar with the flexibility and degrees of freedom that flat planning can provide, it is strongly recommended that you prepare one standard flat set for general use, called defaultflat.txt, and put it into your default plans folder. Then for sky flat systems, use the #DUSKFLATS and #DAWNFLATS directives in your ACP observing plans. It's going to take you some time to determine the optimum ordering for your filter/binning combinations to make the best use of the twilight sky window available for sky-flats. See the next section. For screen flat systems just use the #SCREENFLAT directive.

Flat Set Ordering for Sky Flats Only

For sky flats is up to you to determine the sensitivity of your system for each filter and binning combination, and then list them in increasing order of sensitivity for sky-flats. At dusk, it starts out bright, so you want to use your least sensitive filter first. Generally, Red is the least sensitive when imaging a blue sky. And sensitivity goes up as the square of the binning level, so you always want to list your lowest binning levels first, regardless of the filter.

If you're willing to be conservative and waste some time, it's easy to plan your flats. Do the filters from least to most sensitive at the lowest binning, the repeat for each higher binning level. On the other hand, you're going to find that optimal planning of flats is a real challenge. At least you have this flexibility with ACP! Here are some things to consider:

Rotator Support

If you have a rotator (and rotator support is enabled), you can (and should) include a fourth item in each line of the flat plan: the equatorial (sky) position angle (PA) for the flat set.

noteBefore doing auto-flats with a rotator, it is imperative that you have completed at least one image acquisition run with the imager mounted on the rotator as it will be during flat acquisition. This is needed for ACP to determine (via plate solution) the difference between the rotator's mechanical angle and the true equatorial/sky position angle of the images. This allows you to use the same PA in flat plans as you use in observing plans, and be assured that the flats will be taken with the same rotator mechanical position as your live images.

With rotator support, if the telescope is a GEM, half of the flats in each set are taken with the rotator at the specified PA and the other half are taken 180 degrees from the specified PA. This allows making flats for the common case where the target crosses the meridian/flip-point, invokes ACP's auto-flip feature, and thus has a 180 degree rotation in the middle of acquiring its images. The west and east images require flats with rotations 180 degrees apart.

noteThis splitting of flats can be suppressed by setting the advanced parameter NoAutoFlipRotatorPA to True in AutoFlatConfig.txt (Advanced Users section).

Here is an example of a flat plan for a rotator-equipped system:

; Bob's flats for 17-Jan-2006 - 193.5 sky PA
5,  Clear, 1, 193.5             ; Clear at binning 1 is least sensitive
5,  Red,   2, 193.5             ; Red is least sensitive relative to filters alone
5,  Green, 2, 193.5   
5,  Blue,  2, 193.5             ; Blue at binning 2 is most sensitive

Note that use of a rotator for multi-target imaging can quickly lead to needing far more flats than you can produce. This is the main disadvantage of using an internal/off-axis guider and rotator. Careful planning of multi-target runs can help. For example, if you are going after three targets over three nights, you can take one set of flats for each target on each of the three nights at dusk and dawn. Take all of the flats for a particular sky position angle (for one target) in one dusk or dawn run to eliminate rotator slew time detracting from the time available for flat acquisition.

The Meaning of PA in the Flat Plan and ROT_PA in the FITS header

In order for a flat field to be effective, the key is for the flat to be acquired at the same mechanical rotation with respect to the optics. For a simple/fork mount, this is always the sky PA plus the mechanical error. If you request a flat for a given PA, ACP will apply the mechanical error it last saw between the sky and mechanical angles. It will put a special field into the FITS header called ROT_PA. This will be the mechanical rotator angle.

For a German Equatorial mount, the situation is a bit more complex. The requested flats will be split between "east" and "west" orientations. Regardless of the mount's actual position during flat acquisition (dusk, facing east and dawn, facing west), ACP will take the "east" flats with a mechanical position corresponding to that used for acquiring images at the requested sky PA, and the "west" flats with a mechanical position 180 degrees from that position. As for simple mounts, the ROT_PA FITS field will contain the mechanical rotator angle.

Directives

Besides the lines specifying flat sets, a flat plan may also include the following directives (these are analogous to the directives that can appear in an ACP observing plan). These are provided only for special situations and advanced usage.

#DAWNSHUTDOWN
#SHUTDOWN (synonym for screen flat systems)

(Special situations only) When dawn flats have been completed, the observatory is shut down: the imager is warmed safely, the telescope is parked, and the dome/roof is closed. This does the same things as the #SHUTDOWN and #SHUTDOWNAT observing plan directives, and if the observing plan contains one of these, it is not necessary to include #DAWNSHUTDOWN in the flat plan. This is provided only for special situations.

noteThis directive is ignored when AutoFlat.vbs is run before dusk, so it may be included in a standard flat plan used at dawn and dusk.

#DAWNSCRIPT [script.xxx]
#SHUTSCRIPT [script.xxx] (synonym for screen flat systems)

(Advanced users only!) When dawn flats have been completed, the given script is run. In all cases, the script file is assumed to be in the ACP Scripts folder.

noteThis directive is ignored when AutoFlat.vbs is run before dusk, so it may be included in a standard flat plan used at dawn and dusk.

Advanced Users

In AutoFlatConfig.txt, you'll see an Advanced Users section. These items have been provided to allow the ultimate in flexibility and optimization. They are described in AutoFlatConfig.txt itself. Here are some of the Advanced User capabilities available for automatic flat acquisition:

Dew Avoidance Post Slew

After flats have been acquired, AutoFlat can optionally move your telescope to a position for "dew avoidance" (usually a low elevation). To enable this, in AutoFlatConfig.txt uncomment the line PostFlatAlt and set its value to the altitude to which you want your scope moved. Be sure to honor the horizon and safety limits set in ACP and your mount controller! The post-flat slew will go to the altitude you specify, and whatever azimuth the scope was at when flats completed. This avoids a meridian flip on a GEM.

If you want the post-flat slew to go to a specific azimuth, in AutoFlatConfig.txt uncomment the line PostFlatAz and set its value to the azimuth to which you want your scope moved. For this to work, the PostFlatAlt variable must be uncommented and set to a legal value (that's what turns on the feature in the first place!).