OpenPHDGuiding / phd2

PHD2 Guiding
https://openphdguiding.org
BSD 3-Clause "New" or "Revised" License
245 stars 111 forks source link

find_star method from event server have lower performances than its UI counterpart #1088

Closed gnthibault closed 1 month ago

gnthibault commented 1 year ago

To whom it may concern. I have been playing with the event server for quite some time now, but still experiencing issues with robust star selection method. Basically I know where is the star I want to guide one (as part of a spectroscopic workflow), and I send a find_star command to the event server, which is documented here: https://github.com/OpenPHDGuiding/phd2/wiki/EventMonitoring#available-methods

The signature seems to be: find_star(x,y,width,height) Which I use with x, y being the leftmost, lowermost coordinates (in sensor coordinate system) of my bounding box (usually 50 pixels), and widht, height the respective size in pixel of the desired search bounding box.

Unofrtunately this method seems extremely inconsistent, end more importantly, it is much less robust that the autoselection that works perfectly in the UI, which I am testing quite often at the same time that I try to debug the actual event server method.

Unfortuantely the code is a bit cryptic to me, but in practice it seems that event server method is completely different from the UI method where you just have to click somewhere neat your star for it to be detected properly. Can someone help me understand how to reach the same performances of detection fro m event server, as what is provided from the UI ?

I enclosed also the fits file from the log directory upon find_star failure: AutoSelectFail_2023-07-23_161042.zip

An example of corresponding logs in the log files looks like this:

17:15:49.619 00.000 139638540197120 Star::AutoFind called with edgeAllowance = 0 searchRegion = 50 roi = 50x50@555,375
17:15:49.620 00.001 139638540197120 AutoFind: using ROI 50x50@555,375
17:15:49.627 00.007 139638540197120 AutoFind: auto downsample for scale 1.99 => 1x
17:15:49.714 00.087 139638540197120 AutoFind: global mean = -0.0, stdev 148.4
17:15:49.714 00.000 139638540197120 AutoFind: using threshold = 0.1
17:15:49.719 00.005 139638540197120 AutoFind: local max [581, 409] 302.6
17:15:49.719 00.000 139638540197120 AutoFind: local max [598, 412] 119.1
17:15:49.719 00.000 139638540197120 AutoFind: local max [569, 423] 0.9
17:15:49.719 00.000 139638540197120 AutoFind: local max [568, 423] 0.6
17:15:49.719 00.000 139638540197120 AutoFind: local max [603, 396] 0.5
17:15:49.719 00.000 139638540197120 AutoFind: local max [567, 423] 0.3
17:15:49.719 00.000 139638540197120 AutoFind: local max [603, 395] 0.2
17:15:49.719 00.000 139638540197120 AutoFind: local max [566, 423] 0.2
17:15:49.719 00.000 139638540197120 AutoFind: local max [603, 394] 0.1
17:15:49.719 00.000 139638540197120 AutoFind: local max [565, 423] 0.1
17:15:49.720 00.001 139638540197120 AutoFind: merge [565, 423] 0.1 - [566, 423] 0.2
17:15:49.720 00.000 139638540197120 AutoFind: merge [603, 394] 0.1 - [603, 395] 0.2
17:15:49.720 00.000 139638540197120 AutoFind: merge [566, 423] 0.2 - [567, 423] 0.3
17:15:49.720 00.000 139638540197120 AutoFind: merge [603, 395] 0.2 - [603, 396] 0.5
17:15:49.720 00.000 139638540197120 AutoFind: merge [567, 423] 0.3 - [568, 423] 0.6
17:15:49.720 00.000 139638540197120 AutoFind: merge [568, 423] 0.6 - [569, 423] 0.9
17:15:49.720 00.000 139638540197120 AutoFind: too close [603, 396] 0.5 - [569, 423] 0.9
17:15:49.720 00.000 139638540197120 AutoFind: close dim-bright [603, 396] 0.5 - [598, 412] 119.1
17:15:49.720 00.000 139638540197120 AutoFind: close dim-bright [603, 396] 0.5 - [581, 409] 302.6
17:15:49.720 00.000 139638540197120 AutoFind: close dim-bright [569, 423] 0.9 - [598, 412] 119.1
17:15:49.720 00.000 139638540197120 AutoFind: close dim-bright [569, 423] 0.9 - [581, 409] 302.6
17:15:49.720 00.000 139638540197120 AutoFind: too close [598, 412] 119.1 - [581, 409] 302.6
17:15:49.720 00.000 139638540197120 AutoFind: BPP = 16, saturation at 65535, pedestal 0, thresh = 58981
17:15:49.720 00.000 139638540197120 AutoFind: finding best star pass 1
17:15:49.720 00.000 139638540197120 AutoFind: could not find a star on Pass 1
17:15:49.720 00.000 139638540197120 AutoFind: finding best star pass 2
17:15:49.720 00.000 139638540197120 AutoFind: could not find a non-saturated star!
17:15:49.720 00.000 139638540197120 AutoFind: finding best star pass 3
17:15:49.720 00.000 139638540197120 AutoFind: no star found
17:15:49.721 00.001 139638540197120 Error thrown from /home/gnthibault/projects/phd2/guider_multistar.cpp:476->Unable to AutoFind
17:15:49.721 00.000 139638540197120 GuiderMultiStar::AutoSelect failed.
17:15:49.721 00.000 139638540197120 ImgLogger: saving auto-select image AutoSelectFail_2023-07-23_171545.fit

In the logs up above, the first local max, ie [581, 409] was exactly the one I was looking f Unfortunately, it seems that this detection is discarded because of the following reason:

too close [598, 412] 119.1 - [581, 409] 302.6 I am not sure eventually why in the UI when clicking next to this star on the picture, the detection works juste fine.

EDIT: I went in the log later on a slightly different setup, and here are the corresponding logs I see:

17:47:53.775 00.000 139775131020544 Star::Find(50, 976, 555, 0, (0,0,0,0), 0.1, 20.0, 0) frame 15
17:47:53.775 00.000 139775131020544 Star::Find returns 1 (0), X=976.00, Y=557.00, Mass=852102, SNR=636.1, Peak=18302 HFD=6.3

It seems that Star::Find is a different function, and this time, it finds the star perfectly... Now my question, is how I get to use this one. I will check if I can work this out on my own fork. Thanks in advance for your help

EDIT2: Ok it seems that I can get to use at least partly the same method (Star::find) by removing multistar mode in advanced setting pane: no_use_multi_star

EDIT3: Unfortunately, I realized my EDIT2 was wrong... PHD2 is still using Autofind with the same error I have shown earlier. I is still very weird that in the logs I find instances of case where there seems to be a mix of Star::Find and AutoFind, such as in here:

18:07:51.112 00.000 140483913575680 Star::AutoFind called with edgeAllowance = 0 searchRegion = 50 roi = 50x50@555,375 18:07:51.113 00.001 140483913575680 AutoFind: using ROI 50x50@555,375 18:07:51.118 00.005 140483913575680 AutoFind: auto downsample for scale 1.99 => 1x 18:07:51.192 00.074 140483913575680 AutoFind: global mean = 0.0, stdev 148.2 18:07:51.192 00.000 140483913575680 AutoFind: using threshold = 0.1 18:07:51.198 00.006 140483913575680 AutoFind: local max [581, 400] 302.6 18:07:51.198 00.000 140483913575680 AutoFind: local max [598, 402] 119.1 18:07:51.198 00.000 140483913575680 AutoFind: local max [603, 386] 0.5 18:07:51.198 00.000 140483913575680 AutoFind: local max [603, 385] 0.2 18:07:51.198 00.000 140483913575680 AutoFind: local max [603, 384] 0.1 18:07:51.198 00.000 140483913575680 AutoFind: merge [603, 384] 0.1 - [603, 385] 0.2 18:07:51.198 00.000 140483913575680 AutoFind: merge [603, 385] 0.2 - [603, 386] 0.5 18:07:51.198 00.000 140483913575680 AutoFind: close dim-bright [603, 386] 0.5 - [598, 402] 119.1 18:07:51.198 00.000 140483913575680 AutoFind: close dim-bright [603, 386] 0.5 - [581, 400] 302.6 18:07:51.198 00.000 140483913575680 AutoFind: too close [598, 402] 119.1 - [581, 400] 302.6 18:07:51.198 00.000 140483913575680 AutoFind: BPP = 16, saturation at 0, pedestal 0, thresh = 0 18:07:51.198 00.000 140483913575680 Star::Find(50, 603, 386, 0, (0,0,0,0), 0.1, 20.0, 0) frame 1 18:07:51.198 00.000 140483913575680 Star::Find returns 1 (0), X=581.00, Y=400.00, Mass=798586, SNR=610.2, Peak=17167 HFD=6.3 18:07:51.198 00.000 140483913575680 AutoFind: finding best star pass 1 18:07:51.198 00.000 140483913575680 Star::Find(50, 603, 386, 0, (0,0,0,0), 0.1, 20.0, 0) frame 1 18:07:51.198 00.000 140483913575680 Star::Find returns 1 (0), X=581.00, Y=400.00, Mass=798586, SNR=610.2, Peak=17167 HFD=6.3 18:07:51.198 00.000 140483913575680 AutoFind: near-saturated [603, 386] 0.5 Mass 798586 SNR 610.2 Peak 17167 18:07:51.198 00.000 140483913575680 AutoFind: could not find a star on Pass 1 18:07:51.198 00.000 140483913575680 AutoFind: finding best star pass 2 18:07:51.198 00.000 140483913575680 Star::Find(50, 603, 386, 0, (0,0,0,0), 0.1, 20.0, 0) frame 1 18:07:51.198 00.000 140483913575680 Star::Find returns 1 (0), X=581.00, Y=400.00, Mass=798586, SNR=610.2, Peak=17167 HFD=6.3 18:07:51.198 00.000 140483913575680 AutoFind returns star at [603, 386] 0.5 Mass 798586 SNR 610.2 18:07:51.200 00.002 140483913575680 Star::Find(50, 603, 386, 0, (0,0,0,0), 0.1, 20.0, 0) frame 1 18:07:51.200 00.000 140483913575680 Star::Find returns 1 (0), X=581.00, Y=400.00, Mass=798586, SNR=610.2, Peak=17167 HFD=6.3 18:07:51.200 00.000 140483913575680 MultiStar: List (1): {581.00, 400.00}(610.2), 18:07:51.200 00.000 140483913575680 setting lock position to (581.00, 400.00) 18:07:51.200 00.000 140483913575680 AutoSelect: state = 1, call UpdateGuideState 18:07:51.200 00.000 140483913575680 UpdateGuideState(): m_state=1 18:07:51.200 00.000 140483913575680 Star::Find(50, 581, 400, 0, (0,0,0,0), 0.1, 20.0, 0) frame 1 18:07:51.200 00.000 140483913575680 Star::Find returns 1 (0), X=581.00, Y=400.00, Mass=798586, SNR=610.2, Peak=17167 HFD=6.3

Thank you in advance for your help

Best regards

gnthibault commented 1 year ago

Ok I confirm it seems that this dummy commit fully fixes the issue I am experiencing (but that's not likely what the project wants): https://github.com/gnthibault/phd2/commit/4691361d5a48cff3bc5af755c41c97aa9b220267

Not doing a PR at the moment because it wouldn't make sense as is. But I'll be interested in getting feedback about how to improve that to make a PR that would go through.

Thank you in advance for your help

bwdev01 commented 1 year ago

I don’t think you’ve given us enough information to work with here – just comments about inconsistency and lack of robustness in general terms which I don’t know how to interpret. I think you should run a series of back-to-back comparisons of the interactive and event-server driven find operations on the same stars. Note the times you did each pair, then submit the debug log file for that session, telling us the timestamps of interest and what results you are unhappy about. Also, please move the discussion to our support forum and upload the full debug log file using the built-in PHD2 Upload Logs feature:

https://openphdguiding.org/getting-help/

If you look at the debug log file yourself, you may discover there are unintended differences between the two operations, e.g. the spatial region that is actually being searched.

Regards,

Bruce

From: gnthibault @.> Sent: Sunday, July 23, 2023 7:08 AM To: OpenPHDGuiding/phd2 @.> Cc: Subscribed @.***> Subject: [OpenPHDGuiding/phd2] find_star method from event server have lower performances than its UI counterpart (Issue #1088)

To whom it may concern. I have been playing with the event server for quite some time now, but still experiencing issues with robust star selection method. Basically I know where is the star I want to guide one (as part of a spectroscopic workflow), and I send a find_star command to the event server, which is documented here: https://github.com/OpenPHDGuiding/phd2/wiki/EventMonitoring#available-methods

The signature seems to be: find_star(x,y,width,height) Which I use with x, y being the leftmost, lowermost coordinates (in sensor coordinate system) of my bounding box (usually 50 pixels), and widht, height the respective size in pixel of the desired search bounding box.

Unofrtunately this method seems extremely inconsistent, end more importantly, it is much less robust that the autoselection that works perfectly in the UI, which I am testing quite often at the same time that I try to debug the actual event server method.

Unfortuantely the code is a bit cryptic to me, but in practice it seems that event server method is completely different from the UI method where you just have to click somewhere neat your star for it to be detected properly. Can someone help me understand how to reach the same performances of detection from event server, as what is provided from the UI ?

Thank you in advance for your help Best regards

— Reply to this email directly, view it on GitHub https://github.com/OpenPHDGuiding/phd2/issues/1088 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDHSV2ZGFOGW6JD4AYE6H3XRUV3NANCNFSM6AAAAAA2URIACU . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/ADDHSV3TD7AZFKTEUMI6O6TXRUV3NA5CNFSM6AAAAAA2URIACWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHGYT3FBI.gif Message ID: @. @.> >

bwdev01 commented 4 months ago

Unless we get raw log data that clearly demonstrates the problem, I plan to close this.