Apertures¶
Aperture as a combination of straight edges. |
|
Round aperture meant to represent a pipe or a flange. |
|
Convenience class for RectangularAperture in beam-stop mode. |
|
Round beamstop. |
|
Aperture or obstacle as a combination of straight edges. |
|
Convenience class for DoubleSlit in beam-stop mode. |
|
Aperture or obstacle defined as a set of polygon vertices. |
|
Convenience class for PolygonalAperture in beam-stop mode. |
|
Grid of rectangular apertures. |
|
Convenience class for GridAperture in beam-stop mode. |
|
Siemens Star aperture. |
Module apertures defines rectangular and round apertures and a set of
coplanar rectangular apertures. Rectangular apertures may have one or more
defining edges. For example, a simple obstacle, like a beam stop block would
have one edge, a block of front-end slits would have two edges at 90 degrees to
each other, and a collimator would have all four edges.
The classes have useful methods for getting divergence from the aperture size, for setting divergence (calculating the aperture size given the divergence) and for touching the beam with the aperture, i.e. calculating the minimum aperture size that lets the whole beam through.
- class xrt.backends.raycing.apertures.RectangularAperture¶
Aperture as a combination of straight edges.
- __init__(bl=None, name='', center=[0, 0, 0], kind=None, opening=None, x='auto', z='auto', alarmLevel=None, renderStyle='mask', blades={'bottom': -10, 'left': -10, 'right': 10, 'top': 10}, renderSize={'apertureBladeWidth': None, 'apertureDefaultSpan': None, 'apertureThickness': None, 'slitThicknessFraction': None}, **kwargs)¶
- bl: instance of
BeamLine Container for beamline elements. Optical elements are added to its slits list.
- name: str
User-specified name, can be used for diagnostics output.
- center: 3-sequence of floats
3D point in global system.
- blades: dict or None
Mapping of blade names to their positions relative to the aperture center. Supported keys are ‘left’, ‘right’, ‘bottom’ and ‘top’. Missing keys mean that the corresponding blade is absent.
- kind and opening: sequence
Compatibility API for existing scripts. kind defines any combination of ‘top’, ‘bottom’, ‘left’, ‘right’ and opening supplies the corresponding blade positions.
- x, z: 3-tuples or ‘auto’.
Normalized 3D vectors in the global system which determine the local x and z axes lying in the aperture plane. If x is ‘auto’, it is horizontal and normal to the beam line. If z is ‘auto’, it is vertical. Both x and z can also be set as instance attributes.
- alarmLevel: float or None.
Allowed fraction of number of rays absorbed at the aperture relative to the number of incident rays. If exceeded, an alarm output is printed in the console.
- renderStyle: str
Controls rendering style in xrtGlow. Can be either single-piece ‘mask’ or a set of individual ‘blades’.
- renderSize: dict
Per-aperture xrtGlow size overrides. Missing keys and values set to None use the corresponding global scene setting.
- bl: instance of
- get_divergence(source)¶
Gets divergences given the blade openings.
- prepare_wave(prevOE, nrays, rw=None)¶
Creates the beam arrays used in wave diffraction calculations. prevOE is the diffracting element: a descendant from
OE,RectangularApertureorRoundAperture. nrays of samples are randomly distributed over the slit area.
- propagate(beam=None, needNewGlobal=False)¶
Assigns the “lost” value to beam.state array for the rays intercepted by the aperture. The “lost” value is
-self.ordinalNum - 1000.Note
needNewGlobalis script-only and unavailable in the GUI.- needNewGlobal: bool
Script-only option. If True, returns
(beamGlobal, beamLocal)instead ofbeamLocal. The global beam is positioned at the aperture plane. xrtQook does not expose this option and ignores its value when importing layouts, using the default False.
- set_divergence(source, divergence)¶
Gets the blade openings given divergences. divergence is a sequence corresponding to kind
- touch_beam(beam)¶
Adjusts the aperture (i.e. sets self.blades) so that it touches the beam.
- class xrt.backends.raycing.apertures.RoundAperture¶
Round aperture meant to represent a pipe or a flange.
- __init__(bl=None, name='', center=[0, 0, 0], r=1, x='auto', z='auto', alarmLevel=None, renderSize={'apertureBladeWidth': None, 'apertureDefaultSpan': None, 'apertureThickness': None, 'slitThicknessFraction': None}, **kwargs)¶
A round aperture aperture.
r is the radius.
- x, z: 3-tuples or ‘auto’.
Normalized 3D vectors in the global system which determine the local x and z axes lying in the aperture plane. If x is ‘auto’, it is horizontal and normal to the beam line. If z is ‘auto’, it is vertical. Both x and z can also be set as instance attributes.
- get_divergence(source)¶
Gets the full divergence given the aperture radius.
- propagate(beam=None, needNewGlobal=False)¶
Assigns the “lost” value to beam.state array for the rays intercepted by the aperture. The “lost” value is
-self.ordinalNum - 1000.Note
needNewGlobalis script-only and unavailable in the GUI.- needNewGlobal: bool
Script-only option. If True, returns
(beamGlobal, beamLocal)instead ofbeamLocal. The global beam is positioned at the aperture plane. xrtQook does not expose this option and ignores its value when importing layouts, using the default False.
- class xrt.backends.raycing.apertures.RectangularBeamStop¶
Convenience class for RectangularAperture in beam-stop mode.
In beam-stop mode the nominal aperture opening is the stopped (solid) region, while rays outside it pass through.
- class xrt.backends.raycing.apertures.RoundBeamStop¶
Round beamstop. Descends from RoundAperture and has the same parameters.
In beam-stop mode the nominal aperture opening is the stopped (solid) region, while rays outside it pass through.
- class xrt.backends.raycing.apertures.DoubleSlit¶
Aperture or obstacle as a combination of straight edges.
- __init__(*args, **kwargs)¶
Same parameters as in
RectangularApertureand additionally shadeFraction as a value from 0 to 1.
- class xrt.backends.raycing.apertures.DoubleBeamStop¶
Convenience class for DoubleSlit in beam-stop mode.
In beam-stop mode the nominal slit openings are the stopped (solid) regions, while rays outside them pass through.
- class xrt.backends.raycing.apertures.PolygonalAperture¶
Aperture or obstacle defined as a set of polygon vertices.
- __init__(bl=None, name='', center=[0, 0, 0], opening=None, x='auto', z='auto', alarmLevel=None, vertices=[(-10, -10), (-10, 10), (10, 10), (10, -10)], renderSize={'apertureBladeWidth': None, 'apertureDefaultSpan': None, 'apertureThickness': None, 'slitThicknessFraction': None}, **kwargs)¶
- bl: instance of
BeamLine Container for beamline elements. Optical elements are added to its slits list.
- name: str
User-specified name, can be used for diagnostics output.
- center: 3-sequence of floats
3D point in global system.
- opening: sequence
Compatibility alias for vertices used by existing scripts.
- vertices: sequence
Coordinates [(x0, y0), …(xN, yN)] of the polygon vertices.
- x, z: 3-tuples or ‘auto’.
Normalized 3D vectors in the global system which determine the local x and z axes lying in the aperture plane. If x is ‘auto’, it is horizontal and normal to the beam line. If z is ‘auto’, it is vertical. Both x and z can also be set as instance attributes.
- alarmLevel: float or None.
Allowed fraction of number of rays absorbed at the aperture relative to the number of incident rays. If exceeded, an alarm output is printed in the console.
- bl: instance of
- class xrt.backends.raycing.apertures.PolygonalBeamStop¶
Convenience class for PolygonalAperture in beam-stop mode.
In beam-stop mode the nominal polygonal opening is the stopped (solid) region, while rays outside it pass through.
- class xrt.backends.raycing.apertures.GridAperture¶
Grid of rectangular apertures. See tests/raycing/test_polygonal_aperture.py
- __init__(bl=None, name='', center=[0, 0, 0], x='auto', z='auto', alarmLevel=None, dx=0.5, dz=0.5, px=1.0, pz=1.0, nx=7, nz=7, **kwargs)¶
- dx and dz: float
Opening sizes (horizontal and vertical).
- px and pz: float
Pitch steps (periods).
- nx and nz: int
The number of grid openings, counted from the central hole in -ve and +ve directions, making (2*nx+1)*(2*nz+1) rectangular holes in total.
- class xrt.backends.raycing.apertures.GridBeamStop¶
Convenience class for GridAperture in beam-stop mode.
In beam-stop mode the nominal grid openings are the stopped (solid) regions, while rays outside them pass through.
- class xrt.backends.raycing.apertures.SiemensStar¶
Siemens Star aperture. See tests/raycing/test_polygonal_aperture.py
- __init__(bl=None, name='', center=[0, 0, 0], x='auto', z='auto', alarmLevel=None, nSpokes=9, r=1, rx=0, rz=0, phi0=0, vortex=0, vortexNradial=7, **kwargs)¶
- nSpokes: int
The number of spoke openings.
- r or (rx and rz): float
The radius of spokes or ellipse semiaxes.
- phi0: float
The angle of rotation of the star. At 0 (default), the center of the top spoke is vertical.
- vortex: float
Lets the spokes bend. At =1, they bend by one spoke position.
- vortexNradial: int
Used with non-zero vortex. The number of segments in the bent spokes.
