Description:  Auto focus is an excellent step towards automated imaging.  If setup correctly you can complete an entire imaging run with little to no interaction with your equipment once the "Run Sequence" button is clicked.  Auto focus assumes that you're already well focused with a Bahtinov Mask or some other focusing aide.  The intent of auto focus is not to take you from completely out of focus to in focus, but to keep you in focus throughout the entire night.  For more information on how auto focus works and how to best tune your setup to get the most out of auto focus please see Understanding Auto Focus.


Auto focus can be invoked by using the Focus Control Panel or the Focus Module:


Above: Focus Control Panel


Above: Focus Control Module


Setup


The majority of the auto focus options can be found in the Profile Manager under the Focus Tab, these options are also available at a sequence level in the Control Panel.  The illustrations below are from the Control Panel.  Clicking the "Set" button next to the "Use auto focus" option will bring up the Focus Options Window. 


The text below will describe what each fields represents, but will probably not leave you with a great feeling in terms of how to tune these setting for you rig.  For that we have devised this section which, we hope, will help get you up and running with AF pretty quickly.


To use Auto Focus you will need to have a camera and a focuser which can return its absolute position.


image


Options:

  • Auto Focus Metric: Specifies the provider of the focus metric.  
    • Half Flux Radius (recommended):  Uses the Sequence Generator Pro "whole image" HFR (Half Flux Radius) metric for auto focus.  Generally HFR is considered to be a more robust metric than FWHM.
    • HFD - ASTAP:  Uses the Half Flux Diameter metric provided by ASTAP (use this provider if HFR seem inconsistent for your rig or target.
    • Full Width Half Max: Uses the "whole image" FWHM (Full Width Half Maximum) focus metric.  This metric requires that Pinpoint is installed!
  • Auto Focus Frequency: Specifies when Sequence Generator Pro should trigger an auto focus run
    • Auto focus every X frames: This will trigger auto focus after every X frames.  
    • Auto focus every X degree change: This will trigger auto focus after every X change in degrees Celsius.  This is probably one of the better methods to use as it best reflects why focus needs to happen (other than filter changes).
    • Auto focus every X minutes:  This will trigger auto focus every X minutes during a sequence.  It will not interrupt frames, but rather will wait until the current frame completes to run the auto focus routine.
    • Force auto focus on filter change: When checked, auto focus will run when the filter is changed even if the criterion for the selected trigger has not been met.
    • Auto focus before first frame: When checked this will auto focus before the sequence starts (not applicable to "resuming a sequence").  The idea is that resuming a sequence will still depend on factors set previous to the pause and resume interval (like time or temperature). 
    • Auto focus on resume: will initiate Auto Focus if the sequence is paused and then resumed.  
    • Auto focus after automatic centering action: Will initiate Auto Focus after performing an automatic meridian flip or an automatic centering. This is useful if you are imaging with a mirror and the centering action causes an undesirable shift in the mirror due to gravity.
    • Auto focus as Image History degrades (as the focus quality of Light images degrades). SGPro can optionally track the focus quality of your images during a session. If you use this option, you can also opt to use it as a focus trigger. As focus degrades by a user-defined percentage value, focus will trigger. This option seems ideal at face value, but user-beware. Please see the explainer for the History Degradation trigger here.
  • Star Detection
    • Minimum Pixel Size (at 1x1 binning):  This is used to remove false stars from the HFR measurement.  You can tell if you need to adjust this by visually inspecting the "AF boxes" overlay (tip:  it is easier to adjust this from the focus floating module... adjusting it changes star detection in real time so you can quickly see how your results are affected).  It is important to note that this setting is adjustable "per-target" and self-adjusts for binning.  This means that id your 1x1 minimum diameter is 8 pixels, then 2x2 binning will have a minimum diameter of 4 pixels.  This will prevent you from needing to adjust this if you change your auto focus binning mode.
    • Important note for this field with respect to targets and equipment profiles!  This field is unique in that it is the only one in auto focus that can vary by target.  In its current form it is not super-intuitive, so we will do our best to explain it here:
      • The value that shows up in this field when you open the auto focus setting dialog will be based on which target you have selected in the sequencing window.  
      • For equipment profiles, the value saved in the profile will be used for the creation of any new target.  If you change that value (in the sequence file) for a target, it will have no effect on other targets in the sequence.
  • Other options: These generally deal with the auto focus sampling (parameters used to complete an auto focus run).  A more thorough explanation of these specific options can be found in Understanding Auto Focus
    • Exposure times:  
      • For FIlters:  This button will take you to your filter setup (Filter Setup Dialog).  From this dialog you can define the auto focus exposure time per filter.
      • OSC:  This exposure time is meant to be used when you are using a Once Shot Color camera and have no filters (of course, it would be used for monochrome cameras with no filter as well, but this is a less common setup).
    • Bin: Specifies the binning at which auto focus should run.  
    • Auto Focus Data Points: Specifies how many data points are used for auto focus.  The minimum is 3, the recommended value is 9.  A "data point" is used in conjunction with step size.  For instance, if you set 7 data points with a step size of 10, auto focus will begin by moving the focuser out 30 steps, take a single exposure, calculate its focus metric, and then repeat this 6 more times, moving in by 10 steps each time.
    • Step Size: specifies the number of focus steps between the data points above.  For example if you specify 3 data points, a step size of 10 and your current focuser position is at 1000 then the auto focus routine will take an exposure and calculate the focus metric at 990, 1000, and 1010 steps.
    • Auto Focus dialog auto-close delay: When auto focus is running the Auto Focus Dialog will appear.  If auto focus is called during a sequence then this value specifies how long after auto focus completes that this dialog should be shown (prior to closing and continuing the sequence).  It's important to note that while this dialog is on the screen that your sequence will not run.  Set this to a non-zero value to leave the auto focus dialog up for a specified amount of time.  If you're not interested in looking over the auto focus run then leave this value at 0.
    • Disable smart focus: Check this if you want to disable smart focus behavior (automatic continuation and expansion of the focus range in order to try and get adequate data).  If your scope has a central obstruction you should most likely disable smart focus.  If at all possible you should avoid using this option by using the tuning method found here.
    • Auto focus with filter: Allows you to specify a filter to use for auto focus.  This is generally not the best way to use auto focus as you will get better results performing auto focus on the filter that you intend to image with.  However if you do decide to use this option it is highly recommended to use the "Auto adjust focus per filter" option as well as setting up your filter positions.
    • Auto Focus Crop:  This is designed to help those who image with severe field curvature at the edges of the image and will prevent the auto focus algorithm from using "bad" edge stars to determine focus.  This feature is specified as a percentage of the CCD's dimensions.  For instance, if you specify a crop value of 5% and your CCD dimensions are 800x600, auto focus frames will not consider any stars within 20 pixels of the left and right edges (40 pixels total) and within 15 pixels of the top and bottom edges (30 total pixels).
    • Apply dark subtraction:  Check this option to perform dark subtraction on your auto focus frames prior to analysis.  This can be useful if your auto focus frames are noisy enough to produce false positives during star matching.  The chosen directory must have dark frame in it for every variant of exposure (+/- 2 seconds). For instance, if you are taking 15s frames for one filter and 18s frames for another, you must have 15s (+/- 2s) and 18s (+/- 2s) dark frames in this directory.  The naming convention for darks is as follows: <NNN>_<name>.fit where NNN is the exposure length in sec (i.e. 15_mydark.fit or 15_mydark.cr2).  If multiple images in your darks directory meet this criteria, the image closest to your exposure will be chosen.
    • Save Auto Focus packages to:  Checking this option and setting the path will allow you to save your auto focus runs for further evaluation.  In general this should not be needed unless you find issues when running auto focus and need to submit an issue or ask for assistance on the Yahoo! Group.


Note:  While not on this dialog, the auto focus routine can run using fast download speeds (assuming your camera supports it).  This option can be found on the Camera tab of the control panel.  There is no harm in trying it... just a word of caution, that for some cameras, this might introduce enough noise or other unfortunate artifacts that the AF metrics are less than optimal.


Manually Running:


You can manually invoke the Auto Focus routine either through the Focus Module or from the Focus Control Panel by clicking the "Run" button.  This will bring up a window that resembles the window below:



  • Red Xs indicate points not used to compute focus
  • Green lines indicate best fit for each side of the V (focus is the intersection of these lines)
    • Red lines indicate that a best fit was NOT found and focus will be computed by finding the lowest local average (this is the pre 2.3 method)


If you are unhappy with the auto focus results (ie you don't get a good V curve or the V seems shifted dramatically to one side) you can invoke Auto Focus again by clicking "Run Again".  This will center the Auto Focus run around the point that was last determined to have the best focus.


The Validation Frame


After auto focus is complete and SGPro has determined the new focus position, it will move the focuser here and take a validation frame.  Because of the way in which SGPro achieves auto focus, it has a pretty good idea what your ending HFR should be if you truly arrived the focus position.  If the validation frame's HFR is not within 10% of the expected HFR, a temporary warning dialog will appear and let you know (if you purchased the notification add-on, a notification will also be sent).  If this happens often, it might be due to backlash issues in the focus motor, underpowered focuser motor (heavy imaging chain fighting gravity near meridian) or some sort of binding.


If you cancel the auto focus run after it has completed the focuser will be returned to the last focus position.  For example:

  • Auto focus starts and the focuser is at 2000
  • Auto focus determines the focus position to be 1900
  • Cancel is pressed
  • Focuser is returned to 2000


However if "Run Again" has been used this will reset the start position.  For example:

  • Auto focus starts and the focuser is at 2000
  • Auto focus determines the focus position to be 1900
  • Run Again is pressed (1900 is now stored as the last focus position)
  • Focus is determined to be at 1890
  • Cancel is pressed
  • The focuser is returned to 1900, not 2000.