Autofocus seems suspect

Questions, bug reports, requests for enhancements, etc.
iMustBcrazy
Posts: 338
Joined: Sun Jun 02, 2019 3:52 pm

Re: Autofocus seems suspect

Post by iMustBcrazy »

rumen wrote: Mon Jul 26, 2021 11:14 pm Excuse me, I do not understand. Maybe it is my English, but do you usually start with it and the results are not OK. Or next time you will start with it?
Sorry, no, it's my english :-o I meant to say "I will start with that"
iMustBcrazy
Posts: 338
Joined: Sun Jun 02, 2019 3:52 pm

Re: Autofocus seems suspect

Post by iMustBcrazy »

Hi Rumen,

I went through a series of tests but the first one was the auto focus with trace. This log shows the trace output. Then I tried a guiding test because some light clouds were spoiling the auto focus. Then I tried auto focus again. Then a full capture session of 30 subs.

I was using 2x2 binning and I noticed that the results improved when I extended the images to 10 seconds instead of 5 seconds.

I read the advice on auto focus that Peter wrote but its very subjective. It seems to me there should be a calibration for this. Otherwise the user has to spend a huge amount of time experimenting. Most routines use the V-curve method. Why not use that? I notice that the HFR results are quite inconsistent so it would seem that many captures would help. The V-curve method inherently smooths out the HFR results in the curve fitting.

Here is the trace log - I compressed it because it was 250 MB

https://www.dropbox.com/s/bgpflpnnb5oxd ... g.zip?dl=0
iMustBcrazy
Posts: 338
Joined: Sun Jun 02, 2019 3:52 pm

Re: Autofocus seems suspect

Post by iMustBcrazy »

I forgot to add my notes from last nights session...

bin 2x2

29808 - manual focus (by eye always focus in to set point)
manual focus to 29808
manual focus to 29808
Screen Shot 2021-07-31 at 10.09.25 PM.jpg (348.47 KiB) Viewed 140 times
Auto focus (AF) auto star (AS) = 29765 - doesn’t look good
AF AS = 29748 - looks bad
manual focus to 29808
manual focus to 29808
Screen Shot 2021-07-31 at 10.09.25 PM.jpg (348.47 KiB) Viewed 140 times
10s exposure, guiding no dither

MF MS = 29888
manual focus to 29888
manual focus to 29888
Screen Shot 2021-07-31 at 11.32.03 PM.jpg (388.79 KiB) Viewed 140 times
AF MS = 29876 - looks good, high peak, same star as previous attempt


trace on

AF AS = failed - selection was between two stars!

AF MS = 29821 - not same postion before, same star as previous MS
auto focus to 29821
auto focus to 29821
Screen Shot 2021-07-31 at 11.44.12 PM.jpg (362.16 KiB) Viewed 140 times
AF MS = 29963 - not the same position again
auto focus to 29963
auto focus to 29963
Screen Shot 2021-07-31 at 11.54.59 PM.jpg (380.92 KiB) Viewed 140 times
MF MS = 29876 - looks good
Attachments
auto focus to 29748
auto focus to 29748
Screen Shot 2021-07-31 at 10.19.59 PM.jpg (380.29 KiB) Viewed 140 times
iMustBcrazy
Posts: 338
Joined: Sun Jun 02, 2019 3:52 pm

Re: Autofocus seems suspect

Post by iMustBcrazy »

I don't know. Maybe I'm splitting hairs. I'm going to do a manual V-curve routine and plot the results so I can get an idea of the range of steps and HFR values. I'm completely lost right now. The only thing I know for sure right now is my backlash = 17 as that was measurable according to ZWO recommendations.
User avatar
Peter Polakovic
Posts: 2696
Joined: Thu Apr 21, 2016 9:38 am

Re: Autofocus seems suspect

Post by Peter Polakovic »

iMustBcrazy wrote: Mon Aug 02, 2021 12:11 am I read the advice on auto focus that Peter wrote but its very subjective. It seems to me there should be a calibration for this. Otherwise the user has to spend a huge amount of time experimenting. Most routines use the V-curve method. Why not use that? I notice that the HFR results are quite inconsistent so it would seem that many captures would help. The V-curve method inherently smooths out the HFR results in the curve fitting.
The reason is that we found that V curve algorithm doesn't really work with the most cheap focusers, just the very expensive ones (with fully reproducible position).

I have a feeling, that in this case the problem is actually the noise in the image. Maybe try even higher binning or longer exposure times.

And as Rumen wrote, it may be a good idea to make FWHM and HFD optional in the quality metrics, now both are used (together with peak value).
iMustBcrazy
Posts: 338
Joined: Sun Jun 02, 2019 3:52 pm

Re: Autofocus seems suspect

Post by iMustBcrazy »

Yes, I think you are right. I'm going to use the same gain as normal exposure and maybe increase the exposure time and different binning. Last time I had the camera at full gain. Also, I'll do a manual V-curve to get my bearings on whats going on.

By the way, I don't know if you noticed but one of the auto focus attempts failed because the auto star selection didn't work. It selected the middle of two stars (that were clearly separate).
User avatar
Peter Polakovic
Posts: 2696
Joined: Thu Apr 21, 2016 9:38 am

Re: Autofocus seems suspect

Post by Peter Polakovic »

By the way, I don't know if you noticed but one of the auto focus attempts failed because the auto star selection didn't work. It selected the middle of two stars (that were clearly separate).
Try to save such image next time and we'll play with it. It may happen due to too high noise too...
ThatsMyCoffee
Posts: 103
Joined: Tue Jul 09, 2019 4:59 pm

Re: Autofocus seems suspect

Post by ThatsMyCoffee »

I also have a colour cam and have done tests comparing it to a B. mask. When I compared what I did manually to what AI did, the results were very very close. The autofocus was better about half the time (in final image result) than what I could achieve manually with the mask, so I decided to never worry about it again.

There have been times when the focus was way way off and the procedure had to be restarted, but a very rare occurrence. Most of the time I leave my rig doing a sequence and don't need to interfere for several hours at a time.

Referring to your comment about getting different results in repeated tests...yes, you will. Backlash plays a big part of that. And so do atmospheric conditions. You say your backlash is 17, so I wouldn't worry if the difference between tests was below 50, or maybe even 100. The important part is what is the result? Forget the step count. Is it focused or not? Right?
rumen
Posts: 133
Joined: Wed Feb 22, 2017 7:31 pm

Re: Autofocus seems suspect

Post by rumen »

I looked at your tests, to be honest I do not see any problem. And i can not really follow them. But what i see is you can not compare results from different stars and you can not expect the focuser to finish in the same position. No matter what algorithm you use if there is a backlash involved no way to finish in the same spot. Also the scintillation plays a huge role in focusing too. If i get HFD 4 now in a second same star same focus it may be 6.
Also guiding + focusing is not a good idea. This may be worse than scintillation.

By the way how do judge Good vs Bad? As I do not see any problems with the focus in the screenshots you have shared. But I do see some under sampled stars which are not good for focusing.
iMustBcrazy
Posts: 338
Joined: Sun Jun 02, 2019 3:52 pm

Re: Autofocus seems suspect

Post by iMustBcrazy »

rumen wrote: Tue Aug 03, 2021 4:00 pm I looked at your tests, to be honest I do not see any problem. And i can not really follow them. But what i see is you can not compare results from different stars and you can not expect the focuser to finish in the same position. No matter what algorithm you use if there is a backlash involved no way to finish in the same spot. Also the scintillation plays a huge role in focusing too. If i get HFD 4 now in a second same star same focus it may be 6.
Also guiding + focusing is not a good idea. This may be worse than scintillation.

By the way how do judge Good vs Bad? As I do not see any problems with the focus in the screenshots you have shared. But I do see some under sampled stars which are not good for focusing.
I realize there is a lot of variables and perturbations but I'm basing my judgement on things being good or bad as a difference I can see with my own eyes. I figure if I can see the difference, then the algorithm is not really working that well. One can say that backlash will result in non repeatable results but I think it is repeatable if you always focus in to the setting. Also, it appears that I have very little backslash. In fact, I actually did the V-curve manually and then set the focus manually to the V-curve result and got a very good focus.

Here is the V-curve measurement. I used Nebulosity to measure HFR, which did a very good and repeatable result with little variance in the HFR:
Screen Shot 2021-08-03 at 10.17.09 AM.jpg
Screen Shot 2021-08-03 at 10.17.09 AM.jpg (411.57 KiB) Viewed 98 times
Here is the Nebulosity star profile view:
Screen Shot 2021-08-02 at 9.48.37 PM.jpg
Screen Shot 2021-08-02 at 9.48.37 PM.jpg (410.9 KiB) Viewed 98 times
I used this resultant value of 29550 as a baseline for auto focus with AI. Eventually, I was getting consistent results but I have a couple of notes on the whole process.

(I used 5s exposure at medium gain whereas before I had full gain - gain=120 where I normally shoot could result in stars not found. Also I ended up using full resolution instead of binning - seemed to have better profile curves. I used 20 for backlash as that was the value I found that caused noticeable movement in the focuser. The 50 step setting I used as a result of doing the manual V-curve, breaking curve into approx 10-12 measurements.)

The auto select was ok but I got the impression that it was not re-acquiring the star centroid in each capture, which needs to be done because the star can move due to periodic error in the mount, especially since it takes 5-10 mins to acquire focus - or a larger window around the star for measurement. This resulted in a failed focus once. This is why I started to use guiding while focusing. This should be ok since guiding is sub-pixel accurate - except for glitches. As well, I found others doing it this way. But I would prefer not to use guiding if star centroid is re-acquired. The star profile looks really bad compared to Nebulosity. When using Auto Select, there is no star profile shown so one can't see what is going on. A good profile like that in Nebulosity gives the user confidence that things are working properly.
Screen Shot 2021-08-03 at 12.56.39 AM.jpg
Screen Shot 2021-08-03 at 12.56.39 AM.jpg (418.36 KiB) Viewed 98 times
Post Reply