14
SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms Daniel M. Topa a WaveFront Sciences, Inc. ABSTRACT In general the center of mass technique is a fast and robust way to approximate the location of a focal spot. This paper discusses in detail the relationship between the focal spot location and the center of mass. We start with a mathemati- cal analysis and conclude with a few practical ideas to improve the accuracy of the center of mass technique. Keywords: focal spot location, center of mass, centroids, Shack-Hartmann 1. INTRODUCTION A Shack-Hartmann wavefront sensor dissects a wavefront with a micro optic array of lenslets. The array typically contains hundreds or thousands of lenslets, each on the size scale of hundreds of microns. We discuss here the special case where the detection array is located in the focal plane of the lenslet array. The location of the focal spot reveals vital information about the portion of the wavefront sampled by the lenslet. We will quantify the information in the following section. Then we will discuss how the center of mass relates to the focal spot location. Lastly is a discussion on techniques to improve the accuracy of center of mass technique. 2. DIFFRACTIVE PROPAGATION THROUGH A LENSLET We begin by examining the types of wavefronts incident upon a lenslet and calculating their spatial irradiance distri- bution in the focal plane. We then resolve what this distribution tells us about the average value of the slopes of the sampled wavefront. 2.1 The spatial irradiance distribution in the focal plane Most Shack-Hartmann sensors are assembled such that the CCD array is in the focal plane of the lenslet array. There- fore the appropriate complex amplitude distribution 1 F f (u, v) of the field in the focal plane is given by the Fraunhofer diffraction pattern (1) where the pupil function describes the lens aperture. The function is 1 inside the lens aperture and 0 outside of the aperture. In the example that follows we will build the pupil function using the rectangle function, , which is defined (ref [2], p. 1532) as . (2) a. [email protected]; phone 505.275.4747; http:/www.wavefrontsciences.com; WaveFront Sciences, Inc., 14810 Central Ave SE, Albuquerque, NM, 87123-3905. F f uv , ( ) i k 2 f ---- u 2 v 2 + ( ) exp i λ f -------------------------------------------- F l xy , ( ) i 2 π λ f ------ xu yv + ( ) Pxy , ( ) exp x d y d = Pxy , ( ) Π x () Π x () 0 for x 1 2 - - > 1 2 -- for x = 1 2 -- 1 for x 1 2 - - <

Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

Optimized methods for focal spot locationusing center of mass algorithms

Daniel M. Topaa

WaveFront Sciences, Inc.

ABSTRACT

In general the center of mass technique is a fast and robust way to approximate the location of a focal spot. This paperdiscusses in detail the relationship between the focal spot location and the center of mass. We start with a mathemati-cal analysis and conclude with a few practical ideas to improve the accuracy of the center of mass technique.

Keywords: focal spot location, center of mass, centroids, Shack-Hartmann

1. INTRODUCTIONA Shack-Hartmann wavefront sensor dissects a wavefront with a micro optic array of lenslets. The array typicallycontains hundreds or thousands of lenslets, each on the size scale of hundreds of microns. We discuss here the specialcase where the detection array is located in the focal plane of the lenslet array.

The location of the focal spot reveals vital information about the portion of the wavefront sampled by the lenslet.We will quantify the information in the following section. Then we will discuss how the center of mass relates to thefocal spot location. Lastly is a discussion on techniques to improve the accuracy of center of mass technique.

2. DIFFRACTIVE PROPAGATION THROUGH A LENSLETWe begin by examining the types of wavefronts incident upon a lenslet and calculating their spatial irradiance distri-bution in the focal plane. We then resolve what this distribution tells us about the average value of the slopes of thesampled wavefront.

2.1 The spatial irradiance distribution in the focal planeMost Shack-Hartmann sensors are assembled such that the CCD array is in the focal plane of the lenslet array. There-fore the appropriate complex amplitude distribution1 Ff(u, v) of the field in the focal plane is given by the Fraunhoferdiffraction pattern

(1)

where the pupil function describes the lens aperture. The function is 1 inside the lens aperture and 0 outsideof the aperture. In the example that follows we will build the pupil function using the rectangle function, ,which is defined (ref [2], p. 1532) as

. (2)

a. [email protected]; phone 505.275.4747; http:/www.wavefrontsciences.com; WaveFront Sciences, Inc., 14810 Central Ave SE, Albuquerque, NM, 87123-3905.

Ff u v,( )i

k2f----- u

2v

2+( )

exp

iλ f-------------------------------------------- Fl x y,( ) i

2πλ f------ xu yv+( )–

P x y,( )exp xd yd

∞–

∫∫=

P x y,( )Π x( )

Π x( )

0 for x12--->

12--- for x =

12---

1 for x12---<

SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02

Page 2: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

The field Fl(u, v) incident upon the lenslet is related to the wavefront incident upon the lenslet through

(3)

where k is the wavenumber, . The spatial irradiance distribution in the focal plane is related to the field amplitudeby

(4)

The first step was to model the portion of the wavefront sampled by the lenslet. We begin with planarwavefronts and advance to wavefronts with more structure. Consider the first six simple cases in a Taylor series:

, , ,

, , .

These six wavefronts were then analyzed using equation 2. Before presenting the results for the corresponding inten-sity distributions, a few functions must be defined. First is the sampling function (ref. [2], p. 1642)

, (5)

then the error function (ref. [2], p. 561)

, (6)

and the imaginary error function (ref. [2], p. 563)

, (7)

and finally the exponential integral function (ref. [2], p. 596)

(8)

The intensity distributions can now be written in terms of these general functions. The first is the well-known resultshown in ref [1] on page 76:

. (9)

The next two results are also for planar wavefronts with tilt. They are

(10)

ψ x y,( )

Fl x y,( ) iψ kx ky,( )–( )exp=

2πλ

------

I x y,( ) F x y,( )F∗ x y,( )=

ψ x y,( )

ψ00 x y,( ) 1= ψ10 x y,( ) x= ψ01 x y,( ) y=

ψ20 x y,( ) x2

= ψ11 x y,( ) xy= ψ02 x y,( ) y2

=

sincxxsin

x----------≡

erf x( ) 2

π------- e

t2

–td

0

x

∫≡

erfi x( ) ierf ix( )–≡

ei x( ) et2

t--------- td

z–

∫–=

I00 x y,( ) d2

fλ-----

2

sinc2 πd

fλ------x sinc

2 πdfλ------y =

I10 x y,( ) d2

fλ-----

2

sinc2 πd

fλ------ x f–( ) sinc

2 πdfλ------y =

SPIE 2002 4769-14 2 of 14 11:53:41, 8/12/02

Page 3: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

and

. (11)

We expect the symmetry under interchange of x and y in equations 10 and 11 since space is isotropic and the lenslethas a discrete symmetry under rotations by integer multiples of 90°.

For the case of nonplanar wavefronts the results quickly become more complicated. To present these results, firstdefine the intermediate variables

, and . (12)

The intensity distribution can now be written as

. (13)

For both and we see the symmetry in the solutions under interchange of x and y. The intermediatevariables now become

, and , (14)

and the irradiance distribution in the focal plane is

. (15)

Finally we consider the case where the input wavefront exhibits some torsion. First define the intermediate variables

, and , (16)

, and . (17)

Then the irradiance distribution can be written as

× . (18)

Clearly the solutions in equations 9–11 are even functions and they are separable. That is, the irradiance distribu-tions for these three functions can be written X(x)Y(y). The next three functions are not separable as the function argu-ments mix the variables x and y. However, a careful analysis of the constituent functions in equations 6-8 reveals thatthe combinations in equations 13, 15 and 18 are even functions also.

I01 x y,( ) d2

fλ-----

2

sinc2 πd

fλ------x sinc

2 πdfλ------ y f–( ) =

α 2πdf λy+2fλ

------------------------= β 2πdf λy–2fλ

------------------------=

I20 x y,( ) 1π--- d

f--- 2

erfi zα( ) erfi zβ( )+( ) erfi izα( ) erfi izβ( )+( )sinc2 πd

fλ------x –=

I20 x y,( ) I02 x y,( )

α 2πdf λx+2fλ

------------------------= β 2πdf λx–2fλ

------------------------=

I02 x y,( ) 1π--- d

f--- 2

erfi zα( ) erfi zβ( )+( ) erfi izα( ) erfi izβ( )+( )sinc2 πd

fλ------y –=

α12πdf λx+

2fλ------------------------= α2

2πdf λx–2fλ

------------------------=

β12πdf λy+

2fλ------------------------= β2

2πdf λy–2fλ

------------------------=

I11 x y,( ) λ

4π2f

----------- 2

ei iα1β1( ) ei iα1β2( )– ei i– α2β1( )– ei i– α2β2( )+( )=

ei i– α1β1( ) ei iα1β2( )– ei iα2β1( )– ei i– α2β2( )+( )

SPIE 2002 4769-14 3 of 14 11:53:41, 8/12/02

Page 4: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

2.2 The average value of the slope of the sampled wavefrontNow we address the issue of how the amplitude of these input wavefronts affects the focal spot position. Consider

that the wavefront has an amplitude κ. The incident wavefronts become

, , ,

, , .

These new wavefronts were again propagated through the lenslet using equation 1. As one might expect, there wasno change in I00(x,y). The irradiance distributions for the odd parity terms become

(19)

and

. (20)

For the higher order cases, there is a slight rewrite. For example for I20(x), the intermediate variables become

, and . (21)

and the irradiance distribution in equation 13 is then multiplied by . For the torsion case the intermedi-ate variables are

, and , (22)

, and . (23)

and the irradiance distribution in equation 18 is then multiplied by .However, the only peaks that shift position are I10(x,y) and I01(x,y). And both of these shifts are exactly in the

focal plane. The question now becomes how does this compare to the average value of the wavefront slopes?The average value of the wavefront slope is given by

(24)

and similarly for . The six input wavefronts and their average slopes are

ψ00 x y,( ) κ= ψ10 x y,( ) κx= ψ01 x y,( ) κy=

ψ20 x y,( ) κx2

= ψ11 x y,( ) κxy= ψ02 x y,( ) κy2

=

I10 x y,( ) fλd----- 2

sinc2 πd

fλ------ x κ f–( ) sinc

2 πdfλ------y =

I01 x y,( ) fλd----- 2

sinc2 πd

fλ------x sinc

2 πdfλ------ y κ f–( ) =

α 2πdκ f λy+2fλ

----------------------------= β 2πdκ f λy–2fλ

----------------------------=

κ12---–

ψ11 x y,( )

α12πdκ f λx+

2fλ----------------------------= α2

2πdκ f λx–2fλ

----------------------------=

β12πdκ f λy+

2fλ----------------------------= β2

2πdκ f λy–2fλ

----------------------------=

κ 2–

κ f

mx

∂xψ x y,( ) xd yd

d 2⁄–

d 2⁄

∫d 2⁄–

d 2⁄

d2

---------------------------------------------------------≡

my m mx my,( )=

ψ00 x y,( ) κ= mT 0 0,( )=

ψ10 x y,( ) κx= mT 0 0,( )=

SPIE 2002 4769-14 4 of 14 11:53:41, 8/12/02

Page 5: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

So for these six cases, which are the most physically relevant, the average of the wavefront slope exactly describesthe shift of the peak in the focal plane accounting for the distance offset of the focal length.

This analysis buttresses the lore of Shack-Hartmann wavefront sensing. The shift in the focal spot position isdirectly proportional to the average of the wavefront slope across the lenslet. In the small angle limit inherent in theFresnel approximation, this is an exact result for the isoplanaticb cases and also true for the higher terms examined,although focal spot location is ambiguous in these cases as well as for additional higher order terms. An importantissue that has not be discussed is how combinations of these terms behave. This is an important issue that is quite rel-evant physically.

Figures 1 and 2 on the following pages shows the incident wavefronts and output irradiance distributions in thefocal plane. The lenslet is a square of size d = 280 µ and has a focal length f = 28 mm; the wavelength λ = 325 nm.These figures validate the well known rule of thumb: the wavefront sensor works best in the isoplanatic limit. In otherwords, the lenslet size should be much smaller than the variations one is attempting to measure. Of course practicalwavefront sensor design includes many other considerations too and one cannot shrink the lenslet size arbitrarily. Butthe message is that in the isoplanatic limit we expect to find well-defined focal spots that the center of mass can han-dle with higher precision.

3. CENTER OF MASS AND FOCAL SPOT LOCATIONWe want to know the location of the focal and we use the center of mass technique to approximate this location. Thequestion is: how well does the center of mass approximate the focal spot location? To resolve this issue we begin witha special case, and then move to the situation encountered in the laboratory.

3.1 Special case: domain centered exactly on peakConsider the special case of a spatial irradiance function g(x) being symmetric about the peak in some local region. Inother words, the function has even parity about the peak x0 in some local region which is smaller than the integrationdomain for the center of mass. The requirement for even parity can be written as

. (25)

Since g(x) is even, the antiderivative of this function is odd on this same interval. Defining the antiderivative as

, (26)

the parity condition becomes

. (27)

Now we consider the center of mass computation. Defining the center of mass on some domain [a, b] as

b. Here isoplanatic has the geometric context of being flat “like a plane.” This is different from the context articulated by Goodman in [1].

ψ01 x y,( ) κy= mT κ 0,( )=

ψ20 x y,( ) κx2

= mT 0 κ,( )=

ψ11 x y,( ) κxy= mT 0 0,( )=

ψ02 x y,( ) κy2

= mT 0 0,( )=

g x x0–( ) g x x0+( )=

g x( ) xd∫ G x( )=

G x x0–( ) G x x0+( )–=

x

SPIE 2002 4769-14 5 of 14 11:53:41, 8/12/02

Page 6: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

incident wavefront irradiance distribution

Figure 1: The planar wavefronts incident upon a lenslet. The first column shows the functional form of the incident wave-front. The second column graphically shows the wavefront incident upon the lenslet. The final column is a plot of the spatialirradiance distribution in the focal plane. Note that in these examples over 95% of the light is confined to an area the size of alenslet. The x and y axes are in microns. The vertical scale in the first column is also in microns. The vertical axis on the sec-ond column represents intensity and is in arbitrary units.

-100

0

100

-100

0

100

0

0.0005

0.001

0.0015

0.002

-100

0

100

-100

0

100

-100

0

100

0

20

40

60

-100

0

100

-100

0

100

-100

0

100-0.1

0

0.1

-100

0

100

-100

0

100

-100

0

100

0

20

40

60

-100

0

100

-100

0

100

-100

0

100-0.1

0

0.1

-100

0

100

-100

0

100

-100

0

100

0

20

40

60

-100

0

100

ψ00(x,y) = 1

ψ10(x,y) = x

ψ01(x,y) = y

SPIE 2002 4769-14 6 of 14 11:53:41, 8/12/02

Page 7: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

incident wavefront irradiance distribution

Figure 2: The next three terms in the series of increasingly more complicated incident wavefronts. Clearly the focal spots aredegrading rapidly where the incident wavefront has a non-planar structure. Notice the concept of a peak is ambiguous hereand the center of mass computation could be highly problematic. Also, only a small portion of the light falls within the lensletarea.The x and y axes are in microns. The vertical scale in the first column is also in microns. The vertical axis on the secondcolumn represents intensity and is in arbitrary units.

-100

0

100

-100

0

100

0

0.5

1

1.5

2

-100

0

100

-100

0

100

-100

0

100

0

0.02

0.04

0.06

-100

0

100

-100

0

100

-100

0

100

-2

-1

0

1

2

-100

0

100

-100

0

100

-100

0

100

0.0011628

0.001163

0.0011632

0.0011634

-100

0

100

-100

0

100

-100

0

100

0

0.5

1

1.5

2

-100

0

100

-100

0

100

-100

0

100

0

0.02

0.04

0.06

-100

0

100

ψ20(x,y) = x2

ψ02(x,y) = y2

ψ11(x,y) = xy

SPIE 2002 4769-14 7 of 14 11:53:41, 8/12/02

Page 8: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

(28)

we now have the most general formula. But because of the parity of g(x), we are motivated to consider a symmetricdomain centered on the peak. This implies

. (29)

If we consider ρ to be radius we can define

(30)

and the center of mass in equation 28 now becomes

. (31)

Since G(x) is odd over this domain, the integral vanishes. And using equation 27 the center of mass can be reduced to

. (32)

So when g(x) is symmetric about the peak and the domain is centered on the peak, the center of mass is exactly thefocal spot location.

3.2 Typical case: domain centered approximately on peakDue to the discreet nature of the CCD array, the pixel addresses are integers and this precludes one from selectingintegration boundaries that are centered exactly about the peak. This leads to the consideration of how the center ofmass shifts away from the peak. The approach here is to consider the problem as having two parts: a piece with exactsymmetry and the piece which shifts the center of mass away from the focal spot location.

For the arbitrary domain [a, b], no longer centered about x0, the center, c, of the domain is

. (33)

This leads to the definition of an asymmetry parameter τ which measures how far the peak is from the domain center;

. (34)

The next step is to define the radius ρ of the symmetric piece

. (35)

The center of mass can now be written in terms of the symmetric and asymmetric component as

xxg x( ) xd

a

b∫g x( ) xd

a

b∫-------------------------≡

x0 a– x0 b–( )–=

ρ x0 a–≡

x

x0G x( )x0 ρ–

x0 ρ+G x( ) xd

x0 ρ–

x0 ρ+

∫–

G x( )x0 ρ–

x0 ρ+---------------------------------------------------------------------=

x2x0G x0 ρ+( )2G x0 ρ+( )

--------------------------------- x0= =

ca b+

2------------=

τ x0 c–=

ρ Min x0 a– b x0–,( )=

SPIE 2002 4769-14 8 of 14 11:53:41, 8/12/02

Page 9: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

, (36)

which reduces to

. (37)

As the integration boundaries become symmetric about the peak and the center of mass approaches the peak,i.e. .

The error in the center of mass result can be expressed in terms of the asymmetry parameter τ which isa key to a subsequent correction scheme. For the case of a sinc2x function, this error is given as

(38)

where ci(x) is the cosine integral function, defined in [2] on p. 340 as

, (39)

and Si(x) is the sine integral function is defined in ref [2], p. 1646 as

. (40)

Note that the capitalization of ci(x) and Si(x) is consistent with the definitions in [2].

4. CORRECTION STRATEGIESThis section presents three obvious correction strategies to improve the center of mass computation and recover amore accurate focal spot location. All the studies done on these methods used theoretical data because this is the sim-plest way to get an exact focal spot location to evaluate the different methods. The problem with laboratory data isthat one does not know the true focal spot location and this complicates the evaluation of the methods.

However, T.D. Raymond has developed some innovative ways to address this issue. He studies ensembles of focalspot locations. Typically he will use a motorized stage to precisely introduce tilts. Since he has exquisite knowledgeof the tilts, he has exquisite knowledge as to how the ensemble should behave. This insight has opened a new avenueof exploration and as of this writing only very preliminary results have been taken using Raymond’s techniques.

x

xg x( ) xd

x0 ρ–

x0 ρ+

∫ xg x( ) xd

x0 ρ+

x0 ρ 2τ–+

∫+

g x( ) xd

x0 ρ–

x0 ρ+

∫ xg x( ) xd

x0 ρ+

x0 ρ 2τ–+

∫+

---------------------------------------------------------------------------------=

x

x0 ρ–( )G x0 ρ+( ) x0 ρ 2τ–+( )G x0 ρ 2τ–+( ) G x( ) xd

x0 ρ+

x0 ρ 2τ–+

∫–+

G x0 ρ+( ) G x0 ρ 2τ–+( )+----------------------------------------------------------------------------------------------------------------------------------------------------------------------=

τ 0→x x0→

δ x x0–=

δ ρ( )ln ρ 2τ–( )ln– ci 2 ρ 2τ–( )( ) ci 2ρ( )–+

2 3Si 2ρ( ) Si 2 ρ 2τ–( )( )–ρ 2τ–( )sin

2

ρ 2τ–------------------------------ 3

ρ( )sin2

ρ------------------–+

--------------------------------------------------------------------------------------------------------------------------------------=

ci x( ) tcost

---------- tdx

∫–≡

Si x( ) tsint

--------- td

0

x

∫≡

SPIE 2002 4769-14 9 of 14 11:53:41, 8/12/02

Page 10: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

4.1 Tsvetkov methodA method for implementing the center of mass to exploit the results of section 3. was developed by Sergei Tsvetkov.His method locates the brightest pixel under a lenslet and then marches out in the ±x and ±y directions to find the fourminima. These four pixels define the boundary of a rectangular integration domain (see figure 3). The smallest of thefour minima is used as a threshold and this value is subtracted from all pixels in the integration domain.

Figure shows the wisdom of Tsvetkov’s method. First of all, it endeavors to symmetrically bound the peak, whichminimizes the error in the center of mass computation. This also gobbles up more pixels than a thresholding method,which provides more information. Now the asymmetric contaminant is also minimized near the minimum. The totalarea in the darker region is what causes the error in the computation. Near the minimum, this piece has the smallestheight. And after removing the pedestal (the dark count from the camera), the piece is even smaller. The width of thepiece is now less than the width of a pixel. So this simple scheme exploits the lessons from section 3.2 all withouthaving to provide a threshold a priori.

There is a drawback to this method in that as the distance between the asymmetric piece and the peak increases, thelever arm also increases. In other words, a unit area added to the center of mass is more harmful at larger distances.However it appears that in the cases of square lenslets with well-defined sinc2x sinc2y focal spots, the lever arm effectis more than compensated for by the height minimization at the minimum. This seems to suggest against using thesecond minimum as the lever arm doubles

Some basic numerical studies were on simulated camera files created using the propagation equations in section 2.These data did not include either noise or cross-talk from neighboring lenslets. The advantage of simulated data isthat one has exact knowledge of the peak and can exactly quantify the error in the center of mass calculation. Forcomparison purposes, a classic center of mass with a threshold of 12% was used. The average error for each method was then computed for 4096 samples all where the peaks were within one pixel of the projection ofthe lenslet center. The standard deviation of the errors are

pixels for the classic method

pixels for the Tsvetkov method.

The pixels here were 14 µ. So the Tsvetkov method, in an environment free of noise and cross-talk, reduces the centerof mass error by about one third.

The study of the errors in this method proved interesting. The method was to position a peak at different positionswithin a pixel since the errors are periodic with a period of one pixel. At each position the error between the peaklocation and the center of mass was computed. These results are shown in figure .

Figure 3: An example of the Tsvetkov method. This is simulated CCD data showing how an irradiance distribution is repre-sented discretely. Here the incident wavefront was isoplanatic and with a small tilt component. The yellow lines represent theintegration region. Here the error is pixels.

δT δx δy,( )=

σδT

0.015 0.015, =

σδT

0.010 0.011, =

0 2 4 6 8 10 12

0

2

4

6

8

10

12

δT0.013 0.002,( )=

SPIE 2002 4769-14 10 of 14 11:53:41, 8/12/02

Page 11: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

(a) (b)Figure 4: The center of mass calculation does not match the focal spot location in the general case (a) due to an asymmetry.The center of mass can be thought of as having two components: a symmetric piece (light gray) and the asymmetric compo-nent (dark gray). Figure (b) shows that removing the pedestal greatly reduces the shift caused by the center of mass computa-tion by reducing the contribution of the asymmetric piece. The asymmetric piece is the contaminant that pulls the center ofmass value away from the peak location. Successful center of mass strategies will minimize the effect of this piece.

4.2 Tsvetkov method correctedThe Tsvetkov method is an excellent starting point for improving the center of mass calculation. In the cases wherethe form of the irradiance distribution is known, an additional improvement is apparent. Since the shape of the distri-bution is known, one can look at the difference between the center of mass and the asymmetry parameter and make aquick correction based on a two-dimensional version of equation 38. In the sample environment tested, the additionalcorrection was able to remove 90% of the error, reducing the error by an order of magnitude.

The error variations in figure were studied in the x and y components. The next step was to plot the error compo-nents as a function of the asymmetry parameter. A surprisingly simple variation was observed and is shown in figure 6. The errors are essentially linear with respect to the asymmetry parameter τ with two distinct branches. This implies that a simple linear correction can be used to push the center of mass closer to the focal spot location. For these data the results of the linear fits were

positive branch ,

negative branch .

Figure 5: The error in the center of mass computation as a function of peak offset from the center of the pixel. The axesdescribe the distance the peak was offset from the center of the pixel. The color of the block reveals the magnitude of the errorAs expected, there is no error when the peak is centered in the pixel. The maximum error in this example was 0.03 pixels. Theeffect of the discrete change in integration boundaries manifests distinctly as an abrupt change in the error.

-15 -10 -5 0 5 10 15-15 -10 -5 0 5 10 15 -15 -10 -5 0 5 10 15-15 -10 -5 0 5 10 15

error 0.043756 0.000004±( )τ 0.00000 0.00002±( )+=

error 0.0305515– 0.000004±( )τ 0.00000 0.00002±( )+=

-0.5 0 0.5x offset from center, pixels

-0.5

0

0.5

yof

fset

from

cent

er,p

ixel

s

SPIE 2002 4769-14 11 of 14 11:53:41, 8/12/02

Page 12: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

Figure 6: The center of mass error as a function of the asymmetry parameter. Here the graph shows the x component of theerror plotted in figure 5. Note that the functional relation between error and the asymmetry parameter is linear with two dis-tinct branches.

The beauty of this method is that the slopes for the positive and negative branches are functions of the wavefrontsensor. As such, they only need be determined one time. The method is to compute a center of mass and an asymme-try parameter. Then determine which branch of the correction is appropriate, and apply a simple linear boost to nudgethe center of mass closer to the peak location. The nudge is applied separately to the x and y components of the centerof mass prediction.

Figure 6 allows one to see graphically how precise this correction can be. The vertical spread in each cluster ofpoints is approximately 0.002 pixels. The linear correction basically cuts this in half, leaving us with an error ofapproximately 0.001 pixels. Attempts to reduce the error further by handling the problem in two dimensions failed.

For example, if the asymmetry parameter was at the maximum of τ = 0.3 pixels, the correction is

pixels

which is added to the computed center of mass. This will bring the computation to within 0.001 pixels of the truefocal spot location.

4.3 Partial pixelsAnother strategy has been developed in collaboration with J. Roller. This is an iterative scheme. The gist of themethod is that one computes the center of mass and develops an approximate focal spot location, . This loca-tion should easily be within a pixel of the true focal spot location. A new integration domain is now defined, centeredon the center of mass value. The size of the domain is given by the Tsvetkov criteria: use all the data within the firstminima. We know from equation 9 that the half-width is . So the integration domain is andthe integration range is . Using these new boundaries, a new center of mass is computed, ,along with new boundaries. The process continues until the distance between peak locations on consecutive iterationsis smaller than some arbitrary acceptance parameter.

The problem is that now the integration boundaries are no longer integer pixel values, but they lie within the pixels.So the heart of this scheme is to find a way to apportion the light within a pixel and maintain the speed advantage ofthe center of mass. While the exact computation of this apportionment can be messy, the exact solution can beapproximated quite well with a polynomial.

Consider the cases of sinc2x in one dimension. The parameter describes where the minimum falls within thepixel. For example, if the minimum is in the middle of the pixel, ; if the minimum is three quarters of theway across the pixel then . The function is a weighting function varying from zero to one whichdescribes how much of the light to include from the pixel. In this case the weighting function is given exactly as

-0.3 -0.2 -0.1 0 0.1 0.2 0.3asymmetry parameter, pixels

-0.015

-0.01

-0.005

0

0.005

0.01

0.015

CO

Mx

erro

r,pi

xels

0.043756 0.000004±( )0.3 0.00000 0.00002±( )+ 0.01313 0.00002±–=

x0 y0,( )

ρ fλ d⁄= x0 ρ– x0 ρ+,[ ]y0 ρ– y0 ρ+,[ ] x1 y1,( )

ϕϕ 0.5=

ϕ 0.75= ω ϕ( )

SPIE 2002 4769-14 12 of 14 11:53:41, 8/12/02

Page 13: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

(41)

The constant a represents

. (42)

Notice that this is for pixels on the right-hand side. One can exploit the even parity of the sinc2x function to get thevalues for the left-hand side.

The problem is of course that a naive implementation of Si(x) will slow down the algorithm tremendously. We canexploit the fact that over the domain interest, , the function has a rather simple behavior. Figure 7 belowshows the weighting function as a solid curve. The points are the results of polynomial least squares fit through ordernine. The agreement is quite good.

We can write the approximate solution as

(43)

where n represents the degree of fit. In figure 7, n = 9. Notice that this formulation avoids the ambiguous quantity 00.Of course a direct implementation of equation 43 would be ponderously slow and erode the speed advantage of the

center of mass technique. We show two different ways to encode these results in C++:

double c[10]; //LSF fit coefficientsc[0] = 783.7320568947441; //constant termc[1] = -3448.7204133862506; //linear termc[2] = 6172.40085200703; //coefficient for x^2c[3] = -5739.328837072939;c[4] = 2945.8812707469388;c[5] = -833.7602125492338;c[6] = 130.30391297857992;

Figure 7: The weighting function for partial pixels. If the minimum falls within the pixel at some point , then theportion of light to include in the center of mass computation is . The curve is the exact solution in equation 41 and thedots are the results of a ninth-order polynomial least squares fit.

ω ϕ( )fλ πd

fλ------ϕ sin π fλ dϕ–( ) a Si 2

2dϕfλ

----------– –

+

fλ dϕ–( ) fλ

πdfλ------ ϕ 1–( ) sin

d fλ dϕ–+--------------------------------------

πdfλ------ϕ sin

dϕ fλ–------------------------+

π Si2π d fλ dϕ–+( )

fλ--------------------------------------- Si 2

2dϕfλ

----------– +

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=

a Si 2π( )= 1.4181515761326284502457801622997494291424533492950…≈

ϕ 0 1[ , ]∈

Ω ϕ( )

Ω ϕ( ) c0 cnϕn

i 1=

n

∑+=

0 0.2 0.4 0.6 0.8 1j

0

0.2

0.4

0.6

0.8

1

w

ω ϕ( ) ϕω ϕ( )

SPIE 2002 4769-14 13 of 14 11:53:41, 8/12/02

Page 14: Optimized methods for focal spot location using center of ......SPIE 2002 4769-14 1 of 14 11:53:41, 8/12/02 Optimized methods for focal spot location using center of mass algorithms

c[7] = -9.792719111240226;c[8] = 0.2907165577816425;c[9] = -0.001729454319027303; //coefficient for x^9…double omega(double * c, double phi, int n) //weighting function

// c LSF fit coefficients for equation 41// phi pixel fraction// n degree of polynomial least squares fit// lsf weighting factor to use (omega[phi])

double lsf = 0; //LSF predictionfor(int i = n; i > 0; i--) //loop through orders

lsf = phi * (lsf + c[i]); //build up answer

lsf += c[0]; //add in constant term

return lsf; //return the answer

This is an elegant implementation that easily accommodates fits of arbitrary order through adjusting the parameter n.However, a somewhat faster method is

double f(double * c, double phi) //rapid polynomial

double lsf = c[0] + phi * (c[1] + phi * (c[2] + phi * (c[3] + phi * (c[4] + phi * (c[5] + phi * (c[6] + phi * (c[7] + phi * (c[8] + phi * (c[9])))))))));

return lsf;

The first method took 16% longer to execute than the second method. A straightforward implementation of equation43 took 13 times longer than the second method.

5. SUMMARYWe have shown formally the well-known result that the shift in the focal spot location is proportional to the averagewavefront slope across a lenslet. The result is exact in the isoplanatic and small angle limits. We then showed the rela-tionship between the focal spot location and the center of mass computation. The accuracy of the assumption that thecenter of mass is the focal spot location depends directly upon how symmetrically the integration domain bounds thepeak. When the domain is exactly symmetric, the center of mass exactly represents the peak. Of course with real data,the integration boundaries are not centered upon the peaks. We closed with three strategies to improve the accuracy ofthe center of mass computation and preserve the time advantage of the method.

ACKNOWLEDGMENTS

The tutorials by J. Copland, J. Gruetzner, and D. Neal were greatly appreciated. The conversations with D. Hamrick,T.D. Raymond and J. Roller were quite helpful. The computer science analysis by G. Pankretz was most insightful.

REFERENCES

1. Goodman, J.W. , Introduction to Fourier Optics 2e, p. 103, McGraw-Hill, New York, 1996.2. Weisstein, E.W., Concise Encyclopedia of Mathematics, CRC Press, Boca Raton, FL, 1999.

SPIE 2002 4769-14 14 of 14 11:53:41, 8/12/02