Does SGP talk to Planewave's PWI AutoFocus?

Hi Mike,

Just for record, I did not write the quadratic fitting routine, which was written by Jerry Macon. I participated in that effort with @bulrichl in that they used my AF logviewer to process a lot of SGP user logs to test out the quadratic routine.

Since then I have developed a hyperbolic routine for a “private” software project, so I can help out with the code if @Jared would like to go in this direction. The modifiations would be quite minor.

I completely agree that it would make sense to let the user chose between a quadratic and hyperbolic routine, as people with a working setup is less inclined to tinker with something that works for them.

Mikael

Mike,

Your comparison of SGP vs. ASTAP results I think shows that for that particular target the difference is not important, with your setup.

In my setup I have really only seen repetedely failed AF runs when imaging some globular clustars, as I think quite a few people have been pointing out on this forum. @han, do you think your star detection routine has any reason to work better on such targets ? As I remember you made some changes to the plate solving part of ASTAP for globular clusters, would that impact the HFD measurement ?

Personally I would be interested in testing out ASTAP focusing on such a “hard” target. I would test it myself, if my imaging gear was not in France, where the current lockdown situation is very strict!

@Kurious_George, @han

In fact, looks like PlateSolve2 focus analysis can be invoked through the command line. It was discussed and solved on this APT forum thread:

https://aptforum.com/phpbb/viewtopic.php?f=17&t=794

I tested it with KG’s images, and it worked as expected.
It would not allow a “live” focus analysis, as all the images would need to be taken before they can be analyses.

I don’t know if SGP can use this function without some kind of licence agreement…

Mikael

1 Like

Mikael,

I completely agree that it would make sense to let the user chose between a quadratic and*
hyperbolic routine,as people with a working setup is less inclined to tinker with something that works for them.*

For my APO the detected hyperbole fits perfectly up to HFD 30. Once you master the hyperbole math there is no need for any other curve. The wings are almost perfect linear lines (using HFD as input) and only a hyperbole will fit best. Some pioneers like Focusmax developers came to the same conclusion.

do you think your star detection routine has any reason to work better on such targets ? *
As I remember you made some changes to the plate solving part of ASTAP for globular clusters, would that impact the HFD measurement ?*

My problem was that Gaia database contained huge amount of global cluster stars and an Earth based telescope could not separate them due to the tiny distances <1arcsec. But the star detection works well around the global clusters.

In fact, looks like PlateSolve2 focus analysis can be invoked through the command line. It was discussed and solved on this APT forum thread:

Great then it is technical possible and easy to implement. If @Jared has permission and implements it you could try all star detection options and use the one which performs best for you making everybody happy.

Han

If you have Globular Cluster subs available the you can load these directly into ASTAP to get a feel for the detecions it is making.

I did this when the issue of GCs first came up on this thread and the results seemed very comparable to those obtained using more regular images.

Also Han kindly made a change to ASTAP to output a list of its star detections so as to facilitate more detailed analysis. Details elsewhere in this thread if I can only find the post!

Mike

PS: And unless @jared has made a change, I think the AF image and star detections displayed in SGP are still based on the pre-ASTAP star detection, so SGP star detection image is not an accurate display of the ASTAP star analysis.

The HFD values displayed in the image by SGP beta from 2 ? weeks ago are still based on the internal algorithm. So ASTAP is not fully integrated.

Easiest way to demonstrate the star detection is to use the ASTAP image inspector (ASTAP viewer, tools, image(CCD) inspector) on a global cluster image. The HFD value annotated should be pretty constant especially for out of focus images

I think you can do the same with PlateSolve2. It will also show the used stars for solving.

See for example:

1 Like

@Jared, cc @han, @mikaelA

Hi, I managed to get a short period of testing of v.643 HFD AF the other evening. Near full moon and rather hazy so not much use for anything else.

Overall, I managed 22 AF runs:

100% quality : 2
99% quality : 9
98% quality : 3
97% quality : 5

: the remaining 3 were naff due to passing clouds.

The focpos numbers were very consistent in my opinion, so generally a satisfying result.

When checking the results in the logfile however I noticed that the #stars detected when close to good focus were at a lower level to the numbers detected when at the extremities! Counter-intuitive to say the least.

I am guessing this effect is due to down-sampling of the image or an effect of the minimum star size parameter value. The ultimate FocPos calculation does not seem to have been unduly harmed but certainly not an effect I was expecting!

Also I observe that while the #stars detected at the curve extremities using HFD were generally higher that the HFR result, the level of difference seemed lower that what I was anticipating based on loading the as captured images direct into ASTAP. To my mind with parabolic fit of AF curve the star detections / measurements found at the extremities has a very significant impact on the final calculated focpos. I think a little further investigation is warranted.

Regards

Mike

PS Have you had any furter thoughts about a) incuding focpos etc in the AF images FITS header, and b) providing a hyperbolic curve fit? With regard to b), Han has obviously got the hyperbolic curve fit problem cracked so I am wondering if he would perhaps share some in-sight.

OK, to expand on the point I was aiming to make in the above post.

Here is a link to one of the AF Packs produced during my test session:

I am familiar with loading the FITS image files into ASTAP as illustrated below to get #star detections (i.e ranging from 19 to 180), an HFD measurement for each image, and finally a best focus focuser position (ie 5684) using hyperbolic curve fit, i.e.

Below are the corresponding SGP logfile records made during the course of this AF run:

FocPos 5800
[12/01/20 19:56:39.655][DEBUG][Main Thread][AF;] Star list contains 6 stars…
[12/01/20 19:56:39.655][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:56:41.088][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 4.68 with 10 stars
[12/01/20 19:56:41.099][INFO][Camera Thread][AF;] Incremental Fit Result (1): quality=%; a=0; b=0; c=0;

FocPos 5760
[12/01/20 19:56:52.120][DEBUG][Main Thread][AF;] Star list contains 24 stars…
[12/01/20 19:56:52.120][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:56:53.443][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 3.29 with 29 stars
[12/01/20 19:56:53.451][INFO][Camera Thread][AF;] Incremental Fit Result (2): quality=%; a=0; b=0; c=0;

FocPos 5720
[12/01/20 19:57:05.179][DEBUG][Main Thread][AF;] Star list contains 91 stars…
[12/01/20 19:57:05.179][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:57:06.410][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 2.30 with 58 stars
[12/01/20 19:57:06.419][INFO][Camera Thread][AF;] Incremental Fit Result (3): quality=%; a=0; b=0; c=0;

FocPos 5680
[12/01/20 19:57:17.092][DEBUG][Main Thread][AF;] Star list contains 76 stars…
[12/01/20 19:57:17.092][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:57:18.301][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 1.90 with 39 stars
[12/01/20 19:57:18.309][INFO][Camera Thread][AF;] Incremental Fit Result (4): quality=100%; a=154.687500000006; b=-1752.48750000007; c=4965.42950000019;

FocPos 5640
[12/01/20 19:57:29.167][DEBUG][Main Thread][AF;] Star list contains 82 stars…
[12/01/20 19:57:29.167][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:57:30.319][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 2.31 with 44 stars
[12/01/20 19:57:30.326][INFO][Camera Thread][AF;] Incremental Fit Result (5): quality=100%; a=187.053571428596;

FocPos 5600
[12/01/20 19:57:41.161][DEBUG][Main Thread][AF;] Star list contains 14 stars…
[12/01/20 19:57:41.161][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:57:42.351][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 3.38 with 10 stars
[12/01/20 19:57:42.360][INFO][Camera Thread][AF;] Incremental Fit Result (6): quality=100%; a=199.776785714333; b=-2270.42678571483; c=6452.72928571584;

FocPos 5580
[12/01/20 19:57:53.153][DEBUG][Main Thread][AF;] Star list contains 10 stars…
[12/01/20 19:57:53.153][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:57:54.337][DEBUG][Camera Thread][AF;] Auto focus HFD calculated at: 4.75 with 11 stars
[12/01/20 19:57:54.346][INFO][Camera Thread][AF;] Incremental Fit Result (7): quality=100%; a=191.369047619048; b=-2174.30952380952; c=6178.05857142857;

FocPos 5681 (Validation Frame)
[12/01/20 19:58:10.188][DEBUG][Main Thread][AF;] Star list contains 61 stars…
[12/01/20 19:58:10.188][DEBUG][Main Thread][AF;] Calculating HFR with sample size: 3
[12/01/20 19:58:11.398][DEBUG][Camera Thread][AF;] Auto focus validation frame HFD calculated at: 1.98 (N.B NO WITH #STARS?)
[12/01/20 19:58:11.402][INFO][Camera Thread][AF;] Auto focus is complete (5681; HFD 1.98)…

Conclusions

I was expecting the #star detections etc recorded in the SGP logfile to be very similar/identical to the ASTAP analysis made using the same image files, but the results (10-61 #stars) are about 50% less than the ASTAP analysis. This is particularly noticeable for the analysis of the AF image at focuser position 5680 (39 stars identified versus 112 on the ASTAP screenshot). I assume that this is due to some downsizing of the image prior to analysis in the SGP run leading, I guess, to some of the smallest stars being eliminated as hot pixels!!

Overall in this AF run, this difference in approach has not made a great deal of difference to the final recommended best focus position, i.e.

ASTAP analysis of original 2x2 binned FITS files using hyperblic curve fit, recommende focpos 5684

SGP/ASTAP HFD analysis of down sampled FITS images using parabolic fit, recommended focpos 5681.

I estimate that my one step on my focuser is circa 1.25 microns, so well within even a tight definition of CFZ.

Going Forward

Does anyone else have a view on this?

Does anyone have better handle on the pros and cons of the AF image downsampling (assuming I am correct in this?).

Hello Mike,

If the sky is clear the number of star detections decreases the further your away from focus.

The images where taken while clouds where passing by and the number of detected stars where highly influenced by the clouds. The background value varies between 1206 and 1688. See screenshot below. The stars where simple getting fainter due to the clouds and faintest stars became undetectable. You can see it when you blink through the images. The slope between left and right side is changing. This doesn’t influence the focusing as long it detects one or more star.

Down sampling doesn’t effect the measurement as long the star is illuminating a few pixels at focus and the HFD is about 1.5 or higher.

For SGP I would set the priority to improve the star detection. The curve fitting is working well and best if you stay close to the focus.

I haven’t got any feedback back from PlaneWave about Platesolve2 but since we now this is technical feasible it is up the SGP team pick this or take an other route.

Han

See the background values:
]

1 Like

I agree. This was not a night for serious imaging but to my mind SGP AF with ASTAP metrics is now giving very consistent results in very marginal conditions so hopefully it will be almost bullet-proof when conditions are good. Also I think other SGP users will see a noticeable improvement when they try to focus with RGB and NB filters. In the past when I was trying to calculate for example filter offsets I found I was gettng widely dispersed results even when temperature was stable.

That is good to know. However that still leaves me wondering why the ASTAP metrics (#stars and HFD) are different when I manually load an AF image into ASTAP compared with the metrics reported in the SGP logfile immediately following capture of the same image? I don’t think I have made a mistake here and the discrepancies in the results are frequent and consistent. BUT having said this, the discrepancy does not seem to have significantly downgraded the AF results. I would just like to understand the reason for the differences. Is there any difference in ASTAP’s processing of images loaded by an API call versus manual loading?

I looked at the APT forum post above and it seems to me that the approach adopted by PWI AF is essentially the same as that being recommended with SGP AF. Unless PW have an undisclosed secret method in their AF implemetation I cannot see how their method should lead to a significantly different AF position when presented with the same AF image set.

As above I am currently unconvinced the PWI AF would give a majorly different result compared with a well written parallel implementation of the same analysis method. However it would be nice to get some decent data to settle the debate. I am wondering whether if I was to rename the image files in some of my AF image packs to match the PWI standard then if @Kurious_George or @Ross_Walker could possibly input these images to PWI3 to see what if any differences there are?

And of course it is for the Devs ultimately to decide whether or not to add a PWI3 method.

From what I have seen and read in the course of this discussion I am now reasonably convinced that the discrepancy in the AF result obtained using SGP+HFR compared with SGP+ASTAP HFD is likely almost entirely due to the sensitivity/accuracy of the relevant star detection and measurement routines. The SGP Devs could no doubt address this if they so wished but meantime I am very happy with the SGP/ASTAP method.

But that is not to say I am closed to the idea of further small improvements such as hyperbolic fit option!

Regards

Mike

If you bin2x2 the measured HFD values will be about half compared with unbinned vakues. At small HFD values (<=2) the HFD value will increase due to lower sampling and rounding, so I would expect that the binned HFD values be a little higher then half of the original values.

Processing the images should be the same for the command line and in the program itself. In the latest versions for HFD measurment ASTAP ignores saturated stars. If you find a significant difference between the command line results and in the program result tell me where so I can have a look.

Hyperbolic curve fitting will improve the result. The linear V-wings will fit perfectly with the hyperbolic curve, making is less susceptible to outliers.

Han

@jared cc @han

I’ve rechecked the SGP log for the period covering the capture and analysis of AF Pack 2-9, as loaded into the ASTAP screen-shot pictured above at post 141.

I am certain that the #stars and HFD values listed in the log do not correspond to those shown in the screen-shot.

I can currently think of two possible reasons for this:

  1. On the Auto-Focus Options screen I have Crop AF frames by 5%. Maybe SGP is cropping the frame before passing it to ASTAP, rather than the full-frame as loaded in the screen-shot.

  2. Maybe as a result of the AF parameter Min Star Size at 1x1, SGP is discarding some of the star detections I assume would be reported by ASTAP. In the SGP log it shows: Calculating HFR with sample size: 3. I have previously wondered about the relevance of this parameter with the ASTAP option.

It would be nice if Jared could provide the Devs assessment on this.

Mike

Hello Mike,

The ASTAP inspector tab was detecting all stars with an SNR>10. This is now adapted to the viewer CCD inspector and command line setting SNR>30. Stars with an SNR between 10 and 30 are less reliable for HFD measurement. The results should be now the same. The SNR minimum value can be set in the command line but is default 30. Could be used within SGP.

ASTAP version 0.9.459b:
http://www.hnsky.org/astap_setup.exe

The SGP screen HFR values are from the internal routine. The csv file output containing all HFD measurements from ASTAP is not used by SGP version 3.651

Han

Hi Han,

Thanks for identifying the probable cause of the #stars discrepancy. According to the current forecast I may get a short period of clear sky this evening to do some more testing with .651 release. I am perhaps lucky but I have managed to download, install and connect to all my gear using both 32- and 64-bit versions. And I have downloaded your latest 0.9.459b release.

FWIW I have seen a couple of favourable comments (and none negative) wrt AF improvements using ASTAP as metrics provider so hopefully many other users will see improvement in the longer term.

As you say, current SGP release is still showing old SGP AF star detections and HFRs even when ASTAP is selected as the AF metrics provider. As this is a Beta release (and being aware of the issue) I don’t have a problem with this BUT longer term I think it would be better to have SGP correctly display ASTAP HFD detections when ASTAP is selected and SGP HFR detections otherwise.

Would ASTAP need to have capability to output an annotated image file (or star detection coordinates) for SGP to display when called from the command line, to facilitate this display?

Mike

1 Like

SGP has

SGP has just to execute ASTAP with -extract option and the CSV output file contains the HFD X, Y for each detected star. You can also specify the minumum SNR value. So

ASTAP -f image.fits -extract

or to decrease the detection sensitivity from SNR>30 to SNR>10

ASTAP -f image.fits -extract 10

The output file will be image.csv. Can be read by any text editor or spreadsheet program. The median HFD is in the exit code but that is already implemented.

Han

1 Like

Hi folks,

Here’s a new test file with PWI3 results…

https://spaces.hightail.com/receive/yE2rsMPzn5/dXMtMmZjMDc5NTgtYzY5Zi00YWFhLTkxY2YtZTAyOGI0MzllMGM1

KG

FocusSampleGraph.JPG

…and the PWI3 graph…

FocusSampleGraph

Hello KG,

Nice test images. ASTAP calculates focus at 5925 compared with 5958.7 for plateSolve2.
There is a discrepancy between image 5039 and 5389.

Han


spreadsheet. Pink is the Hyperbola curvefit

This looks good. If we can get this working in SGP I can run more rigorous tests possibly this month and in January.