Old and New Auto Focus Method


#1

Using the Auto Focus module of SGP (v 2.6.0.24) I made some observations that need an explaination.

My scope is a Tak FSQ 106N with Robofocus motor and Seletek Armadillo2 Controller. The temperature is measured at the sope, protected against wind.

When I had a look at the logfiles I realized that SGP calculates the AF Focus Position according to 2 methods, which are called “New AF method” and “Old AF method”. SGP always uses the value calculated with the “Old AF method”. Conspiciously, the values obtained with the old method are in coarser steps than the values of the new method: my observation is, that small temperature changes often produce identical AF Focus Positions with the old method. The values of the new method are in finer steps and the change in Focus position is in the expected direction.

When plotting the AF Focus Position (as y) against temperature (as x) separately for the old and new method this is clearly visible. Doing a linear regession results in a significantly higher coefficient of determination for the new method.

So the new method affords more reliable results with my equipment, and I would like to apply these values instead of the ones of the old method. However, there is no mention of the 2 AF methods in the manual and there seems to be no setup in SGP, which method to apply.

Is this still in an experimental stage? How can we use the results of the new method? I can only imagine to manually set the focuser position to the value obtained by the new method, but that’s no practical way for me because I would have to search in the logfile every time an AF run is executed.

Bernd


[Smart] Auto focus help
#2

Is this in v2.6.0.23 too?

I also found out that often time auto focus result is not consistent, one or two outlier of V curve could skew the result ~10 step or so, which seems ok for my slow scope, but I think the inaccuracy will have much larger impact on faster scope.


#3

Auto focus works fine for perfect V curve, but many times the curve is not perfect.


#4

Meanwhile I came across a different post referring to the AF methods (since it was not where it belongs, in the “Autofocus” category, I did not find it immediately):

However, in this thread everyone seems to assume that the new (best fit) method is applied, which is not the case: the old (weighted average) method is applied according to the logfiles (my version: v2.6.0.24). The plots in the original above post also show that (discrepancy between the intersection of the straights and the numerical value in the plots).

I guess only the developers are able to answer my questions? Please.

Bernd


#5

I upgrade to v2.6.0.25 and AF focus works on and off. When it is off, it is way off so I need trash all the frames. From log, SGPro calculates focus based on both “new” and “old” method, and it chooses one (based on certain condition) as final focus. “new” result is more consistent with V curve, but “old” one sometime is and sometime is not, the error of “old” sometimes is 30-40 steps. I dont know why “old” is so much off for a perfect V curve.

It is disappointed to see one of the fundamental functions is broken in latest release. I have to switch back to 23 to be able to use it.


#6

Not sure if this has any bearing on what’s happening with everyone’s AF but there is a bug in the AF, (see this link AutoFocus Update Feature Request). Ken fixed and put out a link to v3.0.0.4 that you can access via the above post. Basically the AF is not waiting for the focuser ASCOM driver to report IsMoving is done and the AF could kick off the request for the next image before everything comes to a stop. I think it depends on your setup, (Type of Camera, Scope). I think folks with shutter-less cameras and focusing with the primary mirror is the most prone in that the it is very difficult to get any type of a V-curve. Since I’ve been using this new v3.0.0.4 beta, the AF has been much much better and more consistent.

Again, not sure if this has any bearing of what folks are seeing but the fix has absolutely help the AF with my setup.

Regards,
Mark


#7

The topic of my original post was quite different and it doesn’t bother me that you went off on a tangest. But my question has never been answered.

In the logfile there are passages like the following, at the end of each auto focus run, directly before the validation frame is taken:

[12.08.17 21:40:06.409][DEBUG] [Camera Thread] New auto focus method calculated focus at: 24863
[12.08.17 21:40:06.409][DEBUG] [Camera Thread] Old auto focus method calculated focus at: 24861
[12.08.17 21:40:06.409][DEBUG] [Camera Thread] Using old auto focus method for focuser position
[12.08.17 21:40:06.409][DEBUG] [Camera Thread] New focus position is at 24861 (@10,50C). Moving focuser…

[12.08.17 21:40:27.682][DEBUG] [Camera Thread] Auto focus is complete (weighted avg method: 24861; HFR 1,39)…

So the new focus position is evaluated according to two different methods:

  • Old auto focus method = weighted average,
  • New auto focus method = best fit
    In my logfiles, the “old method” (weighted average method) is applied always. There is no case when the new method (best fit) was applied.

In the cited thread 'Old' issue with the 'new' AF routine everybody seems to assume that the new method (best fit method) is applied, but this is not the case.

I would like to know from the developers:

  • Is the new auto focus method is still in an experimental stage?
  • Why is the new auto focus method never applied?
  • Can we take influence which auto focus method to apply?

Bernd


#8

The only thing that can be changed I believe is the ‘metric’.

Either HFR or FWHM.

For FHWM you have to have pinpoint installed.


#9

Hi Bernd,
if it’s any comfort I’m seeing the same thing. SGP always uses the OLD method for the focus point (at least on my most recent session).
A couple of points:

  1. The different between OLD and NEW values are but a small percentage of an individual filter step.
  2. I give all the AF Packs an eyeball using Pixinsight’s Blink. I find that the final focus point is most always equal to the best focus through the steps. Sometimes better, hardly ever worse.
    True for my equipment, YMMV.
    Mark

#10

Here is some log I was talking about.

Here is the log when old method is chosen, and it is way off. V curve looks perfect.

[12/05/17 20:24:46.829][DEBUG] [Camera Thread] New auto focus method calculated focus at: 14930
[12/05/17 20:24:46.829][DEBUG] [Camera Thread] Old auto focus method calculated focus at: 14960
[12/05/17 20:24:46.829][DEBUG] [Camera Thread] Adding sequence level notification: Best fit method found value, but it was out of tolerance with respect to weighted avg of lowest 3 HFRs (new: 14930 old: 14960)…
[12/05/17 20:24:46.830][DEBUG] [Camera Thread] Best fit method found value, but it was out of tolerance with respect to weighted avg of lowest 3 HFRs (new: 14930 old: 14960)…
[12/05/17 20:24:46.830][DEBUG] [Camera Thread] Using old auto focus method for focuser position

Here is when new method is chosen.
[12/05/17 20:32:00.128][DEBUG] [Camera Thread] New auto focus method calculated focus at: 14901
[12/05/17 20:32:00.128][DEBUG] [Camera Thread] Old auto focus method calculated focus at: 14908
[12/05/17 20:32:00.129][DEBUG] [Camera Thread] Using new auto focus method for focuser position


#11

And I would really like to know when there is any under hood changes like this in release log. It took me a few nights to figure out the issue and had to revert the old working revirsion.


#12

blackdragon72,

thank you very much for your response. This is the first answer that helped me a bit, because you state that with your setup the ‘best fit’ (new) method is used at times.

If I understand correctly, you are observing that Auto focus often applies ‘best fit’ (new) method and sometimes ‘weighted average’ (old) method. Meanwhile I am using the current version of SGP, v2.6.0.25 - but I did not notice any change in this respect compared to v2.6.0.24. Please indicate: which version of SGP are you using?

After carefully re-reading the AutoFocus section of the manual, I found a hint under the headline “Manually Running” on p. 123, below the V-curve plot:

"- Green lines indicate best fit for each side of the V (focus is the intersection of theses 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)"

However, in my case, SGP does not behave this way: I see many completed V-curves with green lines (which means that the focus position was successfully evaluated according to the best fit method), but nevertheless SGP applies the old method (weighted average)! In fact, with my set-up SGP never applies the best fit method, the text in my logfiles always reads: “Using old auto focus method for focuser position”. THIS is the fact that I don’t understand, and I still do hope, that the developers will chime in and help.

Jared? Ken? Are you somewhere out there?

Bernd


#13

I was using 2.6.0.25 which did not work well.

I always got perfect curve but not sure why sometimes it chose new sometimes old method.
And I found that if it focus was way off due to old method was chosen, running another AF would correct the issue (not sure if it will work 100% of times but at least a few time I tried it worked)


www.mainsequencesoftware.com