Screens

Module screens defines a flat screen and a hemispheric screen that intercept a beam and give its image.

Screen

Flat screen for beam visualization.

HemisphericScreen

Hemispheric screen for beam visualization.

class xrt.backends.raycing.screens.Screen

Flat screen for beam visualization.

__init__(bl=None, name='', center=[0, 0, 0], x='auto', z='auto', compressX=None, compressZ=None, **kwargs)
bl: instance of BeamLine

Container for beamline elements. Optical elements are added to its screens list.

name: str

User-specified name, can be used for diagnostics output.

center: tuple of 3 floats

3D point in the global system.

x, z: 3-sequence or ‘auto’.

Normalized 3D vectors in the global system which determine the local x and z axes lying in the screen plane. If x is ‘auto’, it is horizontal and perpendicular to the beam line. If z is ‘auto’, it is vertical. Both x and z can also be set as instance attributes.

compressX, compressZ: float

Multiplicative compression coefficients for the corresponding axes. Typically are not needed. Can be useful to account for the viewing camera magnification or when the camera sees the screen at an angle.

limPhysX and limPhysY: [min, max] where min, max are floats

Physical dimensions in mm along the local x and z axes. Used for the visible screen size in Glow.

expose(beam=None, onlyPositivePath=False)

Exposes the screen to the beam. beam is in global system, the returned beam is in local system of the screen and represents the desired image.

prepare_wave(prevOE, dim1, dim2, dy=0, rw=None, condition=None)

Creates the beam arrays used in wave diffraction calculations. prevOE is the diffracting element: a descendant from OE, RectangularAperture or RoundAperture. dim1 and dim2 are x and z arrays for a flat screen or phi and theta arrays for a hemispheric screen. The two arrays are generally of different 1D shapes. They are used to create a 2D mesh by meshgrid.

condition: a callable defined in the user script with two flattened

meshgrid arrays as inputs and outputs. Can be used to select wave samples. An example:

def condition(d1s, d2s):
    cond = d1s**2 + d2s**2 <= pinholeDia**2 / 4  # in a pinhole
    return d1s[cond], d2s[cond]
class xrt.backends.raycing.screens.HemisphericScreen

Hemispheric screen for beam visualization.

__init__(bl=None, name='', center=[0, 0, 0], R=1000.0, x='auto', z='auto', phiOffset=0, thetaOffset=0, **kwargs)
x, z: 3-tuples or ‘auto’. Normalized 3D vectors in the global system

which determine the local x and z axes of the hemispheric screen. If x (the origin of azimuthal angle φ) is ‘auto’, it coincides with the beamline’s y; if z (the polar axis) is ‘auto’, it is coincides with the beamline’s x. The equator plane is then vertical. The polar angle θ is counted from -π/2 to π/2 with 0 at the equator and π/2 at the polar axis direction. Both x and z can also be set as instance attributes.

R: float

Radius of the hemisphere in mm.