Understanding Auto Focus
Description: Auto focus is highly useful for keeping you in focus through the night; however, auto focus can often be difficult to understand what's going on "under the covers". This should help to demystify those issues. The purpose of the Auto Focus implementation in Sequence Generator Pro is to maintain focus through an imaging session. It is not designed to handle large focus swings. Because of this you will need to start out fairly well focused before you begin an imaging run with Auto Focus enabled.
How Auto Focus Works
SGPro auto focus works off a notion of "whole image HFR". Under normal circumstances, this will allow you to focus where you are imaging and avoid a costly move to a bright star and then back to target. When auto focus is triggered, it will begin by moving the focuser "out" by ((data points * step size) / 2) steps. It will then begin taking AF frames, averaging HFR and then moving in by "step size" until the focus point is recognized. While "Data Points" is user defined it really only defines the number of steps used in the initial outward movement of the AF routine. SGPro is smart enough to recognize trends and automatically extend the number of points you need in order to find proper focus (when "smart focus" is not disabled).
In order to find the focus point SGPro will perform trend analysis (best fit lines) and use the intersection of those lines as the focus position. When SGPro receives data that cannot provide best fit lines, it will default to using the weighted average of the lowest 3 points (this will issue a warning if you are using the notification system).
Auto Focus Variables
Unfortunately, SGPro does not have a "one size fits all" approach to auto focus and some targets will need to be tuned a bit before they can be let loose. Fortunately, SGPro's AF routine only requires a few settings to get working properly. The values that define auto focus are seen above and defined here. The process by which one actually uses them to achieve focus is better described below.
So... How do you set it up for your rig?
Setup and tuning of Auto Focus should not take a long time and, fortunately, once you are able to capture a few key parameters, future adjustments can come quickly. The first time, you use auto focus, however, all these things may seem a bit overwhelming. This small guide should add some clarity to the process and get you going.
The general process for starting out requires the following:
- About 20 minutes
- A camera (CCD or DSLR)
- For users of filter wheels, ensure that your filter list is set.
- A motorized focuser and controller
- A Bahtinov mask (or other means of finding focus without relying on SGPro)
- A little patience
Once you are setup and have your scope point at a bunch of stars, you are ready to go:
- Go ahead and open the Auto Focus Settings Dialog now and you can set a few parameters...
- This tutorial does not focus on auto focus triggers. Definition and use of these triggers can be found here. For what you are doing, stay on the right side of the settings dialog.
- Set the auto focus exposure time. If you are not sure what to use, go ahead with eight seconds.
- If you use an OSC camera, just fill in the exposure length value right on this dialog.
- If you use a filter wheel, you must set the auto focus exposure time per-filter. Go ahead and click the "For Filters" button and make the exposure length entries for the filters you will focus with. For this tutorial, you should pick a luminance or clear filter (you will likely always focus with this filter anyhow).
- Set the binning to use for auto focus frames. Unless you have a specific reason not to, use 2x2 binning (DSLR users can set their auto focus binning levels in the DSLR's setting dialog).
- Set the "Auto Focus Data Points" field to represent the number of samples you want auto focus to take during the run. If you choose a value of 9, perfect focus would show a "V" curve with four point outside of focus and four points inside of focus. If you don't have a specific value in mind for your rig, choose nine points here.
- If you are using a filter wheel, go ahead and check the "Auto focus with filter" option and choose your luminance or clear filter.
- Go ahead and close the auto focus settings dialog for now by clicking "OK".
- If you are using a filter wheel, change filters to the filter you will use for focus (normally Luminance).
- Use SGPro's "Frame and Focus" module and a Bahtinov mask (or other) to achieve focus. Exacting focus is not critical here.
- Now, use SGPro's "Frame and Focus" module to "Take One" image at the same exposure length and binning as an auto focus frame (the settings you just used above).
- Click on the "star" icon to start an HFR calculation of your test image.
- You will probably see some stars with green circles around them when you click this button... if you don't, no need to panic... just needs a little adjustment.
- Using the "Focus" docking module, adjust the "Minimum Star Size" field. This number is representative of the minimum diameter required in order to qualify as a star. If it's too low, you might pick up non-star objects... to high, you will miss a lot of valuable star data and also start picking up large parts of nebulae as false stars. Adjusting this value will adjust the number of stars detected in real time. Keep in mind that this value is representative of the minimum diameter (in pixels) at 1x1 binning and will auto-adjust when you use a binning that is not 1x1. For example, if you set this value to 10 pixels and take your AF frames at 2x2 binning, your minimum star size is automatically adjusted to be 5 pixels. Adjust this value as low as you can without reducing the minimum diameter to less than 2 pixels after binning division occurs. For instance, if you set this value to 2 pixels, the 2x2 value will be 1 pixel and will just be auto adjusted to back up to 2 pixels to avoid inclusion of noise and hot pixels. If lots of diameters look good, go head and choose a "Minimum star size" (diameter) of six pixels.
- Using the "Image Statistics" module, note your test frame's current "Half Flux Radius" value. Jot this down.
- Using the focus module, note the focuser's current absolute position.
- Using the "Frame and Focus" module, click on "Start" to begin capturing frames using the same auto focus setting you used for "Take One". The "star icon" should still be active and you should continue to see stars circled in green.
- While this is happening (looping frames are captured) begin to move your focuser outward until the HFR reading is ~3-5x greater than your "at-focus" HFR that you noted earlier.
- Subtract the "in-focus" focuser position from the new (current) focuser position. Multiply this number by 2, divide it by the number of "Auto Focus Data Points" minus 1 and you now have a good "Step Size".
- Open the auto focus settings dialog and enter this value into the "Step Size" field.
- That's it! Let's kick the tires. Using the "Focus" module, go ahead and click the "Run" button. You should see a "V" and a focus point chosen that is very close to both the HFR and focuser position you noted above.
- Don't forget to save your hard work to both the sequence you are working on and to an equipment profile for later use... the idea is that you only need to perform this once per equipment profile.