With refractors the autofocus routine works amazingly well – most of the time.
Here is a sample of the focus curve I get almost every time with my Stellarvue 102mm refractor:
This scope has a very predictable focus relationship with temperature, as illustrated by this linear regression plot of focus position vs temperature.
The resulting formula that yields the focus position is:
FocusPos = 17591 + 10.1 * F (this is an average of 3 separate nights of focus positions)
This yields a focus position that is usually + or - 10 units from the ideal value. Quite close to excellent focus since my step for the autofocus routine is 70 units. When I use the formula to set the initial focuser position when I start imaging, then run the autofocus routine, it usually is within 10 units of my calculated value.
However, the problem is that twice in the last 5 full nights of imaging with ver 18.104.22.168 at some point during the night the routine went haywire. Autofocus runs were done every hour.
Here is the http://adgsoftware.com/misc/sgfocus/ extract of the focus positions:
Temp Position HFR
47.3 18079 2.2
47.3 18081 2.05
45.5 18056 2.38
41.9 18019 2.11
39.2 17988 2.19
36.5 17983 2.37
34.7 17921 2.43
28.4 17119 1.82 ###
27.5 17884 2.52
Note that the next to last entry is badly out of whack. I set the focus routine to do its focus once per hour, so for the hour it was imaging at pos = 17119 all my images were badly out of focus.
What has caused this I am not sure of. I suspect it is probably a light cloud came over, or perhaps a brief spell of strong wind. Whatever caused it, my thought is that the autofocus routine ought to be able to cope with this and never produce this failure.
There are several ways the routine can avoid this problem:
- support a new feature that accepts the focus parameters for the focus formula as a function of temperature. One additional parameter the user should provide is a maximum focus position variance. If the focus position the routine comes up with differs from the projected value from the formula by more than the variance, the routine would throw its value away and calculate a new position as an offset from the prior position using the differential value.
Example from above: last good position was at 17921 for 34.7. Current temp is 28.4, so 17921+(28.4-34.7)10.1 = 17857.
Just using the formula directly gives 17591+(10.128.4) = 17878, an even better value in this case.
In fact, ideally the routine would compute its own linear regression for this evenings run and use it.
This approach has the additional advantage that when the focuser is intially connected SGP would immediately move the focuser to the posisiton given by the formula. My standard procedure now is to compute the formula value in a calculator, then manually move the focuser to that position, then run the initial focus run. This makes the initial focus run quicker because to already has the best possible starting focus position.
The simplest quick and dirty approach is to just support the maximum focus position variance parameter. The focus routine would compute its own temp offset if the user has not included one in the focus setup.
The third possibility would implement a suggestion I made several months ago to compute a quality factor for the run and the user would provide the minimum quality allowable, otherwise the focus result would be discarded. A simple quality factor would measure the least square fit of the data points on each side of the curve. I’m sure this would have prevented these failures for me, since that data points where it failed were very irregular.
I should add that for the past 5 or 6 full nights of imaging unattended with 22.214.171.124 it has otherwise run flawlessly without a single crash.
Great work Ken and Jared!!