Does SGP talk to Planewave's PWI AutoFocus?

@Kurious_George,
Hi,

If understood your files correctly, PWI13 has given a result of 8969.2.

I guess you do not know what position current SGP would have given with these results but uploadng and analysing the image files with ASTAP’s Hyperbolic curve fitting gives a best focus position over the whole image of 8955 or 8985 for the centre region, see attached screen shot.

Mike

That’s good Mike. Now if some of those “donuts” were slightly fatter because they were actually a small galaxy, nebula or double star, would they have been ignored? That’s the problem I’ve been seeing.

KG

Interesting discussion here.

I did my own hyperbolic fitting of the data ASTAP outputs in your screen shot Mike, I took the hfd column which I assume is the full image HFD values(?). I got a very nice fit, the data is excellent, with a fitted min position of 8974. This is slightly different than the 8955 ASTAP fitted. You need to keep one thing in mind when you compare outputs of hyperbolic fitting. This is a so-called non-linear fitting problem, as opposed to a quadratic (parabola) fitting which is linear. Non-linear fitting problems are inherently none deterministic, meaning the estimated parameters will vary depending on the initial guesses one makes of those parameters, and the particular alhorithm that one uses. Two numerical fitting packages will generally output different results, given the same data.

I totally support going for hyperbolic fitting in SGP. I have already proposed to Ken and Jared to help them with the math, because there is a neat mathematical trick one can do to cast the problem into a quadratic fitting problem, and that code is already in place in SGP. It would be a very minor modification of the code Jerry wrote.

Mikael

image

1 Like

I would dearly love to say unequivocally that your concerns are unfounded but can you upload some AF images that you think might be problematic?

I’m not entirely sure about unresolved double stars but aside from these I’m doubtful that the type of detections you mention would likely happen in sufficient numbers to materially change the median HFR/HFD.

From eg Wikipedia I understand that approx 50% of visible stars are in fact doubles or multiple star systems . But for these to significant influence the AF curve it seems to me they would need to go through an (asymetric?) transformation unresolved - resolved - unresolved as the scope moves into and out of focus.

However to try to definitively answer your question, Han (see post 66) has kindly provided an option to output a list of values for the star detections made by ASTAP? I suggest ideally we need to show that a) unsuitable detections are occurring and b) these ‘false’ detections are causing the median hfd / hyperbolic curve to be majorly deformed.

Alternatively, as I’ve mentioned already, it seems to me (intellectually at least) to be not overly difficult to use a star catalogue to generate a star mask so as to hide potentially problematic objects from a plate-solved AF image. Sadly I doubt that I have the skills personally to take this idea forward.

Mike

Hi Mikael,

I much appreciate your interest.

I’ve subsequently noticed in my earlier spreadsheet that I had (I think twice) wrongly entered a different hfd value to the full image hfd. I can upload the corrected version if you wish but I doubt the corrections are material to the overall debate.

Of the comments I seen on the AF curve question the consensus seems to be that hyperbolic fit is the better approach. If the change is straightforward and Jared and Jerry are comfortable I see no reason not to proceed.

I’ve noticed that I was seeing different hfd values from different hfd calulations using ostensibly the same image data but had assumed this was due to marginally different hfd measurements taken from the original images.

Out of my comfort zone but I’ve read somewhere that the general hyperbolic curve function:

   y=mx / (k+x) 

: can be rearranged to an equivalent linear form that is readily solved. I had assumed that using the linear transformation could be used to iterate to a definitive result.

I assume that a required initial guestimate could be simply interpolated from say the three lowest hfd values / focusser steps?

I accept your assertion that there are mathematical tricks to ensure a robust result!

Mike

Original issue discussed and illustrated here in detail…

https://forum.sequencegeneratorpro.com/t/bullet-proof-auto-focus-with-platesolving/11834

I started this thread to see if we could interface with PWI3 to help resolve the original issue.

IMHO, we don’t have a curve fitting issue. The issue is not rejecting outliers mostly caused by double stars and small galaxies.

KG

Double stars can be separated or excluded if the detected combined star image is too oval.
Galaxies are normally in the minority and will have a very minor influence as long the median value is calculated. Elongated galaxies can be filtered out due to ovality. But excluding ovality can be counterproductive if tested too strict.

As long the majority of stars is good, the median HFD will give a good representative value.

I have the impression that for small (star) diameters in the image, the SGP star detection has a too large variation/spread in the measured HFD value then what technically is possible. As a result for a small set of stars, the calculated median HFD value will be less accurate.

Han

An other possibility would be to apply a sigma clip routine on the measured HFD values for each image. So you calculate the median or mean of the values and the standard deviation. Then remove outliers (double stars, galaxies) above 3 or 2.5 time standard deviation and with the remaining HFD values you calculate again the median or mean again and the standard deviation to repeat the same outlier filtering till the median/mean is stable.

I think in general the mean value will be less noisy, so it could be superior to median as long you have enough measurements. But the median has the beauty it still works well for three two or one measurement. For three measured values with one severely wrong it still will give a good value.

The practical problem is that the number of star detection’s in the wings of the V-curve can be small or even a single detection. Then you can’t apply statistics and you have to fall back to something more simple.

Statistics can help but it is more important to have a good HFD measurement.

Han

There is no doubt that accurate HFR/HFD calculations are important to producing an accurate auto focus result. However, In all this pursuit of precision focusing, let’s not overlook the issue of “depth of field.” There is no such thing as a single focuser position that represents best focus. There are many ways to calculate the DOF for an optical system. There are some that are specific to CCD sensors, which yield the smallest DOF values. For my f/6 (1830mm) system, the seeing limited DOF is about 100 microns. My focuser has 0.1 micron steps, so for my system, the DOF is +/- 500 steps! Positioning the focuser anywhere in that range will produce an image that is focused as well as possible. Something to keep in mind when debating the value of various curve fitting routines.

Charlie

This sigma clip logic may be a good alternative to a platesolving solution.

The weather forecast for tonight is currently showing clear skies though with a 98% moon, wind-speed of 15-20mph and jet-stream directly overhead, not good for imaging but hopefully good enough for some focusing tests.

My plan is to use GoldFocus (http://www.goldastro.com/) to obtain a near pin-point focus position for each of my LRGB&Ha filters, then to cycle through each of my filters with SGP and to record an AFPack and 60 second image for each. Hopefully weather conditions will hold out long enough to repeat this cycle at least twice.

Scope: 80/480 f/6
CCD: SV814M with 3.69 x 3.69 micron pixels
Focuser: c6000 steps per inch, equivalent to 4.2 microns per step.
SGP: v4.0.0.617
ASTAP: v0.9.444

For those not familiar with GoldFocus, it claims to be one of the most accurate focus aids around. It utilises a modified Bhatinov mask to capture and analyse an image as below.

I’m not sure that tonight’s conditions will permit getting to an accuracy of 0.3 pixel but at this level the GoldFocus calculator (GoldFocus - Calculator) indicates that with my scope and seeing of 3.0 arc-sec, I should be within 0.1 per cent margin of ideal focus, equivalent to a CFZ of 5.4 microns.

For the record, I normally use GoldFocus only occasionally in order to accurately measure my filter off-sets. Having gone to this level of effort however I feel it would be nice if SGP autofocus could regularly get to within 10-15 microns margin of error with L filter even if this is a rather spurious level of accuracy (ie trading accuracy of GoldFocus for speed and convenience of SGP AF).

OK, here are some results from yesterday evening’s AF session.

As expected, conditions were not ideal: near full moon, wind gusting but my site somewhat sheltered, and seeing likely impacted by strong jet stream winds, But notwithstanding some thin haze I was able to work continuously from c19:00 to 01:00. Luckily ambient temperature held reasonably stable for much of the period.

My first exercise was to use GoldFocus to establish what the package describes as ‘Near Perfect Focus’ for each of my filters. I managed 5 results for L (one of which I discarded as it seemed aberrant), 2 each for RGB, but only one for Ha. The results were very close for each filter (apart from the one L).

A problem with GoldFocus (I think) is it tells you when focus is good/near perfect) but does not output the actual Focuser Position or the temperature, so had to keep running out to read the LED display on my Lakeside!

When my second attempt at Ha focus with GF failed I switched over to SGP. Overall, I managed some 40+ AF runs using a sequence L, R, G, L, B, Ha). Each AF run was followed by a single 60s 1x1 exposure.

Despite the iffy conditions, no AF runs failed until the sky was completely filled with small fluffy clouds. SGP even managed to complete AF runs even when PHD was losing its guide star?

I have summarised the AF results in the attached spread-sheet. The results are sorted by Filter.

To make the results as consistent as possible for comparison I:
a) Use SGP AF Log Viewer to determine the Temperature Correction Coefficient (TCC) for each filter,
b) used the TCC to calculate a ‘near perfect FocPos’ appropriate to the Temperature and Filter used in each AF run.
c) calulated the variance between the AF actual FocPos and the Temp Corrected GF ‘Near Perfect’ Foc Pos.

What I obeserve is:

a) The variance results for L are undoubledly the least and most consistent- most encouraging.
b) In order of least to greatest variance the results by filter are: Red, Green. Ha, Blue.
c) While the Ha and Blue results show the greatest variance from the extrapolated GF NPF, the variance within each set of filter results is actually not so great which suggests to me that either
i) my baseline GF NPF is incorrect (only one value for Ha)
ii) owing to the limited temperature delta, there is a strong possibility of error in the Temp Correction Coefficient.

Conclusion: So far I am favourably impressed with the ASTAP based AF. Not a single AF run failed and this near full moon and unfavourable weather conditions. The ability to continue AF when PHD had about given up was most impressive.

Attachments:
a) SGP logfile
https://www.dropbox.com/s/f4h0ct8rz263514/sg_logfile_20201102184706.log?dl=0

b) Excel Results worksheet

c) Managed a result even with images like these

@Jared :
I noticed what looks to me like an odd oscillation on the Image History graphic. It only seemed to appear on chart for Lum filter.

Mike,

Impressive and thoroughly investigation. The most important indicator HFR seems pretty stable.

The temperature coefficient could suffer from delayed cooling down of the materials and be complex. The trend is one way so that is good. Using your data I have put the L focus position against the temperature and a second order polynomial trend line fits nicely. The main factor is 21.7 focuser steps per degree Celsius. The spread around the polynomial fit is small.

Han

The image history is still using the internal calculation. Literally the only metric changed over was the one used for Auto Focus. Even the Image Statistics and the highlighting of the stars seen in the image behind the graph is using the SGP metric.

Jared

@Jared

Hi, Please ignore my comment about the Image History. I notice I had an alternating mix of 10s and 60s exposures. Fewer stars detected in 10s exposures.

Mike

Mike, I had look again to your images AFID-49_1. Using the ASTAP image inspector I see it detects about four pair double stars as single stars. It doesn’t influence the end result since there are enough single stars detected. But I had a look again in my code why.

In the past ovality measurement was used to exclude double stars and galaxies. It is still used for a focus routine I helped to write, but for ASTAP the main intend is solving and the ovality measurement was abandoned for an other approach. Now It detects if 2/9 of the boxed object has illuminated pixels. In general this worked better for solving especially for images with poorly shaped stars. Maybe this has an effect on telescopes with a large obstruction displaying defocused ring shaped star patterns, but I don’t expect so.

Han

@Han,
,
First thanks for your endorsement of the approach. I am still most impressed with the result obtained with the Lum filter. @mikael I am most curious to see what the SGP values might result from a well chosen hyperbolic fit. I will save the AF packs in case they are of value for testing.

I am now somewhat annoyed with myself for not persisting to obtain more GF results with RGB&Ha filters to average as I observe that a small change to the GF NPF values is sufficient to get the predicted FocPos as closely aligned to SGP results as obtained for Lum result. With Lum the average departure from the predicted Near Perfect is <3 which with my set up is less that 12 micron!

After each focus run I took a 1x1 binned image. Loading these images into ASTAP and APP I observe that there is a very low spread in the calculated HFD/HFR values. I’ve not done the maths but I think the std var for these images would be significantly lower than for a similar bunch of images captured after the old SGP focus method.

I am so far very convinced that the ASTAP method is:
a) more resilient than current existing SGP - no failed AF runs despite poor conditions, especially towards the finish.
b) More consistent - much closer bunching of the HFR values around the best obtained when image stacking.

@Kurious_George, @Ross_Walker ,

Hoping you guys will be able to test this change with your scopes quite soon.

Mike

Hi folks,

Here’s new focus data from a Planewave CDK24 to test with. This likely contains objects that would skew the SGP algorithm, although I didn’t verify that…

https://spaces.hightail.com/receive/HoVC2bACZe/Y3VyaW91c2dtb25rQGdtYWlsLmNvbQ==

KG

Looks all good in ASTAP. Unfortunate the focus position and RA,DEC position are missing in the FITS header. For the focus position I assumed linear steps of 100 between 1000 and 1700. Then the focus is found in the inspector tab at position 1332. The curve is a little asymmetrical but when I manually use the wings (green lines) I come to a little higher focus position. Probably a little larger steps will give a more reliable result.

The galaxies don’t spoil the detection. As you can see the 5 yellow marked values (center and corners) and the square rectangle in the last two screen shots show no real tilt in the detection.

Han
ASTAP inspector tab

ASTAP inspector result copied to a spreadsheet:
focus2

Hyperbolic curve fitting using the hyperbolic parameters from the ASTAP inspector tab and the green lines for a manual estimate of the best focus position.

ASTAP CCD inspector and Hyperleda annotation near focus:

Most out of focus position

@han,
Hi,

Thanks for your analysis - more comprehensive to what I could manage with Excel.

I think the FocPos is indicated by the File name with step size of 350. Looking at the results file I assume PWI / PI has given the near perfect focpos as 5689.

@jmacon

I guess we need someone with access to run SGPs parabolic/hyperbolic curve fit to determine a new SGP result for comparison with KG’s ‘gold standard’ result!

Mike