II Escuela de Optica Biomedica, Puebla, 2011 Monte Carlo, Euler and Quaternions Jessica C....

Post on 26-Dec-2015

216 views 2 download

Tags:

Transcript of II Escuela de Optica Biomedica, Puebla, 2011 Monte Carlo, Euler and Quaternions Jessica C....

II Escuela de Optica Biomedica, Puebla, 2011

Monte Carlo, Euler and Quaternions

Jessica C. Ramella-Roman

II Escuela de Optica Biomedica, Puebla, 2011

Stokes vector reference

• Yesterday, Meridian plane– Three steps– “Rotate” to scattering plane• Rotational matrix

– Scatter• Scattering matrix

– “Rotate” to a new plane• Rotational matrix

II Escuela de Optica Biomedica, Puebla, 2011

Today Monte Carlo

• Reference frame is a triplet of unit vectors

• Rotation are about an axis and follow a specific order

http://www.grc.nasa.gov/WWW/K-12/airplane

II Escuela de Optica Biomedica, Puebla, 2011

Today Monte Carlo

• Reference frame is a triplet of unit vectors

• Rotation of the frame is done in two steps.

II Escuela de Optica Biomedica, Puebla, 2011

Euler and Quaternion

• The only difference between today programs is the way we handle these rotations

• Euler angles rotation Quaternions algebra

II Escuela de Optica Biomedica, Puebla, 2011

Euler Monte Carlo

• The photon polarization reference frame is tracked at any time via a triplet of unit vectors that are rotated by an azimuth and scattering angle according to a predefined order

• Introduced by Bartel et al. (*)

* S. Bartel, A. Hielsher, “Monte Carlo simulations of the diffuse backscattering Mueller matrix for highly scattering media,” Applied Optics, Vol. 39, No. 10; (2000).

II Escuela de Optica Biomedica, Puebla, 2011

Euler matrices

• Euler's rotation theorem: any rotation may be described using three angles.

• And three rotation matrices– About z axis

– About x’ axis

– About z’ axis

Drawings, Wolfram, Mathworld

II Escuela de Optica Biomedica, Puebla, 2011

Euler cnt.

• We only need TWO vectors and TWO rotations

• Two unit vectors v and u

• The third unit vector is defined by the cross product of v and u and is calculated only when a photon reaches a boundary.

v=[ vx , vy , vz ] = [0,1,0]

u=[ ux , uy , uz ] =[ 0,0,1]

II Escuela de Optica Biomedica, Puebla, 2011

Euler cnt.

• Advantage – Stokes vector is rotated only once for each

scattering event instead of twice as in the meridian plane method.

– Simple to implement and visualize

• Drawback – – Gimbal lock - makes the rotation fail for angles

exactly equal to 90˚ (rare event).

II Escuela de Optica Biomedica, Puebla, 2011

Monte Carlo flow chart

II Escuela de Optica Biomedica, Puebla, 2011

Launch

• The two unit vector v and u

• v and u define the starting Stokes vector reference plane.

• The unit vector u represents the direction of photon propagation.

v=[ vx , vy , vz ] = [0,1,0]

u=[ ux , uy , uz ] =[ 0,0,1]

II Escuela de Optica Biomedica, Puebla, 2011

Move

• The photon is moved a distance Ds, the new coordinates of the photon are

′ x =x+uxΔs

′ y =y+uyΔs

′ z =z+uzΔs

II Escuela de Optica Biomedica, Puebla, 2011

Drop

• Reduction of photon weight (W)

• According to material albedo

• albedo = ms/(ms+ ma)

• absorbed = W*(1-albedo)

II Escuela de Optica Biomedica, Puebla, 2011

Scatter

• The rejection method establishes the scattering angle q and azimuth angle f.

• The Stokes vector must be rotated by an angle f into the scattering plane before scattering can occur.

II Escuela de Optica Biomedica, Puebla, 2011

Referencing to scattering plane

• Done as in meridian plane Monte Carlo

• Multiply the Stokes vector by matrix R

R φ( ) =

1 0 0 0

0 cos(2φ ) sin(2φ ) 0

0 − sin(2φ ) cos(2φ ) 0

0 0 0 1

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

Sout = R φ( )Sin

II Escuela de Optica Biomedica, Puebla, 2011

Scatter cnt

• The interaction with a spherical particle is achieved by multiplying the Stokes vector with a scattering matrix M(q)

M θ( ) =

s11(θ ) s12(θ ) 0 0

s12(θ ) s11(θ ) 0 0

0 0 s33(θ ) s34(θ )

0 0 −s34(θ ) s33(θ )

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

Sout = M θ( )Sin

II Escuela de Optica Biomedica, Puebla, 2011

M(q) elements

• s11 , s12 , s33 , s34 calculated with Mie theory

• Expressed as

• S1, S2* – Mie scattering

s11(θ )=12[ S2(θ )

2+ S1(θ )

2]

s12(θ )=12[ S2(θ )

2−S1(θ )

2]

s33(θ )=12[ S2

* (θ )S1(θ )+S2(θ )S1* (θ )]

s34(θ )= i2[ S2

* (θ )S1(θ )−S2(θ )S1* (θ )]

*http://omlc.ogi.edu/calc/mie_calc.html

C. Bohren and D. R. Huffman, Absorption and scattering of light by small particles, (Wiley Science Paperback Series,1998).

II Escuela de Optica Biomedica, Puebla, 2011

Reference frame

• After scattering the Stokes vector the reference coordinate system v u must be updated.

• The two rotations, for the angles f and q can be obtained using Euler’s rotational matrices.

II Escuela de Optica Biomedica, Puebla, 2011

Rotational matrix ROT

• Rodrigues’s rotational matrix ROT • Accomplishes the general case of rotating any

vector by an angle y about an axis K

• Where K is the rotational axis,• c=cos(y), s=sin(y) and v=1-cos(y).

ROT (K ,ψ ) =

kxkxv + c k ykxv − k zs k zkxv + k ys

kxk yv + k zs k yk yv + c k yk zv − kxs

kxk zv − k ys k yk zv + kxs k zk zv + c

⎢ ⎢ ⎢

⎥ ⎥ ⎥

II Escuela de Optica Biomedica, Puebla, 2011

Vector rotation

• First the unit vector v is rotated about the vector u by an angle f

• Multiply v by the rotational matrix ROT(u,f); u remains unchanged

II Escuela de Optica Biomedica, Puebla, 2011

Vector rotation

• Second u is rotated about the newly generated v by an angle q.

• This is done multiplying the unit vector u by the rotational matrix ROT(v,q).

II Escuela de Optica Biomedica, Puebla, 2011

Update of direction cosines

• This is done as in standard Monte Carlo

• q and f

u^

x = (sin θ ) (cos φ)

u^

y = (sin θ ) (sin φ)

u^

z = (cosθ ) uzuz

If |uz| ≈ 1

II Escuela de Optica Biomedica, Puebla, 2011

Update of direction cosines

u^

x =1

1−uz

2(sinθ )(uxuy (cosφ)−uy (sinφ))+ux (cosθ )

u^

y=1

1−uz

2(sinθ )(uxuz (cosφ)−ux (sinφ))+uy (cosθ )

u^

z = 1−uz

2 (sinθ ) (cosφ)(uyuz (cosφ)−ux (sinφ))+uz (cosθ )

If |uz| ≠ 1

II Escuela de Optica Biomedica, Puebla, 2011

Photon life

• The life of a photon ends when the photon passes through a boundary or when its weight W value falls below a threshold.

• Roulette is used to terminate the photon packet when W £ Wth. – Gives the photon packet one chance of surviving– If the photon packet does not survive the roulette,

the photon weight is reduced to zero and the photon is terminated.

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries

• Two final rotations of the Stokes vector are necessary to put the photon status of polarization in the detector reference frame.

• This will be achieved with matrix multiplication of two rotational matrix by stokes vector

Sfinal=R(ψ )R( ε )S

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries – R(e)

• w is reconstructed as the cross product of v and u.

• An angle e is needed to rotate the Stokes vector into a scattering plane

w=v×u

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries – R(e)

• This is the ONLY reason we need the vector u, v, and w

ε =0 when vz =0 and uz =0

ε =tan−1( vz−wz

) in all other cases

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries – R(e)

• This rotation is about the direction of propagation of the photon, i.e. the axis u

• Resulting position of v

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries – R(y)

• A second rotation of an angle y about the Z axis

• Put the photon reference frame in the detector reference frame

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries – R(y)

• Transmission

• Reflection

ψ =tan−1(uy−ux

)

ψ =tan−1(uyux

)

II Escuela de Optica Biomedica, Puebla, 2011

Boundaries End

• Stokes vector in the detector frame of reference

• We need vector u, v, and w to obtain these angles

Sfinal=R(ψ )R( ε )S

II Escuela de Optica Biomedica, Puebla, 2011

Quaternion Monte Carlo

• Quaternion Monte Carlo simply uses Quaternion Algebra to handle vector rotation.

• Advantage – Stokes vector is rotated only once for each

scattering event instead of twice as in the meridian plane method.

– No issue with Gimbal lock – Optimized for computer simulations

II Escuela de Optica Biomedica, Puebla, 2011

Quaternions

• A quaternion is a 4-tuple of real numbers; it is an element of R4.

• Quaternion can also be defined as the sum of a scalar part q0 and a vector part Q in R3 of the form

q = qo ,q1 ,q2 ,q3( )

q=q0 + Q = q0 + iq1 + jq2 + kq3

II Escuela de Optica Biomedica, Puebla, 2011

Quaternions cnt.

• The vector part Q is the rotational axis and the scalar part is the angle of rotation.

• Multiplication of a vector t by the quaternion is equivalent to rotating the vector t around the vector Q of an angle q0.

II Escuela de Optica Biomedica, Puebla, 2011

Vector rotation

• First the unit vector v is rotated about the vector u by an angle f

II Escuela de Optica Biomedica, Puebla, 2011

Rotation - f

• The first rotation is about the vector u by an angle f.

• This is done generating the quaternion qf

• And then using the quaternion operator• q∗ vq on the vector v• q ∗ is the complex conjugate of q

qφ =φ + u = φ + iux + juy + kuz

II Escuela de Optica Biomedica, Puebla, 2011

Vector rotation

• Second u is rotated about the newly generated v by an angle q.

II Escuela de Optica Biomedica, Puebla, 2011

Rotation - q

• The second rotation is about the vector v by an angle q.

• This is done generating the quaternion qq

• And then using the quaternion operator• qq*uq q on the vector u

qφ =θ +v = φ + ivx + jvy + kvz

II Escuela de Optica Biomedica, Puebla, 2011

Rotations

• These steps are repeated for every scattering event.

• At the boundaries the last aligning rotations are the same as in Euler Monte Carlo.

II Escuela de Optica Biomedica, Puebla, 2011

Testing

• Comparison with Evans Code• In 1991 Evans designed an adding doubling code

that can calculate both the radiance and flux of a polarized light beam exiting the atmosphere

• plane parallel slab of thickness L = 4/µs,

• absorption coefficient µa=0, • unpolarized incident beam • wavelength l = 0.632 nm.

II Escuela de Optica Biomedica, Puebla, 2011

Evans - Reflectance mode Diameter (nm) Evans

IThis code

IEvans

QThis code

Q10 0.6883 0.6886 -0.1041 -0.1042

100 0.6769 0.6769 -0.1015 -0.1009

1000 0.4479 0.4484 0.0499 0.0499

2000 0.2930 0.2931 0.0089 0.0088

Reflectance mode, comparison between Evans adding-doubling code and the meridian plane Monte Carlo program. The results do not include the final rotation for a single detector.

Incident I=[1 0 0 0]

II Escuela de Optica Biomedica, Puebla, 2011

Evans – Transmission mode Diameter (nm) Evans

I

This code

I

Evans

Q

This code

Q

10 0.33126 0.31133 -0.01228 -0.01233

100 0.32301 0.32305 -0.12844 -0.12770

1000 0.55201 0.55152 0.02340 0.02348

2000 0.70698 0.70689 0.01197 0.01205

Transmission mode, comparison between Evans adding doubling code and the meridian plane Monte Carlo program. The results are not corrected for a single detector

Incident I=[1 0 0 0]

II Escuela de Optica Biomedica, Puebla, 2011

How to run the code

• Download the code

• http://faculty.cua.edu/ramella/MonteCarlo/index.html

II Escuela de Optica Biomedica, Puebla, 2011

How to run the code

• Download the code

• http://faculty.cua.edu/ramella/MonteCarlo/index.html

II Escuela de Optica Biomedica, Puebla, 2011

Download the code

Programs

II Escuela de Optica Biomedica, Puebla, 2011

Make

Command line

Compilation/linking step

II Escuela de Optica Biomedica, Puebla, 2011

Run

This program will run a full Mueller matrix Monte Carlo launching four vectors[1 1 0 0] H 0 degree polarized[1 -1 0 0] V 90 degrees polarized[1 0 1 0] P 45 degrees polarized[1 0 0 1] R –Right circular

Command line

II Escuela de Optica Biomedica, Puebla, 2011

Memory usage

• Intel (64-bit) – Macbook pro 2.3Ghz I7 8GB RAM

• Real mem 860 KB • Virtual mem 17 MB

II Escuela de Optica Biomedica, Puebla, 2011

out

Output is a set of Stokes vector images for each launched Stokes vector

outHI -> Horizontal incident polarization and I portion of the Stokes vector

outHQ -> Horizontal incident polarization and Q portion of the Stokes vector

II Escuela de Optica Biomedica, Puebla, 2011

Inside the code

GNU Licence

II Escuela de Optica Biomedica, Puebla, 2011

Modifiable parameters

II Escuela de Optica Biomedica, Puebla, 2011

Image related parameters

II Escuela de Optica Biomedica, Puebla, 2011

Stokes vector launch

II Escuela de Optica Biomedica, Puebla, 2011

Launch terms

Initial position

Initial orientation

Initial Stokes vector

II Escuela de Optica Biomedica, Puebla, 2011

We can use the three Monte Carlo programs to understand how polarized light travels into

scattering media

II Escuela de Optica Biomedica, Puebla, 2011

Light transfer –mono disperse particles

II Escuela de Optica Biomedica, Puebla, 2011

Light transfer –mono disperse particles

• Experimental results– black circles

• Monte Carlo – black square

• Diameter 482 nm, • Wavelength was 543

nm.• nsphere =1.59

II Escuela de Optica Biomedica, Puebla, 2011

Light transfer –mono disperse particles

• Experimental results– black circles

• Monte Carlo – black square

• Diameter 308 nm, • Wavelength was 543

nm.• nsphere =1.59

II Escuela de Optica Biomedica, Puebla, 2011

Poly-disperse solutions

• Gamma distribution of particles

N(r )=arα (exp−brγ )

II Escuela de Optica Biomedica, Puebla, 2011

Poly-disperse solutionsComparison with Evans

Results from a slab in reflectance

Incident I=[1 0 0 0]

II Escuela de Optica Biomedica, Puebla, 2011

Poly-disperse solutions -DLP

II Escuela de Optica Biomedica, Puebla, 2011

Map of polarized light distribution

d

II Escuela de Optica Biomedica, Puebla, 2011

Map of polarized light distribution

d

II Escuela de Optica Biomedica, Puebla, 2011

Map of polarized light distribution

d

II Escuela de Optica Biomedica, Puebla, 2011

d

d

d

x y

d

x

y

D = 0.01 µmµs = 0.89 cm-1

l = 0.543µm

II Escuela de Optica Biomedica, Puebla, 2011

D = 0.01µmµs = 0.89 cm-1

l = 0.543µm

y y

dd

x

y

II Escuela de Optica Biomedica, Puebla, 2011

x y

d

d

d

D = 0.48 µmµs = 0.89 cm-1

l = 0.543µm

d

x

y

II Escuela de Optica Biomedica, Puebla, 2011

D = 0.48 µmµs = 0.89 cm-1

l = 0.543µm

d

y y

d

x

y

II Escuela de Optica Biomedica, Puebla, 2011

Isosurface Pol= 0.5

D = 0.01 µmµs = 0.89 cm-1

l = 0.543µm

xy

d

II Escuela de Optica Biomedica, Puebla, 2011

Isosurface Pol = 0.9

D = 0.48 µmµs = 0.89 cm-1

l = 0.543µm

xy

d

II Escuela de Optica Biomedica, Puebla, 2011

Poincaré sphere analysis, Ellipticity

Im()

Re()+1-1

+i

-i

tan() i tan(ε)

1 i tan(ε)tan()

I Ex

2 Ey2

Q Ex

2 Ey2 I cos(2ε)cos(2)

U 2Ex Ey cos() I cos(2ε)sin(2)

V 2Ex Ey sin() I sin(2ε)

II Escuela de Optica Biomedica, Puebla, 2011

Ellipticity

0.01µm 10 µm

l = 543nm

2 scattering events19 scattering events

II Escuela de Optica Biomedica, Puebla, 2011

Particle effect on polarization

• Depolarize faster• Less forward

directed• Turn incident

polarized light into another linear state

• Depolarize slower– Large g effect

• More forward directed

• Turn incident polarized light into elliptical states

Small spheres Large spheres