Page 1 of 1

Sequencer autofocus: Display Stretch and FWHM

Posted: Fri Mar 07, 2025 10:11 am
by afox
Hi Robin,

I’ve been using SharpCap for while now (great work, thanks very much!) and have started to experiment with the sequence editor to eek out a few more hours of imaging time.

Could you help me out with answers to these two questions regarding sequencer Multi-Star FWHM autofocus please?

Firstly, in interactive mode I have ‘Use Display Stretch’ set. If the following sequence is executed after a sequence of still captures at longer exposure and lower gain, will a new display stretch be automatically calculated and used for the exposure and gain settings applied just before the autofocus command?

PRESERVE CAMERA SETTINGS
FOCUSER CONNECT
SET EXPOSURE TO 3
SET GAIN TO 420
AUTOFOCUS OFFSET 2250 TO -2250 STEP COUNT 12 BACKLASH 0
END PRESERVE

I’m not sure whether I need to do something extra for the display stretch to take effect such as switching to live view and taking a dummy frame then DISPLAY STRETCH AUTO.

Secondly, if an autofocus command is issued periodically during an imaging session and it succeeds, but FWHM for the best focuser position (determined from the current command and on the same target ) is greater than previously achieved, will the previous lower FWHM position or new position take effect?

I was hoping to work this out through experimentation rather than bother you but skies being as they are…

Thanks very much.

Antony

Re: Sequencer autofocus: Display Stretch and FWHM

Posted: Fri Mar 07, 2025 1:56 pm
by admin
Hi Antony,

I think that you would be best to add the two steps to capture a dummy frame then apply an auto stretch to get that to adjust when the exposure/gain changes. There are a couple of ways you could get away without this though...

1) Make your gain/exposure changes offset each other - ie with a ZWO camera, adding 200 to gain makes the exposure 10x brighter, so +200 gain and exposure divided by 10 should leave the image the same brightness apart from the increased noise

2) Set up the display stretch to auto stretch after each frame - this can be done with the locked auto stretch button, but I'm not sure if it is possible from the sequencer - hadn't considered that idea before

On what happens to the autofocus after the scan is complete, there are two possibilities...

1) The focus scan finds a valid best focus curve with a central minimum and increasing values on both sides - in this case SharpCap will move the focuser to the calculated minimum position of the curve, regardless of whether the FWHM is more/less/different to previous values

2) The focus scan is inconclusive - without a clear minimum, or without sufficient higher value data points on each side of the minimum to be sure about the shape of the curve - in this case the focuser will return to the original position.

There are quite a few checks in the focus scan code to make sure that any minimum is truly real (statistically significant) rather than just the result of some random fluctuations before it is used. This means that it is very rare for it to find and use an incorrect pattern to move the focus position - it's much more likely to reject a curve that - by eye - you might consider to be 'probably reasonable'.

If you think about it, it's probably not desireable to retreat to a previous position if the measured FWHM comes out as higher - this would fail in the case that the focus was drifting (due to temperature changes) and the FWHM changing perhaps due to seeing getting worse - the refocus in that case would find the new best position correctly, but then reject it as being worse than the old best FWHM.

cheers,

Robin

Re: Sequencer autofocus: Display Stretch and FWHM

Posted: Mon Mar 10, 2025 8:48 pm
by afox
Hi Robin,

Thanks for the tips about display stretch and explanation of the autofocus process. Both are very helpful.

I had tried the stretch lock but it didn’t seem to work. Having said that I didn’t try rigorously as I then found the documentation says the autostretch is applied ‘every few frames’, so I thought maybe it would never work for all frames in an autofocus run anyway.

Having mulled over the options, in the end I think I’ll skip trying to use the display stretch altogether during sequencing. It wouldn’t be too onerous to check the captured lights now and again in ASIFitsView or similar and just be a bit more patient and set a suitable exposure time and gain for AF to work unstretched. I think I might have been muddling scenarios wanting to see light captures stretched then changing the stretch for AF then back again. My original interest in the sequencer was mainly for when I’m asleep… You’ve already created live stacking for people who are awake 😊

Point taken about falling back to a previous lower FWHM not necessarily being a good idea, especially if a decision to change focuser position can be considered as reasonably high confidence.

Thanks again.

Antony