Beam
- class nexus.Beam(polarization=1, mixing_angle=0, canting_angle=0, profile='g', fwhm=0, id='')
Constructor for the
Beam
class. Default values set a linear polarization along \(\sigma\). See Eq. (9), [Sturhahn2000], however, the canting angle given in Nexus is multiplied by 2 to give a polarization of \(\pi\) at 90 degree.- Parameters:
polarization (float) – Degree of polarization, 0 to 1.
mixing_angle (float) –
Mixing angle (deg)
0 degree linear polarization.
+90 degree circular left polarization.
-90 degree circular right polarization.
canting_angle (float) – Canting angle of the beam with respect to sigma direction (deg).
profile (string) –
Profile of the beam for grazing incidence scattering. The beam profile is only considered in the methods
Reflectivity
,Transmission
,NuclearReflectivity
andNuclearReflectivityEnergy
.g - Gaussian profile.
r - Rectangular profile.
n - No beam profile correction.
Changed in version 1.0.2: Rectangular beam profile correction wrong prior to version 1.0.2
fwhm (float or
Var
) – Full width half maximum of the beam in the scattering plane of grazing scattering geometry (mm). Only needed for grazing incidence geometry.id (string) – User identifier.
- matrix
2x2 complex Jones matrix of the beam.
- Type:
ndarray
- jones_vector
Jones vector for a fully coherent beam, 2-element vector. Can only be set via :attr:` or special methods with fully polarized beam properties.
- Type:
ndarray
- profile
Profile of the beam for grazing incidence scattering. The beam profile is only considered in the methods
Reflectivity
,Transmission
,NuclearReflectivity
andNuclearReflectivityEnergy
.g - Gaussian profile.
r - Rectangular profile.
n - No beam profile correction.
Changed in version 1.0.2: Rectangular beam profile correction wrong prior to version 1.0.2
- Type:
string
- fwhm
Full width half maximum (FWHM) of the beam in the scattering plane of grazing scattering geometry (mm). Only needed for grazing incidence geometry.
- Type:
- id
User identifier.
- Type:
string
- CircularLeft()
Set the beam to circular left polarized light.
- CircularRight()
Set the beam to circular right polarized light.
- Coherence()
Calculates the coherence of the beam [Born]
\[|\mu| = | \frac{J_{\sigma \pi}}{\sqrt(J_{\sigma \sigma}) \sqrt(J_{\pi \pi})} |\]It is a measure of the correlation between the \(E\)-vector components.
If
nan
is returned one \(E\)-vector component is zero.- Returns:
Degree of coherence between \(E_{\sigma}\) and \(E_{\pi}\).
- Return type:
float
- ComplexCoherence()
Calculates the complex coherence of the beam [Born]
\[\mu = \frac{J_{\sigma \pi}}{\sqrt(J_{\sigma \sigma}) \sqrt(J_{\pi \pi})}\]It is a measure of the correlation between the \(E\)-vector components.
If
nan
is returned one \(E\)-vector component is zero.- Returns:
Complex coherence between \(E_{\sigma}\) and \(E_{\pi}\).
- Return type:
complex
- LinearPi()
Set the beam to \(\pi\) polarized light.
- LinearSigma()
Set the beam to \(\sigma\) polarized light.
- PhaseDifference()
Calculates the phase difference between \(E_{\sigma}\) and \(E_{\pi}\) [Born]
If
nan
is returned one \(E\)-vector component is zero.- Returns:
Phase difference between \(E_{\sigma}\) and \(E_{\pi}\).
- Return type:
float
- Polarization()
Calculates the degree of polarization [Born]
\[P = \frac{I_{pol}}{I_{tot}} = \sqrt{1 - \frac{4|\mathbf{J}|}{(J_{\sigma \sigma} + J_{\pi \pi})^2}}\]- Returns:
Degree of polarization. 0 to 1.
- Return type:
float
- Rotate(angle)
Rotate the beam by the given angle. Jones vector and matrix are rotated.
- Parameters:
angle (float) – angle of rotation (degree).
- SetCoherencyMatrix(matrix)
Set the coherency matrix. The Jones vector is invalid in this case. To set a fully coherent beam use
SetJonesVector
or a specific method.- Parameters:
matrix (ndarray) – 2x2 complex coherency matrix.
- SetJonesVector(jones_vector, angle=0)
Sets the Jones vector and the coherency matrix.
- Parameters:
jones_vector (ndarray) – Two element Jones vector.
angle (float) – Rotation angle of Jones vector with respect to \(\sigma\) (deg).
- Unpolarized()
Set the beam to unpolarized radiation.
- ValidJonesVector()
Checks a valid Jones vector is set.
- Returns:
True or False.
- Return type:
bool
Different ways to define a Beam
.
# initialize beam, standard is fully sigma polarized
beam = nx.Beam()
# set beam to pi polarization
beam.LinearPi()
print(beam.matrix)
# set beam to unpolarized
beam.Unpolarized()
print(beam)
# set beam to sigma polarization via initialization parameters
# Rectangular beam profile, beam with 1 mm height
beam = nx.Beam(polarization = 1, mixing_angle = 0, profile = "r", fwhm = 1)
# set beam along pi polarization via initialization parameters
beam = nx.Beam(polarization = 1, mixing_angle = 0, canting_angle = 90)
beam = nx.Beam()
# set coherency matrix for unpolarized detection
beam.SetCoherencyMatrix(np.array([[1,0], [0, 1]], dtype=complex))
beam = nx.Beam()
# set Jones vector for fully sigma polarized beam
beam.SetJonesVector(np.array([1,0], dtype=complex))
print(beam.jones_vector)
print(beam.matrix)
# circularly right polarized beam
beam = nx.Beam(polarization = 1, mixing_angle = -90)
print(beam.Polarization())
print(beam.Coherence())
beam = nx.Beam()
# linear polarization at 45 deg rotation
beam.SetJonesVector(np.array([1, 0], dtype=complex), 45)