Unusual Focusing Behavior - Help Request (with data)

I ran a series of autofocus events last night in a first attempt to generate data to analyze in SGP Autofocus Log Viewer, with the intention of characterizing my filter focus positions in SGP to try and reduce lost time during imaging sessions.

Since this was really just a test (I will devote a full night to this on a bright moon night), I focused on flipping back and forth between Lum and Red. The results appear to be almost a random distribution, which is very strange (the results from the actual imaging earlier in the evening, all narrowband, are linear as expected).

I was wondering if the collective braintrust on this site had encountered this problem/had any thoughts on what might be causing this behavior?


You don’t say which version of SGP you were using at the time of these AF runs but I suggest you repeat the exercise using:

a) latest SGP v4 beta release
b) setting Auto Focus Metric to ‘HFD - ASTAP’ on the Auto Focus Options screen
c) setting a high quality level for recording a successful AF run i.e. using the parameter ‘quadratic_fit_min_quality=0.98’

A while back I was trying to do the same exercise (calculating filter off-sets) and experienced similar results to yourself.

I believe SGP v4’s ASTAP HFD star detection is more sensitive and accurate than SGP v3’s HFR method, leading to better quality star measurements at the extremities of the AF curve and thus to a better quality AF curve fit and determination of the best focus point.

Setting the quality measurement to a high value should then eliminate any remaining AF runs of dubious quality.

I think when reviewing your results it also helps if you:

a) have an know how much your focuser moves in microns per AF step
b) what the CFZ is for your scope

: You should then be able to form an idea of how tightly your AF results bunch to the centre region of your CFZ. Realistially SGP is unlikely to calculate exactly the same AF position for several AF runs even if these are made in a very short space of time but they should be very close.

I should point out that a downside to this approach currently is that as far as I know, the SGP AF Log Viewer has not yet been updated to recognise SGP V4 HFD results, so you will need to either record the AF results as you go or manually work through the log file to find them.

Hope this helps

Thanks much! Do you use ASATAP HFD as your autofocus setting for imaging as well? Its a moonlite, with .2667 microns per step. On an FSQ106, so CFZ is 62 microns (so +/- 116 steps, roughly, unless you use the New CFZ calc), which is why the over a 1000 step range on my focus results at a given temperature was disturbing me.

Hi, I spent quite some time investigating the ASTAP option, see this thread:

: and think it is a significant improvement. Sadly recent weather has prevented me doing further measurements in ‘bulk’.

I am tempting fate here but I would be disappointed if with HFD you do not consistently get very closely grouped AF results with dispersion well within your CFZ range for a given temperature point


Thanks! I will post the results once I get a chance to try.

Can I ask where one goes about setting this parameter? - Apologies found it. Is there an easy list of all the custom variables in SGP?

The only other one I have seen mentioned is this one:


A request for help from the braintrust on these forums:

I had clear skies last night and tried out the ASTAP HFD routine for autofocus, with min quality set to 96%. I use a Tak FSQ106 on a 10Micron mount, with an SBIG 16803, with 9micron pixels and 3.5" sampling. The night started out well with autofocus working perfectly. But at around 11pm at night, autofocus appears to have failed, with focus run after focus run hitting 94%/95% but rarely 96%. This was true across a range of filters. Sometimes, even when it hit 96%, it appears to have reported as a failure and restarted the focus process (see, for eg. the log excerpt below). Often, the curve would show 98% through 8 points, and then drop below 96% on the last point.

The skies appeared clear, and the few images that were taken show no signs at all of clouds.

Any ideas as to what might be going on here? I haven’t had this problem before, when using HFR (might be unrelated, but is the only thing I changed). Do the step size settings need to change when using ASTAP-HFD? Is there some other setting I might need to adjust?

Link to full log:

01/12/21 03:50:23.209][DEBUG][Camera Thread][SQ;AF;] Auto focus HFD calculated at: 5.36 with 217 stars
[01/12/21 03:50:23.213][INFO][Camera Thread][SQ;AF;] Incremental Fit Result (9): quality=96%; a=0.559543021081803; b=-20.7445317759284; c=194.294176443565;
[01/12/21 03:50:23.220][DEBUG][Camera Thread][SQ;AF;] Emit AFPack screenshot: Points: 9; Final: False
[01/12/21 03:50:23.220][INFO][Camera Thread][SQ;AF;] Detected focus getting worse! Shifting auto focus range
[01/12/21 03:50:23.272][DEBUG][Main Thread][SQ;AF;] Adding sequence level notification: Cannot find focus point, assuming focus is outward, adjusting smart focus range…
[01/12/21 03:50:23.297][DEBUG][Camera Thread][SQ;AF;] Sending Notification: Warning - Cannot find focus point, assuming focus is outward, adjusting smart focus range…
[01/12/21 03:50:23.297][DEBUG][Camera Thread][SQ;AF;] Handling monitoring event (Email 1, Warning): (Pleiades-Rosette-Focus Runs) Cannot find focus point, assuming focus is outward, adjusting smart focus range…
[01/12/21 03:50:25.263][DEBUG][Main Thread][SQ;AF;] Adding sequence level notification: Focus cannot be determined. Moving to start position of 18702 to reattempt. Fit Quality 96%
[01/12/21 03:50:25.285][DEBUG][Camera Thread][SQ;AF;] Sending Notification: Warning - Focus cannot be determined. Moving to start position of 18702 to reattempt. Fit Quality 96%


I have had a look at your log file using SGP Log Viewer provided courtesy of @bscholl and available here:

And incidentally @mikaelA has just recently uploaded a new version of AFLogViewer.

To me SGPLogViewer is complementary to SGP AF Log Viewer as it shows the whole history of an AF run rather than just the successful set of data points but on the other hand does not give the Temp Comp and filter offset details.

Anyway here is a view of all the AF runs in your logfile, It looks complicated but I believe the reason you are just falling short of your preset quality point is that in all the AF curves the initial data point at the RHS shows signs that your backlash compensation is not high enough to fully eliminate this characteristic of your focuser. Increase compensation by a generous amount and I am pretty sure you will hit the required quality level.

Assuming that increased backlash fixes most of your AF run problems, I suggest the next thing to address would be to find the reason why some of your AF runs have very extended data points on the RHS, The parabolic curve fit apparently does not score a good quality mark if the AF curve is not reasonably symmetrical. The AF routine addresses this by adjusting the start point but if you have correct filter offset entered I think this issue can also be largely eliminated.

Best of luck in the quest for perfect AF runs