×

INDI Library v1.9.8 Released (29 Sep 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

New Focus Algorithm in Ekos

  • Posts: 112
  • Thank you received: 33
Morning all,

I'm in the process of writing a new focus algorithm for Ekos. If your focus already works well then there's probably not much here for you so you might want to just keep on scrolling!

For my equipment, the Iterative and Polynomial algos don't work very well because of the backlash in my ASI EAF. Linear works the best but usually finishes up overshooting the point of optimum focus. So I'm building a new algorithm, called "Linear 1 Pass" that is based on Linear but does a single pass, works out the point of optimum focus in that pass, and moves to that point.

Here is a write up of what it does...

This browser does not support PDFs. Please download the PDF to view it: Download PDF



Let me know your thoughts. The code is mostly (but not completely) written so easy to change at this stage. There is still a lot of testing to do though.

Regards,
John.
The following user(s) said Thank You: Jasem Mutlaq, Gonzothegreat, Sergio, Bernd Limburg, Euripides, nou, David Swinnard, Juergen
Last edit: 3 months 1 week ago by John.
5 months 4 days ago #82616
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 737
  • Thank you received: 69
Looks promising as I feel that after the first pass the estimated focus point is about right. 2nd pass often doesn't make it better.
Thanks!
Max S.

RPI 4 B (4Gb) with SMate
Askar FRA400, TPO RC6, Nikon D5500 full spectrum (with IDAS D1 clip-in filter).
ASI2600MC Pro
ZWO ASI120MM Mini on ZWO 30F4
ZWO ASI224MC-S on Orion 50 mm f/3.2
ZWO EAF x 2
SW AZ-GTi
SW HEQ5
RST-135
iOptron CEM40G
5 months 4 days ago #82618

Please Log in or Create an account to join the conversation.

  • Posts: 192
  • Thank you received: 13
Agreed. Seems that the first pass calculation is really good... then it should move way out (to eliminate backlash) and then back to that point.

One additional thing that seems to happen to me... When it currently moves way out, then in, it doesn't wait for the focuser to hit that "out" position. Which means it doesn't always eliminate the backlash. Perhaps you could put a small pause after it moves out... before it moves back in?

Does that make sense?

Ron
Mounts: Sky-Watcher EQ6-R Pro, Meade LX85, Celestron NexStar Evolution Alt/Az
OTAs: Celestron 8" Edge HD w/Celestron Focus Motor, Meade 80mm APO Triplet Refractor w/ZWO EAF
Cameras: ASI533MC Pro, ASI183MC Pro, ASI224MC, ASI120MC-S, ZWO ASI290MM
Raspberry Pi 4 with Stellarmate OS, MacBook Pro
5 months 3 days ago #82621

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 33

Replied by John on topic New Focus Algorithm in Ekos

Hi Ron,

Thanks for the reply. So what happens with Linear is that whenever it moves outward it does the "backlash hokey-cokey" by moving "5 * Step Size" further outward than needed, then when that completes, it moves inward by "5 * Step Size". Step Size does get changed by the algorithm but it will never be bigger than the Initial Step Size field on screen. So, for example, if Initial Step Size = 40, then it will correct for 200 ticks of backlash... if you have, say 300 ticks of backlash, then 100 will be uncorrected.

With Linear 1 Pass there will be 2 ways to deal with backlash:
1. Same as Linear (if on-screen backlash field is set to zero).
2. User entered backlash into on-screen backlash field. The hokey-cokey will be use this value. So in the above example, if your real backlash is, say 100, then set the field to 200 and you'll be fine.

Hopefully this would fix your issue.

John.
Last edit: 4 months 3 weeks ago by John.
5 months 3 days ago #82623

Please Log in or Create an account to join the conversation.

  • Posts: 103
  • Thank you received: 11
Hi John,

I greatly appreciate your approach since I face the same issues with my EAFs. Only "linear" works, but not very reliable in the 2nd pass.

Question about the standard deviation weighting of the fit: The standard deviation will be calculated from all HFR values obtained from the field, correct? The HFR distribution depends (1) on the distribution of the star brightnesses in the field and (2) on local effects (seeing) on individual HFR values. So (1) will be nearly constant for a given focus field, but (2) varies and is a measure for the "quality" of that particular focus frame. Or am I making a mistake here?

Nevertheless, I would be very happy to test your routine!

CS, Bernd
254/1450 mm Newton, 130/730 mm APO, 70/336 mm APO, EQ6-R, ZWO EAF focusers, DeepSkyPro 2600c, ASI183MM, RPi4b 8GB, Bullseye 64bit
5 months 3 days ago #82631

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 33

Replied by John on topic New Focus Algorithm in Ekos

Hi Bernd,

Thanks for replying. On the standard deviation:
1. If single star mode is selected, the SD option is disabled.
2. For multi-star... the stars go through an extraction process to find suitable candidates (I haven't changed this). There are several options but if you use the default SEP there are many parameters to control this, for example removing clipped stars and those below a certain brightness. After this process has run there will be a set of stars that meet the criteria and each has its HFR calculated. I then calculate the SD of this set.

The star set will vary from frame to frame and there is some existing work in Linear to try and use the common subset of stars for consistency. I am trying to use this in Linear 1 Pass, but there is still some work to do. Variation in brightness of the stars should not affect the HFRs too much (assuming the extraction and processing parameters are set reasonably).

The variation in HFRs will depend on focus effects, seeing, etc. but I think its a reasonable measure of "quality" for the focus point. What I've observed on my equipment is a trend whereby SD increases with distance from optimum focus but then certain points deviate from this with transient effects like seeing, wind gusts, etc etc.

As to whether applying weighting makes enough of a difference to the calculated optimum focus point to be noticeable, I don't know. We'll just have to give it a try.
5 months 3 days ago #82633

Please Log in or Create an account to join the conversation.

  • Posts: 103
  • Thank you received: 11
Thanks for the explanations, and your project sounds really promising, I'm very curious!

Regards, Bernd
254/1450 mm Newton, 130/730 mm APO, 70/336 mm APO, EQ6-R, ZWO EAF focusers, DeepSkyPro 2600c, ASI183MM, RPi4b 8GB, Bullseye 64bit
5 months 3 days ago #82636

Please Log in or Create an account to join the conversation.

  • Posts: 192
  • Thank you received: 13

John,

Thank you. I understand the process... but in my case, when it does the "backlash hokey-cokey" it moves out then in so quickly, that I don't think the focuser has reached the full "out" setting. I think it would benefit from a move out, pause 1 second, move in... to assure that it getting the full effect.

Thanks,

Ron
Mounts: Sky-Watcher EQ6-R Pro, Meade LX85, Celestron NexStar Evolution Alt/Az
OTAs: Celestron 8" Edge HD w/Celestron Focus Motor, Meade 80mm APO Triplet Refractor w/ZWO EAF
Cameras: ASI533MC Pro, ASI183MC Pro, ASI224MC, ASI120MC-S, ZWO ASI290MM
Raspberry Pi 4 with Stellarmate OS, MacBook Pro
5 months 3 days ago #82639

Please Log in or Create an account to join the conversation.

  • Posts: 380
  • Thank you received: 113

Replied by Doug S on topic New Focus Algorithm in Ekos

Hi Ron,

A couple thoughts for you. I like the approach, it has a BIG advantage over the current linear alg in that it doesn't "pull up short" which has previously been described by prior posts on the subject.

My only suggestion is to consider whether you want to make the same mistake Linear Alg made in the Mechanics tab. Picking an "Initial Step", and "Out Step Multiple" has created a lot of unnecessary confusion for folks. In reality, the "proper" way to define the step size and out step multiple is to calculate those parameters from other system info as it relates to CFZ. Knowing the focus drawtube screw pitch and motor scale would ensure the correct step-size is used. Alternatively, not knowing these parameters creates the conditions for step-size exceeding the CFZ (jumps over), or too small (wasting focus time). This is completely avoidable. You might want to consider at least having an option to calculate the step size, correlating to CFZ, motor scale, and focuser thread pitch size. See the following info which might help:

www.goldastro.com/goldfocus/ncfz.php

Cheers, and good luck, Doug S
RASA11, Celestron CGX-L, ASI183mc Pro, 60mm guider + ASI290mm mini, ASI EAF focuser, PPB, Rpi4-4Gb+SSD, Powered USB3 hub, hardwire Ethernet.
5 months 3 days ago #82642

Please Log in or Create an account to join the conversation.

  • Posts: 192
  • Thank you received: 13
Doug,

Thanks for the thoughts. I have read this article and find it interesting. I guess that I have used "trial and error" for my different scopes and focusers.

Like others, I find that the "one pass" does a pretty good job at finding the best focus. The second pass process, while theoretically valuable, does little to improve the focus. In fact, it usually was the cause of creating an error, aborting and restarting the process.

I'm looking forward to using John's new process!

Ron
Mounts: Sky-Watcher EQ6-R Pro, Meade LX85, Celestron NexStar Evolution Alt/Az
OTAs: Celestron 8" Edge HD w/Celestron Focus Motor, Meade 80mm APO Triplet Refractor w/ZWO EAF
Cameras: ASI533MC Pro, ASI183MC Pro, ASI224MC, ASI120MC-S, ZWO ASI290MM
Raspberry Pi 4 with Stellarmate OS, MacBook Pro
5 months 3 days ago #82644

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 33

Replied by John on topic New Focus Algorithm in Ekos

Thanks Ron, I'll take a look. I see you have a Celestron Focus Motor and ZWO EAF. Do you think both have this issue?
5 months 3 days ago #82645

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 33

Replied by John on topic New Focus Algorithm in Ekos

Thanks Doug, I'll take a look at this.
5 months 3 days ago #82646

Please Log in or Create an account to join the conversation.

Time to create page: 0.514 seconds