1 of 38

HOCUS FOCUS

George Hilios

NEAIC, Suffern NY

April 14, 2023

The Science of Star Measurement for

Auto-Focusing and Tilt Correction

2 of 38

Familiar Situation?

SCIENCE OF STAR MEASUREMENT

2

4/14/2023

3 of 38

Hocus Focus

  • Optimize performance for amateur astronomy
    • Pinpoint focus
    • Fast: Minimize image acquisition impact
    • Sophisticated: Fine tune back-focus and tilt
  • Promote scientific discourse and discovery
    • No ivory towers: test theories with data
  • Transparent algorithms
    • No magic parameters!
    • Fully open source (MPLv2)

SCIENCE OF STAR MEASUREMENT

3

4/14/2023

4 of 38

About Myself

SCIENCE OF STAR MEASUREMENT

4

4/14/2023

5 of 38

NINA Contributions

  • Dome support, including scope synchronization
  • Center after Drift
  • MetaGuide integration
  • SBIG CCD native support
  • Plugins
    • Orbitals: tracking and imaging comets, asteroids, planets
    • 10u Tools: building models for 10 micron mounts
    • Hocus Focus: Auto focus, PSF measurement, aberration inspection

SCIENCE OF STAR MEASUREMENT

5

4/14/2023

6 of 38

AGENDA

Scientific Workbench

Star Measurement

Finding Optimal Focus

Tilt and Backfocus

Future Work

SCIENCE OF STAR MEASUREMENT

6

4/24/2023

7 of 38

SCIENTIFIC WORKBENCH

Collect the right tools to iterate on new methods

8 of 38

SCIENCE OF STAR MEASUREMENT

8

4/14/2023

  • View measurements per star
  • No magic knobs, all parameters configurable
  • Re-analyze with different approaches
  • Visual inspection of each step of the process

9 of 38

Star Annotation

9

10 of 38

Star Rejection

10

11 of 38

Tunable Parameters

11

12 of 38

Test and Iterate

12

13 of 38

Autofocus Replay

13

14 of 38

Development Debugging

14

15 of 38

MEASURING STARS

Size, Shape, Center Position, etc

16 of 38

Goals

  • Identify star candidates
  • Reject low-quality or poor matches
    • Double stars
    • Distorted
    • Flat discs
  • Measure heuristic for star focus
    • FWHM or HFR?

SCIENCE OF STAR MEASUREMENT

16

4/14/2023

17 of 38

1 – Hotpixel Filtering

Simple (low-overhead) – 3x3 Median Blur

SCIENCE OF STAR MEASUREMENT

17

4/14/2023

Thresholding (preferred) – Filter when large diff

18 of 38

2 – Noise Reduction

Gaussian Convolution

SCIENCE OF STAR MEASUREMENT

18

4/14/2023

Stdev = Radius * 2 + 1

19 of 38

3 – Structure Detection

SCIENCE OF STAR MEASUREMENT

19

4/14/2023

Wavelet to extract structures

Larger = bigger stars = longer focal length

Kappa Sigma background noise estimate

Larger = higher background noise

Dilate star candidate structures

Off by default

Binarize

Noise Clipping Multiplier * noise estimate

Star candidate boxes

20 of 38

4 - Rejection

  1. Has saturated pixels
  2. Touching border of image
  3. Elongated/Distorted
  4. Too dim
  5. Centroid not centered
  6. Too flat/no peak

SCIENCE OF STAR MEASUREMENT

20

4/14/2023

21 of 38

5 – HFR Measurement

SCIENCE OF STAR MEASUREMENT

21

4/14/2023

Sum of pixel brightness * center distance

Sum of pixel brightness

Distance containing half of star brightness

22 of 38

6 – FWHM Measurement

SCIENCE OF STAR MEASUREMENT

22

4/14/2023

Point Spread Function

Non-linear optimization. No direct solution

B = background ADU

A = center ADU

x0, y0 = center

β = Moffat Beta (1.4)

σx, σy = FWHM sigma (solving for)

Convert sigma to FWHM pixels

23 of 38

AUTOFOCUS

Finding Optimal Focus

24 of 38

Hyperbolic Fit

SCIENCE OF STAR MEASUREMENT

24

4/14/2023

HFR Std Dev

Minima

Goodness of Fit

25 of 38

Doesn’t fit?

SCIENCE OF STAR MEASUREMENT

25

4/14/2023

26 of 38

Improvements

SCIENCE OF STAR MEASUREMENT

26

4/14/2023

Outlier rejection

Hyperbola with different slopes

Minima changed by 34 steps

Higher error = lower weight

27 of 38

Options

SCIENCE OF STAR MEASUREMENT

27

4/14/2023

28 of 38

ABERRATION INSPECTION

Measuring and correcting tilt and back-focus

29 of 38

Background

SCIENCE OF STAR MEASUREMENT

29

4/14/2023

Back-focus

Tilt

Similar, but at a gradient

30 of 38

Corners Analysis

SCIENCE OF STAR MEASUREMENT

30

4/14/2023

Credit: Chris White

Cloudy Nights Thread - https://www.cloudynights.com/topic/809050-tilt-discussion-astap/

  1. Divide sensor into grid (3x3)
  2. Calculate optimal focus in center and corners
  3. No tilt = corners arrive at focus together
  4. Perfect backfocus = corners arrive at focus with center

31 of 38

Automated in NINA

SCIENCE OF STAR MEASUREMENT

31

4/14/2023

Replay or run live

Large tilt!

Tilt and back-focus mixed together…

32 of 38

Sensor Model

SCIENCE OF STAR MEASUREMENT

32

4/14/2023

Credit: Frank Freestar8n

Observations

  • Calculate focus position for every star
  • Fit a 3d paraboloid across the sensor
  • Include a tilt plane to calculate both at the same time

Approach

  • Corners model coarse due to averaging across regions
  • Tilt must be corrected to measure back-focus error

33 of 38

Mathematical Model

SCIENCE OF STAR MEASUREMENT

33

4/14/2023

Distance from sensor center

Offset from curvature

Offset from tilt

Total offset

x0, y0 Sensor Center

c Positive or negative curvature inverse radius. Smaller = flatter

Θ, Φ Tilt plane rotation, amount (radians). Θ = 0 = no tilt

Variables

34 of 38

SCIENCE OF STAR MEASUREMENT

34

4/14/2023

35 of 38

Techniques Applied

SCIENCE OF STAR MEASUREMENT

35

4/14/2023

  • Non-linear optimization - Levenberg-Marquardt
    • Implemented with Alglib
  • Naïve star registration – Quad Trees
    • Use RANSAC instead
  • Deal with outliers – Iterative reweighting (IRLS)

36 of 38

FUTURE WORK

37 of 38

Future Work

Autofocus

  • Fourier transformation method
    • Credit: Cheng-Yan Tang
  • 2-pass AF with FWHM and small step-size
  • Planetary AF in Fourier domain

Aberration Inspection

  • Guidance for which screws to turn
    • Calculate tilt adjuster screw locations
    • Motorized tilt adjusters?
  • Evaluate interpolation instead of outlier rejection
    • Ie, Kriging and RBF

38 of 38

THANK YOU

George Hilios

jokogeo (Discord)

ghilios (Cloudy Nights)

SCIENCE OF STAR MEASUREMENT

38

4/14/2023