<em>1. Whether or not you are in focus is the job of Focus, not Capture. And Focus uses focus frames to determine whether you are in focus. The reference of being "in focus" is the output from a successful Autofocus of the focuser position and HFR.</em>
True, but this is the programmer's point of view. The user, however, sees how HFR develops and how - in some cases - focus reacts inappropriately.
<em>2. As you say it makes no sense to compare a subframe with a focus frame (for many reasons, the exposure and gain may be different, the filter may be different, etc etc).</em>
Totally agree.
<em>4. You could, theoretically, run Autofocus then take the first sub of the sequence job, then analyse the sub and get the HFR. Because its the first sub after Autofocus, you should still be in focus - this would be the assumption. This could then be used as the reference and subsequent subframe HFRs compared to it. But its now dependent on guiding, etc. If guiding was off on the first frame your trigger HFR will be off.</em>
Absolutely. The initial focus run makes sure we start the first sub at the best possible focus position. Ekos should keep track of focus run HFR strictly separated from sub HFR. The sub HFR is the result of all imperfections combined: Focus, seeing, refraction, guiding, wind, etc. In order to eliminate seeing, guiding and wind from the list, focus run should use short exposures. It doesn't make much sense to take 3s focus frames when your telescope can deliver 0.8" resolution but seeing is 2.5". With regard to guiding errors ruining the reference sub, this should be taken care of by the "abort if guide deviation >" feature in "Guide and Focus limits".
The procedure I envisage goes something like this:
1. Initial focus run (short exposures), remember "reference focus HFR".
2. Take the 1st sub and remember "reference sub HFR".
3. Take the 2nd/next sub and compare 2nd sub HFR vs. reference sub HFR.
3a. If the 2nd sub HFR is below the threshold, continue with the next sub.
3b. If the 2nd sub HFR is worse than the reference sub HFR by a certain margin, it means at least one of the imperfections has deteriorated, POSSIBLY focus has drifted. Whether focus has drifted or something else has happened, has to be determined by taking a short focus exposure. Its HFR should be compared vs. the "reference focus HFR".
3ba. If the current focus HFR is within a certain threshold compared to the "reference focus HFR", continue with the next sub. (Focus position is still ok, the deterioration of sub HFR must have been caused by something else, running a re-focus at this point won't yield any improvement)
3bb. If the current focus HFR is worse than the reference focus HFR by a certain margin, start a full re-focus run. Remember the re-focus run HFR as new "reference focus HFR".
4. Repeat at 2. but remember current sub HFR as the new "reference sub HFR".
Advantages: Spend time only on what is really necessary.
Make reasonable use of sub HFR to prevent unnecessary focus checks and re-focus runs.
Use quick focus checks to prevent unnecessary re-focus runs.
Catch focus drift at the earliest time possible (= when a sub is received), unlike fixed time intervals.
An advanced implementation of focus check could compensate for refraction effects depending on the object's altitude.
Instead of taking just one short exposure for focus check, the median of a few short exposures could be used to make things more reliable. Determining the median of 3 short exposures for focus check should take less than 5 seconds.
<em>Ultimately, there are many things that affect the HFR in a sub that have nothing to do with focus. So I think the existing method of using focus frames rather than subs should be superior (but haven't tried it).</em>
That's being dealt with by short exposure focus checks only if sub HFR suggests so. The short exposure focus check should eliminate seeing, wind and guiding errors from the equation. The effect of refraction on HFR can be computed and compensated for.