Autofocus improvement suggestion - outlier rejection

But why?

Bernd

Smartfocus works very well with refractorsā€¦ but not so much with scopes with central obstruction like SCTs or Newts. This why it is recommended to switch it off by the SGP developers

Thanks. I eventually read this hint and immediately forgot it again, because I use a refractor only.

Bernd

1 Like

Thanks for the continued discussion. After spending some time testing yesterday, Iā€™d generalize Bilgebayā€™s statement to say that SGP focus doesnā€™t work very well with SCTs. It obviously canā€™t handle anything significantly away from focus (e.g. star rings instead of dots) and even in the region where it does recognize stars, its ability to obtain a good out of focus number seems extremely limited. Thus, what I tend to be seeing is a McDonaldā€™s double arches M where the reported focus gets worse before it gets better. Thus, the focus chosen by the autofocus often does not pick the best choice on the curve. Presumably brighter stars/better SNR might improve things, but I had much higher hopes for the autofocus functionality in SGP. As is, while it might be able to track focus if I get it set up perfect, I canā€™t possibly rely on it to find focus from night to night where the current focus point will have drifted from the last focus the night before

Any suggestions on how to improve the performance Iā€™m seeing would be appreciated.

Thanks,

Beo

@LordBeowulf

My own experience is that SGP works quite well with Cassegrain type scopes. I use SGP with a 12" f/8 Meade LX850 and get excellent AF focus results. You may need to experiment more with the various AF parameters to find a combination that works with your scope.

I found that when trying to pick the number of focuser steps between focus data points, you want that number to be large enough that there is a significant change in HFR between each data point. I recommend that the spread between the best (smallest) HFR and the initial HFR be at least 3x and 4x may be needed. I also think you should use 9 data points and select your exposure lengths to be long enough to record plenty of stars.

It is true that the auto focus routine works most reliably when starting with a decently focused image but that is not a hard requirement to meet. Once an imaging run is started, the images should never be far from focus when each AF runs starts.

Charlie

1 Like

Let me put in a plug (once more) for a fairly simple enhancement to the auto-focus routine that, IMHO, would make a DRAMATIC improvement in focus reliability for central obstruction scopes, of which the many focus challenges they experience are well documented above.

The focus routine needs a sanity check feature, such that if the focus position it is currently working in or the end result focus value do not pass this sanity check, the focus would return to a certain value that is known to be reasonably good.

The sanity check I propose is the least square fit focus line (LSF line) that has been derived over several nights or at least a fairly sizable number of focus runs over a wide range of temperatures. The relationship between focus position versus temperature is close to a straight line for most scopes and its specification only requires two numbers, a slope (which is the change in focus position for 1 degree change in temperature), and the interceptā€¦ This is easy to determine using any of dozens of free sites on the web if you feed them pairs of focus positions/temperatures.

I have determined these parameters for every scope I have ever owned, which have included several refractors, a 12" RC, a 14" Celestron Faststar, an 11" Celestron RASA. All of these scope had a consistent LSF line that I could use reasonably well for an entire night of imaging, only doing an initial focus run.

The proposed focus enhancements could work this way with SGP:

  1. focus routine would accept the slope, ie. focus change value per degree temperature change. It already does and uses this value to compensate for temperature changes between focus runs.
  2. A new input: the focus position at 0 degrees C. This is just the intercept of the least square fit line. No measurements are actually required at this temperature. A value of 0 would disable this feature.
  3. When the first focus of a sequence run is started, SGP would automatically move the focuser to the focus position on the line determined by the current temperature for its staring position. From there it would do the usual focus routine. This is something that should always be done with the current routine manually to give the best results.
  4. A second new input: MAXIMUM allowed deviation from the LSF line. This is the sanity check part of the proposal. If the new focus position deviates too much from the LSF line, this is probably a bad focus run, and you are much better off just using the LSF line value. A value of 0 would disable this feature.
  5. A third new input: Number of retries if the focus value exceeds the maximum deviation value. Could default to 0, which is what happens now.
  6. The normal center point of the focus process of moving the focus range progressively further from the original starting point would not exceed the maximum allowed deviation. This would keep the focus routine from running off into never never land.

Implementing these suggestions would not keep you from using the focus routine exactly the same as you do now if your scope does not have a consistent LSF line.

What I have experienced many times over the past several years using the SGP focus routine is the following:

  1. for refractors, it works spectacularly well, giving perfect V curves, most of the time. However, even with a refractor, at times a focus run will be flawed, perhaps a wind gust or light cloud at just the wrong time puts it out of whack.
  2. for the central obstruction scopes, most of my focus runs were quite good with very acceptable results. However, a fairly large percentage were not, and have given me an hours worth of imaging that was out of focus. For those times it would have been much better to just use the LSF line value. In fact, much of the time I just let SGP apply the set focus delta value for the entire night, after establishing a good focus at the start.

So last night I worked through the guide and tweaked my settings and was moderately successful at getting a good V curve. However, there are a couple of issues that could potentially be addressed with improvements in SGP, so Iā€™ll post here in the hopes that the team will note and consider.

My focus motor drives the fine focus knob on my FeatherTough replacement to the stock (mirror) focuser. Iā€™m using an 11" EdgeHD OTA with the mirror lock clutches slightly loose so that it can drag the mirror with the focuser but doesnā€™t get much mirror flop in use. However, when focusing, the mirror DOES flop (shift), and that causes hysteresis in focusing. Thus, when the current algorithm goes from center to edge, the first couple of steps are taking up the slop in the tilt before the mirror actually starts moving. Thus I always end up with a nearly flat right tail before it starts dropping towards the focus point. This of course also means that when it returns to the final focus position, it approaches from the wrong direction and the hysteresis means it doesnā€™t return to the same focus point.

I plan to make my own fix for this since I wrote all the code, but Iā€™ll have to do it at the motor drive level rather than in the ASCOM driver (where Iā€™d prefer) since the driver doesnā€™t really know the condition of the motor until SGP calls and asks (which appears to be extremely slow polling for some reason). However, itā€™d be really nice if SGP had an option for dealing with hysteresis and could use unidirectional approach to all targets.

The other issue is really a user interface issue, and I should probably start another thread on this, but Iā€™ll get comments here first. The settings for things like autofocus are really fragile in SGP. What I mean by that is that the settings are basically just going into the current sequence and donā€™t go into the profile unless I go in and manually edit that profile. And of course if I close the sequence and load another one, the settings I just fixed are gone because the profile loads its own settings. Hopefully I stored the sequence I worked on so that theyā€™re still there, but most of the time when Iā€™m experimenting I just start with the default profile that I donā€™t have any reason to save, so Iā€™ve lost settings more than once. Not to mention that I have to manually move those settings into another sequence that I may want to continue with those new settings. I understand whatā€™s going on, but Iā€™d like to see some options to easily update the profile and update a sequence from a profile, etc. If these features are already there I donā€™t know where they are or how to use them.

Thanks,

Beo

Hi Beo,

I am referring to your second and third paragraph. SGP has a feature called ā€˜focuser backlash compensationā€™. Please read the corresponding passages (pages 49, 50) of the PDF manual.

Bernd

1 Like

Excellent, thanks! It would have made sense for it already to be there, but I didnā€™t see anything obvious. Iā€™ll go dig through the manual. Need to find the PDF as right now Iā€™m logging in remotely and reading the online help!

Thanks,

Beo

Found it and tested last night. I think I may need to tweak some settings or possibly just reverse the direction of travel for everything, but I need to actually test while Iā€™m in the observatory and can confirm how things are working. I also still need to determine why SGPs reaction/update time is so slow. I know my focuser isnā€™t that slow so I donā€™t know if this is just inherent in SGP not polling fast enough, or if thereā€™s something off in my ASCOM driver.

Thanks,

Beo

Just wanted to remind that this problem is still giving me very hard timeā€¦ I have to baby sit all the imaging and focusing runsā€¦ in the below image, you can see how the galaxy cores are knocking off the FWHM averageā€¦ and they are not in line with the star FWHM valuesā€¦ I am watching star values for each step and taking note of the step where smallest star values are obtained. After the AF routine finishes and lands the focuser wherever it deems fit Iā€™m manually moving to the real focus point to capture useable framesā€¦ otherwise all the frames are out of focus.

I have seen other software handle this via a couple different ways -

  1. Focusing should be allowed about 1 degree from actual target. This ensures you are not picking up bright portions of the target for focusing. Should easily solve a few issues.

  2. Focus check (more like sanity check) - if no significant improvement is found between before and after running AF, the previous focus position needs to be retained.

  3. Allowing focusing on a single star - admittedly not the best approach (as compared to full field star selection), but can be used as a fail safe option. I also believe implementing such a solution is fraught with many potential pitfalls - primary one being, the ability to select a star. However, with proper HDF and ADU values, this can be overcome to a certain degree.

Dhaval

Thank you for your input Dhaval. In my case, focusing 1 degree away from the target is not option as recentering can be a real chore for some targets where very few stars are available in the fov.

Regarding your second and third suggestions, Iā€™m sure Ken and Jared will come up with a solution at their earliest convenience. Until then, Iā€™m picking only the targets that I can work with with the current system.

Iā€™ve found a similar problem w/ galaxies and more often than not - globular clusters. The cores simply donā€™t get rejected in the AF calculation. I would suggest something like the following which will separate individual stars from more lumped objects like galaxy or glob cores:

  1. Run through the focusing routine, keeping track of each individual objectā€™s HFR. The stars should be deep V-curves while the more extended objects will never have deep V-curves by their nature of being extended and not point-like.
  2. An algorithm must be constructed to separate these classes, perhaps just using the fractional change in HFR from maximum (or averages of the extremal parts of the individual V-curve) to minimum and rejecting outliers may suffice. The extended objects will have a smaller fractional change, while the stars will have a large change.
  3. Keep only the objects with deep individual V-curves and recalculate the V-curve with only these objects.
  4. Find best focus using the revised V-curve having only stars.

In terms of UI, the suspected extended objects could be highlighted in red and the stars in green.

Gabe

1 Like

Well, I had to switch back to 2000mm focal length because of focusing and plate solving issues. Working at 3910mm was a real chore.

Regarding your case, the only way I see it, with the current program, is to take the place and walk a few degrees in a region that doesnā€™t have galaxies, come back later with the focus adjusted

This post is over 2 years oldā€¦weā€™ve made massive changes to Auto focus in that time with much more rigorous fitting methods and rejection.

Jared