Beam
[1]:
import nexus as nx
import numpy as np
# set beam along pi polarization via initialization parameters
beam = nx.Beam(polarization = 1,
mixing_angle = 0,
canting_angle = 90,
id="my beam",
profile = "g", # Gaussian beam profile
fwhm = nx.Var(0.21, min=0, max=1, fit =True, id="beam fwhm")
)
print(beam)
print(beam.matrix)
print("")
print(beam.jones_vector)
print("")
print(beam.ComplexCoherence())
Beam
.id: my beam
.matrix:
[[0.000000e+00+0.j 6.123234e-17+0.j]
[6.123234e-17+0.j 1.000000e+00+0.j]]
.jones_vector:
[[nan+nanj]
[nan+nanj]]
.profile: g
.fwhm (mm): Var.value = 0.21, .min = 0.0, .max = 1.0, .fit: True, .id: beam fwhm
.Polarization(): 1.0
.Coherence(): nan
.PhaseDifference() [sigma - pi](rad): nan
[[0.000000e+00+0.j 6.123234e-17+0.j]
[6.123234e-17+0.j 1.000000e+00+0.j]]
[[nan+nanj]
[nan+nanj]]
(nan+nanj)
[2]:
beam = nx.Beam(id="new beam")
beam.CircularLeft()
print(beam)
print(beam.ComplexCoherence())
Beam
.id: new beam
.matrix:
[[ 0.5+0.j -0. -0.5j]
[ 0. +0.5j 0.5+0.j ]]
.jones_vector:
[[0.70710678+0.j ]
[0. +0.70710678j]]
.profile: g
.fwhm (mm): Var.value = 0.0, .min = 0.0, .max = inf, .fit: False, .id: FWHM
.Polarization(): 1.0
.Coherence(): 0.9999999999999998
.PhaseDifference() [sigma - pi](rad): -1.5707963267948966
(-0-0.9999999999999998j)
[3]:
# set coherency matrix for unpolarized beam
beam.SetCoherencyMatrix(np.array([[1,0], [0, 1]], dtype=complex))
print(beam)
print(beam.ComplexCoherence())
Beam
.id: new beam
.matrix:
[[1.+0.j 0.+0.j]
[0.+0.j 1.+0.j]]
.jones_vector:
[[nan+nanj]
[nan+nanj]]
.profile: g
.fwhm (mm): Var.value = 0.0, .min = 0.0, .max = inf, .fit: False, .id: FWHM
.Polarization(): 0.0
.Coherence(): 0.0
.PhaseDifference() [sigma - pi](rad): 0.0
0j
[4]:
# set Jones vector for a fully sigma polarized beam
beam.SetJonesVector(np.array([1,0], dtype=complex))
print(beam)
print(beam.ComplexCoherence())
Beam
.id: new beam
.matrix:
[[1.+0.j 0.+0.j]
[0.+0.j 0.+0.j]]
.jones_vector:
[[1.+0.j]
[0.+0.j]]
.profile: g
.fwhm (mm): Var.value = 0.0, .min = 0.0, .max = inf, .fit: False, .id: FWHM
.Polarization(): 1.0
.Coherence(): nan
.PhaseDifference() [sigma - pi](rad): nan
(nan+nanj)
[5]:
beam.LinearSigma()
beam.Rotate(45)
print(beam)
print(beam.ComplexCoherence())
Beam
.id: new beam
.matrix:
[[0.5+0.j 0.5+0.j]
[0.5+0.j 0.5+0.j]]
.jones_vector:
[[0.70710678+0.j]
[0.70710678+0.j]]
.profile: g
.fwhm (mm): Var.value = 0.0, .min = 0.0, .max = inf, .fit: False, .id: FWHM
.Polarization(): 1.0
.Coherence(): 1.0
.PhaseDifference() [sigma - pi](rad): 0.0
(1+0j)
[6]:
beam.CircularLeft()
print(beam)
print(beam.Polarization())
print(beam.Coherence())
print(beam.PhaseDifference())
print(beam.ComplexCoherence())
Beam
.id: new beam
.matrix:
[[ 0.5+0.j -0. -0.5j]
[ 0. +0.5j 0.5+0.j ]]
.jones_vector:
[[0.70710678+0.j ]
[0. +0.70710678j]]
.profile: g
.fwhm (mm): Var.value = 0.0, .min = 0.0, .max = inf, .fit: False, .id: FWHM
.Polarization(): 1.0
.Coherence(): 0.9999999999999998
.PhaseDifference() [sigma - pi](rad): -1.5707963267948966
1.0
0.9999999999999998
-1.5707963267948966
(-0-0.9999999999999998j)