Autofocus to far out to find focus

So we are talking about the same thing, manual intervention is required to get a proper focus. In the event that temp compensation was not being used, or inaccurate, eliminating false readings would probably work. When a observatory is unmanned, the issue becomes even more critical…

Everybody’s set-up is different. I have never had to do manual intervention to get good focus and SGP’s routine works fine for me every night. (I image via a refractor and although my focus start point might not be on the button…it still works for me without any drama.)
Having said that - if people need improvement to what is presently on offer - then I am all for it. I just wanted to throw a positive comment into the mix - SGP AutoFocus does work well for some!


Yeah it works but there a few quirks, clusters sometimes got flagged as a unique stars as an example. I don’t see why SGP would refuse to calculate the HFR for a doughnut… is it related with the “open” middle region ?

I have also encountered this issue with 9 points. I am very close to focus, but apparently SGP requires at least 3 points to the right side of the V-curve. If it only has two, it moves all the way out where it gets inconsistent readings for the first three or four tries (e.g. 9, 9.6, 7, 5– and instead of continuing in the right direction it stops and moves out again, at which point there’s no saving it.
Note that I can be farther from focus and succeed, as long as there’s three consecutive improving points, for SGP will add more points as needed. But it doesn’t intelligently utilize the first V-curve attempt if there are two or fewer points.

The problem that the star size algorithm doesn’t cope with large stars, and particularly large stars with an obstructed scope, is IMO the main reason for people to have problems with the SGP autofocus.

Obviously starting in focus isn’t a solution.

As I see it the problem is that stars stop looking like a spot that’s brighter in the centre, they look more like a uniform disc, or doughnut for an obstructed scope. People can see these easily and, because the size reduces as the focus position is approached, can easily focus the scope. The software can’t, probably because it’s looking for a dot with size and will tend to use part of the star image or noise, such as a galaxy.

There is a lot of information about finding circles in images, much of it mentions the circular Hough Transform. Unfortunately most of this is interested in determining the position of the circles, not their size. I don’t really have the time or enthuiasm to do the coding and testing required to test this but perhaps there’s someone around who could.

I agree entirely with this. My suggestion for a very simple, and simple to implement fix, is for the routine to just ignore all the large stars. Obviously when very out of focus, all stars will be on the large size. An easy way to implement this and deal with this problem is to just use the smallest half of the stars. Or maybe the smallest 30%, if throwing away 50% is not adequate. Another major benefit of doing this is it will eliminate most, if not all of the large stars which are actually groups of two or more stars. Including these only serves to make the average focus value less reliable and closer to noise.

I have never gotten any feedback from the developers on this.

Yes, SGP does calculate HFR for donut sized stars. At least it does for me. A couple of years ago Ken put in a lot of effort to get it to do this. From that point forward it has been much more successful in this regard. Its success will of course diminish the larger the stars get, partly because the larger (more out of focus) they are, the dimmer they are.

The best hope for this may be to implement using the temperature profile of your rig to set the starting point for a focus run much closer to best focus. This has been suggested many times.

The problem of star clusters treated as single stars is a known issue. I believe Ken has a version of the routine that detects these but is very cpu intensive so has not been used.

Are you saying there is no problem with determining the star size for out of focus images? That the people in this thread and others reporting that their out of focus images don’t give correct star sizes are wrong?

So far the only solution I’ve seen is to start with a nearly focused star image and that doesn’t solve anything.

Perhaps this is a problem for which the full solution is to hire an observing assistant.

Ok I will take one more pss at this. In order to do this, I need to state, I consider myself an expert in this software and associated systems. With that said, there is lots of evidence on this forum, that some people are having problems.
i am calling a large star as having a FWHM measurement that might be around 7-9. This is not out of the capability of SGPro to measure. I set my step size to give me 7 points with the max reading about 3 times the minimum. So lets not rehash am I doing it right.

It is a fact, SGP returns false readings under certain circumstances. If you are not experiencing this, that is fabulous, but please let those of us who are, have our say…

Chris, if this comment refers to my comment, then NO, I am not saying that. Obviously when enough out of focus, the focus routine cannot find the stars and therefore cannot determine a star size. Obviously lots of people are experiencing difficulty getting usable focus curves. Inability of the focus routine to give meaningful star measurements is a problem we are looking for solutions for.

What I did mean with my comment is that up to a certain size and brightness, it will detect and give correct star sizes for stars that are donuts. I did not say or imply that this would be true for way out of focus situations. Ken did make major improvements in this a couple of years ago. Does it work when badly out of focus. Of course not. Why would we expect it to. The user should try to start as close as possible to good focus.

Clearly, as you say, we must start the focus run as close as possible to correct focus. Assuming no manual intervention, the only way that has been presented so far to do this is to have the routine use the current temperature and make the appropriate temperature compensation before starting the run.

This works well for a fixed installation, assuming you have determined the temperature coefficient for your equipment. For a portable rig, you should be able to manually set the focuser at the optimum starting position based on the current temp.

Yes, I see this often myself. For this reason I have turned off the smart focus procedure so that it does not move a huge distance from where it started. This approach has worked reasonably well for me.

An estimate of how far out of focus a FWHM of 8 pixels would give is 240 microns, 0.24mm, 10 thousands of an inch. I’m assuming a pixel size of 5 microns, an F/6 scope, and geometric optics.

That doesn’t seem like a long way out and I can see why people want a better ability to focus, especially when they can see the stars in the image when it’s a lot more out of focus than that…

It may be that determining the star size when grossly out of focus is too difficult and there’s always going to be a problem when the star image is so big that it vanishes into the noise. But if stars could be detected and sized when say 6 mm out of focus a coarse focus routine could help users get in the ballpack.

Its the false readings especially when using a SCT scope. I have two piers in the observatory, the other with a TMB130 refractor, which I rarely if ever I have focus problems. I just want bulletproof focus, so I don’t have to actively monitor it. I know the SGpro can measure stars much larger than FWHM 9, it just gets confused when many of them have donuts…

For a large, long focal length scope, the SGP autofocus routine does not work well at all, for a variety of reasons. Thanks to some heroic improvement efforts a couple of years ago, the routine actually does a very good job of detecting donuts, as long as they are bright enough. The problem I regularly experience is that a star field always contains stars of varying brightness. SGP does a great job of calculating the size of the bright donuts, but for the dimmer ones, it frequently identifies only a small part of the donut as a star. That, of course, means that a much smaller HFR goes into the calculation and throws off the entire routine. Longer exposures don’t help much - it will produce more bright donuts, but dimmer stars that would not produce detectable donuts at all now get only part of the donut detected. Of course, then there are galactic nuclei and globs that get selected as stars, skewing the HFR calculation the other way. For my EdgeHD 14, autofocus is for all intents and purposes useless.

All of this could be avoided with a simple outlier rejection routine that tosses out stars that are much larger or smaller than the average at each point. Sadly, I was very disappointed to see Jared post in another thread that they haven’t even started working on improving autofocus yet. I have been hoping against hope that they were working on this behind the scenes, particularly since this is the one problems that people have been the most vocal about and that is driving so many people to use other software. Sadly, it looks like I may have be be one of them, at least for when I use the EdgeHD 14. SGP has several features that are awesome, that I don’t want to do without and are not offered by other software, but those features are meaningless if focus doesn’t work.


We’ll be starting on the auto focus enhancements soon. What would be helpful are auto focus packs especially where the data seems ok but SGP failed to find good focus.


I’ll try to get some more, but I provided focus packs (now deleted from DropBox) when you asked for them a year and a half ago here:

What are focus packs??
I also totally agree on rejecting outliers would be a great start. When in focus I have a HFR or 2.6. I want to reject anything below that.

When there is a very bright star in the FOV, it will often identify part of the star and not the whole star.

Star clusters are also problematic, three stars will be calculated as one when close together. I am not too worried about this one because the group should be proportional as you focus.

Just having algorithms that more carefully select stars I think would help. Maybe fewer stars.

I don’t have problems on my refractor, nice v curves.

In the auto focus settings you can save Auto Focus packs. These are all of the images that are taken in an auto focus run. We can use them to “play back” the actual focus run and analyze how focus was determined and adjust the algorithm.



Ok I will send you one… Bruce

Since you are now considering working on improving star detection, I will make an observation that I have noticed for a long time but have not mentioned.

The current star detection algorithm chooses different stars on different images. This adds an element of comparing apple to oranges. In other words, when there are different stars contributing to the average HFR for an image, the accuracy of the collection of images that make up one focus run is degraded. This shows up dramatically in the examples many people have given for long focal length scope with small FOV, such that only a few stars are in the image.

Compound that with including multiple stars as a single star, and it is no wonder focus does not work in these situations. Including multiple star images is comparable to including nebula, the sensitivity of the HFR value is degraded by a factor of about 10. When small stars will go from hfr of 2 to 6 over a run which is a 300% increase, the typical multi-star star has its hfr go from 10 to 13, a 30% increase.

Correct. For images where we have lots of samples this works fine but when there are few stars that can cause a large impact. If I recall we did go through some iterations where we would preserve the selected stars for each AF frame. But at the time we saw little difference with the gear we were testing with at the time and didn’t see any benefit. But it’s certainly worth revisiting this especially when we have a small amount of detected starts.