Beam

A Beam object is described by its polarization state and the beam profile. The beam energy is not given here and automatically chosen by Nexus from the resonant isotope for nuclear scattering methods. For pure electronic calculations the energy is specified in the Measurement.

The following parameters are Var objects and can be fit:

  • FWHM

Polarization properties

When you initialize a beam you can specify several parameters (which are similar to the parameters defined in CONUSS). Those are the degree of polarization, the mixing angle between the polarization components, and the canting angle of the beam with respect to the \(\sigma\) direction.

import nexus as nx
import numpy as np

# set beam along pi polarization via initialization parameters
# those values are the default arguments
beam = nx.Beam(polarization = 1, mixing_angle = 0, canting_angle = 90)

print(beam)

The beam is described by different properties:

  • the Jones vector for fully coherent beams only.

  • the coherency matrix (a density matrix) for arbitrary polarizations.

When you define a Jones vector, the coherency matrix will automatically be calculated. Setting a coherency matrix will not set a Jones vector, because it is not possible in general.

The default arguments of nx.Beam() create a linearly polarized beam along \(\sigma\) direction. The initialization parameters will not create a Jones vector but only the coherency matrix of the beam. If you want an unpolarized beam you can use the beam.Unpolarized() method instead of setting the polarization to zero.

When you want to calculate amplitude properties a valid Jones vector must be given. There are methods to set specific polarizations, and if the beam is fully polarized, they will also create the appropriate Jones vector. Those are

  • beam.LinearSigma()

  • beam.LinearPi()

  • beam.CircularLeft()

  • beam.CircularRight()

You can get and set the coherency matrix and the Jones vector of the beam via

beam = nx.Beam()
beam.CircularLeft()

print(beam.matrix)

print(beam.jones_vector)

# set coherency matrix for an unpolarized beam
beam.SetCoherencyMatrix(np.array([[0.5, 0], [0, 0.5]], dtype=complex))

# set Jones vector for a fully sigma polarized beam
beam.SetJonesVector(np.array([1+0j, 0]),
                    angle = 0)

The beam can also be rotated via

beam.LinearSigma()

beam.Rotate(45)

print(beam)
Beam
  .id:
  .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(): 0.9999999999999999
  .Coherence(): 1.0
  .PhaseDifference() [sigma - pi](rad): 0.0

If one of the methods return nan, one \(E\)-vector component is zero. You can also ask for the (complex) coherency, phase difference and polarization of the beam specifically

beam.CircularLeft()

print(beam.Polarization())

print(beam.Coherence())

print(beam.PhaseDifference())

print(beam.ComplexCoherence())
1.0
0.9999999999999998
-1.5707963267948966
(-0-0.9999999999999998j)

Size properties

In grazing incidence geometry the beam shape and size have to be given. The profile is either Gaussian g or rectangular r and the width parameter fwhm is given as the full width half maximum value (in mm) of the specified profile. The profile and the size will determine how much of the beam actually illuminates the sample and therefore influence the reflectivity at low angles.

Changed in version 1.0.2: Rectangular beam profile correction wrong prior to version 1.0.2

beam = nx.Beam(polarization = 1,
               mixing_angle = 0,
               profile = "g",   # Gaussian beam profile
               fwhm = 0.21)     # in mm

For a beam, only the beam profiles width fwhm is a fittable Var object.

In case you want to calculate a theoretical reflectivity without beam size correction, set the fwhm to zero.

Notebooks

beam - nb_beam.ipynb.

Please have a look to the API Reference for more information.