Trigger an autofocus if the fhwm is out of norm?


I was wondering if it would be possible to trigger an autofocus if a frame returned an outside of normal focus range.

Say a frame returned an Hfr of 3 which would be outside of my “normal” of better than 1.2 that could trigger an auto focus run?


I’d like to see this too. I have my AF set up for every 30 minutes, every 0.5C, and every filter change. But it would be nice to see this feature to catch drifting focus.


+1 I support his feature request.


In fact SGP already detects part of this, when the AF is out by 15% from the expected calculated V-curve value instead of just giving the warning we should have options controlling what to do in an automated way:

  • behave as is is now, do nothing
  • repeat the AF x times before trigger a fail condition

The current warning is useless during automation because we cannot react.

Other trigger method could be after the analysis of each light frame, SGP already finds the total number of stars and HFR of he frame, it could compare it to the AF validation frame, if out by x amount then we could have the option to trigger AF. This config option could be next to the existing AF trigger every x frames, trigger by x temp change etc.


I’m always down for more autofocus conditional tests - if inserted as additional options to what’s already there.


@Jared @Ken Any thoughts about this ?
BTW: The OP used FHWM but I believe HFR would be OK.


Agreed. HFR is the way to go.


I think on the surface it seems like a decent idea…but as they say the “devil is in the details”. My main concern would be “chasing focus”, generally in conditions of poor or changing seeing. I think on those rare perfect nights this could work just fine (although by the time SGP could determine your focus was bad it would be too late in this case…so you’d have wasted a frame).

I’ll have to mull it over for a bit. Certainly not a bad idea and I can see where the desire to have this is coming from. But in general I think a HFR triggered focus is more reactive than proactive. Ideally you’d never want this to trip and it should be used with other focus triggers.



I think you have enough tools to maintain focus already with focus offsets and temperature compensation. Not only that but the new pro-tip being discussed lately is to turn off star testing because it is resource intensive and causes too much delay between exposures. You’d need that turned on to see if the HFR has gone outside the box so to speak.

Also with tools like on axis guiders or Optec Lacerta and focuslock, you have a way to do live focusing.


How about an option to re-run auto-focus if the HFR is far enough from what was expected? In place of the warning dialog that pops up?


I am not sure other options are necessary. The loss of focus will occur for one or more of the following reasons:

  1. Temperature change. This is managed by SGPro
  2. Change in seeing or other atmospheric change that leads to an apparent change in focus as calculated by HFR. Refocusing won’t fix this.
  3. A sudden change to your optical train such as mirror movement. Change the way you drive the focuser and it’s backlash.
  4. Mechanical looseness in your optical train. Refocusing will fix this, but you would be better off correcting the loose equipment first.

I may have missed a cause, but it looks like it already has all of the functionality we need.


I definitely agree with this. As it is now, it departs from one of the basic SGP premises that once a sequence starts it should proceed unattended. A pop-up dialog that tells of a problem is meaningless if no one is there to see it and act upon it.



@Generator, for number 3, we have, assuming mirror flop on meridian flip, we have “autofocus after automatic centering action”

Just to be more complete in your list of problems and current solutions.


There is another reason - response to rapid temperature change - an external probe will respond within minutes to rapid temperature changes but the optics will take much longer to reach steady state - the temperature trigger in SGP captures the former and I use the AF after x frames to fix any slow drift/catchup for my larger telescopes.


I suppose that we all have some seeing threshold that if the value is beyond this, auto focusing is required. Perhaps, the user can have the option to input a value (plus a number of frames ) and whenever it goes beyond this threshold, SGP will attempt autofocus.

In case a mirror flop occurs or a temperature drop occurs, autofocus is still necessary. This feature under the right circumstances might even do away with temperature sensors.



For sure, and of course the whole idea of automation is that most likely no one will be there. I would suggest an option to auto rerun when out of a certain range and do that for a user selectable number of times before (also user selectable) either aborting or just moving on (as is presently the case).


A way to overcome seeing, and other odd ball effects that would throw the Autofocus in to a loop would be to simply say if the resulting focuser position of the second AF run is within +/- half the step size from the first AF’s final position, it’s fair to say focus isn’t the problem.


I see this problem when there is high Cirrus cloud but to the earlier point, what then? There is nothing I can do about it and at worse, I find in the morning that cloud ruined a bunch of subs. There are other practical issues that make a FHWM trigger hard to implement:

  1. My NB subs are 20-mins long and rolled into my LRGB sequence. I have accurate offsets between my filters but even so, their FWHM values are all different, due to different durations and various optical effects at different wavelengths.
  2. Tracking varies between subframes - which influences the FWHM value. I don’t know how you would overcome this causing repeated unnecessary AF runs.

I like the idea but the implementation requires AI !


The underlying assumption in this discussion is that a re-run of the AF routine with some tweaked parameters would fix the problem. I have to think that will almost never be the case. As buzz said, any changes to the AF parameters that might make a re-run work better would require really complex logic. While I am all for improvements that make the imaging process more robust, I think there has to a line somewhere as to how far we try to take SGP into robotic imaging. NASA and others have successfully deployed several robotic telescopes around the world but keep in mind that each of those is a multi million dollar installation and each has a full time staff whose job it is to keep all that automation actually working.