{extra_toc}
Theory Of Operation
In order to focus an image, Ekos needs to establish a numerical method for gauging how good your focus is. It's easy when you look at an image and can see it as unfocused, as the human is very good at detecting that, but how can Ekos possibly know that?
There are multiple methods. One is to calculate the Full Width at Half Maximum (FHWM) of a star profile within an image, and then adjust the focus until an optimal (narrower) FWHM is reached. The problem with FWHM is that it assumes the initial focus position to be close to the critical focus. Additionally, FWHM does not perform very well under low intensity fluxes. An Alternative method is Half-Flux-Radius (HFR), which is a measure of the width in pixels counting from the center of the stars until the accumulated intensity is half of the total flux of the star. HFR proved to be much more stable in conditions where you might have unfavorable sky conditions, when the brightness profile of the stars is low, and when the starting position of the focus is far from the optimal focus.
After Ekos processes an image, it selects either a single star and starts measuring its HFR, or it selects a set of stars matching the criteria that have been set and calculates an average HFR. It can automatically select stars, or you can select a single star manually. It is recommended to allow Ekos to select a set of stars.
Ekos supports 4 different focus algorithms: Iterative, Polynominal, Linear and Linear 1 Pass.
- Linear: In the Linear algorithm, Ekos steps outward from its starting point then moves inward taking regular datapoints through the point of optimum focus and then further inward, to draw a V-Curve. It then fits a quadratic curve to the datapoints and calculates the point of optimum focus. It then moves out again past the point of optimum focus, halves the stepsize and moves in again for a second pass. It looks to follow the curve from the first pass and find the minimum HFR. Due to randomness in the HFR measurements it uses the % tolerance to help decide when it has found a solution. Key features include:
-
- The algorithm compensates for focuser backlash and can deal with both consistent and inconsistent backlash.
- The algorithm is slow, taking 2 passes to identify optimum focus.
- The algorithm uses curve fitting to pinpoint the optimum focus position in pass 1, but then uses % Tolerance to try to stop as close as possible to this HFR on pass 2.
- The algorithm is highly configurable with user control over many parameters like step size and number of steps.
-
- Polynomial: In the Polynomial algorithm, the process starts off in Iterative mode, but once we cross to the other side of the V-Curve (once HFR values start increasing again after decreasing for a while), then Ekos performs quadratic curve fitting to find a solution that predicts the minimum possible HFR position. Key features include:
-
- The algorithm relies on the focuser having well controlled backlash.
- The algorithm can be fast using a minimum number of steps.
- The algorithm uses curve fitting to pinpoint the optimum focus position.
-
- Iterative: In the Iterative algorithm, Ekos operates iteratively by moving in discrete steps, decided initially by the user-configurable step size and later by the slope of the V-Curve, to get closer to the optimal focus position where it then changes gears and performs smaller, finer moves to reach the optimal focus. The focus process stops when the measured HFR is within the configurable tolerance of the minimum recorded HFR in the process. In other words, whenever the process starts searching for a solution within a narrowly limited range, it checks if the current HFR is within % difference compared to the minimum HFR recorded, and if this condition is met then the Autofocus process is considered successful. The default value is set to 1% and is sufficient for most situations. The Step options specify the number of initial ticks the focuser has to move. If the image is severely out of focus, we set the step size high (i.e. greater than 250). On the other hand, if the focus is close to optimal focus, we set the step size to a more reasonable range (less than 50). It takes trial and error to find the best starting tick, but Ekos only uses that for the first focus motion, as all subsequent motions depend on the V-Curve slope calculations. Key features include:
-
- The algorithm relies on the focuser having well controlled backlash.
- The algorithm can be fast using a minimum number of steps.
- The algorithm works on a "good enough" paradigm whereby it stops when the HFR is within % Tolerance of the perceived minimum,
-
-
Linear 1 Pass: In the Linear 1 Pass algorithm, Ekos initially performs like the Linear algorithm in establishing the first pass V-Curve and fitting a curve to it to find the solution. Then, however, it moves directly to the calculated minimum. Key features include:
-
- The algorithm compensates for focuser backlash, providing that backlash is consistent.
- The algorithm is fast, taking 1 pass to identify optimum focus.
- The algorithm uses more sophisticated curve fitting to pinpoint the optimum focus position.
- The algorithm is highly configurable with user control over many parameters like step size and number of steps.
-
Train
Each module has it's own train. You can use a specific train for Focus module. Click here to know more about Optical trains.
Focuser Group
Any INDI-compatible focuser is supported. It is recommended to use absolute focusers since their absolute position is known on power up. In INDI, the focuser zero position is when the drawtube is fully retracted. When focusing outwards, the focuser position increases, while it decreases when focusing inwards. The following focuser types are supported:
- Absolute: Absolute Position Focusers such as RoboFocus, MoonLite..etc
- Relative: Relative Position Focusers.
- Simple Focusers: DC/PWM focusers with no position feedback.
For absolute focusers, you can set the ticks count. To view a continuous feed of the camera, click the Framing button. An image shall be captured repeatedly according to the CCD settings in the CCD and Filter Wheel group. You can focus in and out by pressing the respective buttons, and each shall move by the step size indicated in the focus settings. For absolute and relative focusers, the step size is in units of ticks and for simple DC focusers, the step size is in milliseconds. The step size can be changed by specifying its value in the 2nd Steps field. To set an initial focus position or go to a focus position, click on the Go to absolute focus position button. To stop the focus motion, click on the Stop focuser motion button.
To begin the autofocus process, simply click the Auto Focus button. To stop the Auto Focus process, click on the Stop button.
CCD & Filter Wheel Group
For DSLRs cameras, you can change the ISO settings. You may reset the focusing subframe to full frame capture if you click the Reset button.
- Live Video : If your camera supports live video feed, then you can click the Live Video button to start streaming. The video stream window enables recording and subframing of the video stream
- Exp: Specify exposure duration in seconds.
- Toggle Fullscreen : Shows the focus frame in fullscreen, clicking on the button again will place the focus frame back into the docked position.
- Show in FITS Viewer : Shows the focus frame image in FITS Viewer.
- Bin: Specify horizontal (X) and vertical (Y) binning.
- Gain: Specify the value of gain between 0% to 100%. This will increase the signal to noise level of your image.
- ISO: For DSLR cameras, specify the ISO value.
- Filter: Specify desired filter.
- Filter Settings: Use the Filter Manager to specify various settings for each filter including exposure, offset, autofocus, and locking policy.
Settings
You may need to adjust focus settings to achieve a successful and reliable autofocus process. The settings are retained between sessions.
- Auto Select Star: Automatically detect and select best star for guiding in the image.
- Subframe: Subframe around the focus star during the autofocus procedure. Enabling subframing can significantly speed up the focus process.
- Full field: Measure average HFR from all stars combined in a full frame. This method defaults to the Centroid detection, but can use SEP detection too. Its performance decreases as the number of stars increases.
- Suspend Guiding: Suspend Guiding while autofocus in progress. If the focus process can disrupt the guide star (e.g. when using Integrated Guide Port IGP whereas the guider is physically attached to the primary CCD), then it is recommended to enable this option. When using Off-Axis guider, then this option is not necessary.
- Dark Frame: Check this option to capture a dark frame if necessary and perform dark-frame subtraction. This option can be useful in noisy images.
- Box: Sets the box size used to enclose the focus star. Increase if you have very large stars.
- Annulus: During full field focusing, stars which are inside this percentage of the frame are filtered out of HFR calculation (default 0%). Detection algorithms may also have an inherent filter.
- Settle: Sets the amount of seconds to wait before resuming guiding.
Process
- Detection: Select star detection algorithm. Each algorithm have its strengths and weaknesses. It is recommended to keep the default value unless it fails to properly detect stars.
- SEP: Source Extractor and Photometry, an efficient source detection method based on Source Extractor (Bertin and Arnouts 1996; Bertin 2016). See SEP: Source Extractor as a library in the Journal of Open Source Software.
- Centroid: a source detection based on estimating star mass around signal peaks.
- Gradient: a single source detection based on the Sobel filter. Initial or full-field analysis will use SEP instead of this method.
- Threshold: a single source detection based on pixel values. Initial or full-field analysis will use SEP instead of this method.
- Bahtinov: This is useful for users who do not have a motorized focuser and prefer to focus manually with the aid of a Bahtinov Mask. After capturing an image in the focus module with the Bahtinov mask algorithm selected, Ekos would analyze the images and stars within it. If Ekos recognizes the Bahtinov star pattern, it will draw lines over the star pattern in circles on the center and on an offset to indicate the focus.
- Algorithm: Select the auto focus process algorithm:
- Iterative: Moves focuser by discreet steps initially decided by the step size. Once a curve slope is calculated, further step sizes are calculated to reach optimal solution. The algorithm stops when the measured HFR is within percentage tolerance of the minimum HFR recorded in the procedure.
- Polynomial: Starts with iterative method. Upon crossing to the other side of the V-Curve, polynomial fitting coefficients along with possible minimum solution are calculated. This algorithm can be faster than purely iterative approach given a good data set.
- Linear: Samples focus inward in a regular fashion, using 2 passes. The algorithm can be slow, but it is more resilient to backlash. Start with the focuser positioned near good focus. Set Initial Step Size and Max Travel for the desired sampling interval and range around start focus position. Tolerance should be around 5%.
- Curve fit: Select the type of curve to fit to the data:
- Quadratic: Uses a polynomial fit of degree 2. This is currently the default option and currently the only option for all Algorithms except Linear 1 Pass.
- Hyperbola: Fits a hyperbola to the data points. This is currently only available for the Linear 1 Pass Algorithm.
- Parabola: Fits a parabola to the data points. This is currently only available for the Linear 1 Pass Algorithm.
- Use weights: Check to use the standard deviation of the star HFR or FWHM as a weighting to the curve fitting algorithm. If unchecked, all data points are given equal weighting. Currently only available when using Full Field (multiple stars) and a Curve Fit of Hyperbola or Parabola under the Linear 1 Pass algorithm.
- R2 Limit: Set a minimum for the acceptable R2 when performing an Autofocus run. The value is between 0 (no fit) and 1 (perfect fit). 0.8 is a good start. If the minimum is not met, Autofocus will rerun once to try to improve the R2. Currently only available for the Linear 1 Pass algorithm when using a Curve Fit of Hyperbola or Parabola.
- Refine Curve Fit: Set a minimum for the acceptable R2 when performing an Autofocus run. The value is between 0 (no fit) and 1 (perfect fit). 0.8 is a good start. If the minimum is not met, Autofocus will rerun once to try to improve the R2. Currently only available for the Linear 1 Pass algorithm when using a Curve Fit of Hyperbola or Parabola.
- Average over: Sets the number of frames to capture in order to average the HFR value at the current focuser position.
- Average HFR Check: No. of frames to capture when running in-sequence HFR-check. If using linear 1 pass, the point of optimum focus will also capture this number of frames.
- Time dilation X: The furthest datapoints have their exposure times increased by this factor. The in focus datapoint exposure is not increased. Intermediate points have their exposures scaled appropriately.
- Set to 1 to disable this option.
- Outlier Rejection: Aberration inspector-style mask with a 3x3 mosaic formed with tiles from the center, the corners and the edges.
Mechanics
- Walk: Select the type for the focuser to take when using Linear 1 Pass. For Linear only Classic is available.
- Settle: Settle time (in seconds) after moving the focuser before capturing the next image during Auto Focus and after an Adaptive focus movement.
- Initial Step size: Initial step size in ticks to cause a noticeable change in HFR value. For timer based focuser, it is the initial time in milliseconds to move the focuser inward or outward.
- Number steps: This number is multiplied by initial step size is a number of outward steps the Linear Focus algorithm moves away from the initial position at the start of focusing.
- Max Travel: Maximum travel in ticks before the auto-focus process aborts.
- Max Step size: The algorithm is allowed to command the maximum single step size as it searches for the critical focus zone. The calculated step size would be limited to this maximum value.
- Backlash: Number of average frames to capture. During each capture, an HFR is recorded. If the instantaneous HFR value is unreliable, you can average several frames to increase the signal-to-noise ratio.
- AF Overscan: Provides backlash overscan in ticks for outward focuser movements during an Autofocus run. This is in addition to any Driver Backlash provided by the device driver and set in the Driver Backlash field. Set to 0 to disable. If set, AF Overscan is applied to all focuser movements initiated by the Focus module. Typically either Focuser Backlash or AF Overscan is set.
- Capture timeout: Maximum time in seconds to wait for a captured image to be received before declaring a timeout.
- Overscan Delay: Delay between completing the outward motion of an Overscan and starting the inward motion. For most focusers 0s is fine.
- Motion timeout: Maximum time in seconds to wait for the focuser to move to the desired position before declaring a timeout.
V-Curve
The V-shaped curve displays absolute position versus Half-Flux-Radius (HFR) values. The center of the V-curve is the optimal focus position. Once Ekos crosses from one side of the V-curve to the other, it backtracks and tries to find the optimal focus position. The final focus position is decided by which algorithm is selected.
When framing, the horizontal axis denotes the frame number. This is to aid you in the framing process as you can see how HFR changes between frames.
Relative Profile
The relative profile is a graph that displays the relative HFR values plotted against each other. Lower HFR values correspond to narrower shapes and vice-versa. The solid red curves is the profile of the current HFR value, while the dotted green curve is for the previous HFR value. Finally, the magenta curve denotes the first measured HFR and is displayed when the autofocus process concludes. This enables you to judge how well the autofocus process improved the relative focus quality.