shadow4.beamline.optical_elements.crystals package

Submodules

shadow4.beamline.optical_elements.crystals.s4_additional_numerical_mesh_crystal module

The s4 additional numerical mesh crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_additional_numerical_mesh_crystal.S4AdditionalNumericalMeshCrystal(ideal_crystal: S4Crystal = None, numerical_mesh_crystal: S4NumericalMeshCrystal = None, name='Crystal with Additional Numerical Mesh')[source]

Bases: S4NumericalMeshCrystal

Constructor.

Parameters:
  • ideal_mirror (instance of S4Crystal) – The crystal baseline.

  • numerical_mesh_crystal (instance of S4NumericalMeshMirror) – The numerical mesh to be added to the ideal crystal.

  • name (str, optional) – The name of the crystal.

Return type:

instance of S4AdditionalNumericalMeshCrystal.

get_ideal()[source]

get the ideal optical element.

Return type:

instance of S4Crystal

ideal_crystal()[source]

get the ideal optical element.

Return type:

instance of S4Crystal

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_additional_numerical_mesh_crystal.S4AdditionalNumericalMeshCrystalElement(optical_element: S4AdditionalNumericalMeshCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_conic_crystal module

The s4 conic crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_conic_crystal.S4ConicCrystal(name='Conic crystal', boundary_shape=None, conic_coefficients=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, dabax=None)[source]

Bases: S4Crystal, S4ConicOpticalElementDecorator

Shadow4 Conic Crystal Class This is a spherically curved perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • conic_coefficients (list, optional) – The list with the 10 conic coefficients.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4ConicCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_conic_crystal.S4ConicCrystalElement(optical_element: S4ConicCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_crystal module

The s4 crystal base class (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_crystal.S4Crystal(name='Undefined', boundary_shape=None, surface_shape=None, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, f_bragg_a=False, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=0, f_phot_cent=0, phot_cent=8000.0, f_ext=0, material_constants_library_flag=0, file_refl='', method_efields_management=0, dabax=None)[source]

Bases: Crystal

Shadow4 Crystal Class This is a base class for perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Use derived classes for plane or other curved crystal surfaces.

Use other classes for (to be developed):
  • S4TransmissionCrystal : Perfect crystal in transmission (Bragg-transmitted beam, Laue-diffracted and Laue-transmited)

  • S4JohanssonCrystal : Johanssong curved perfect crystals (in Bragg reflection).

  • S4MosaicCrystal : Mosaic crystals (in Bragg reflection).

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • surface_shape (instance of SurfaceShape, optional) – The information on crystal surface.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in A.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4Crystal.

get_info()[source]

Returns the specific information of the S4 crystal optical element.

Return type:

str

to_python_code_boundary_shape()[source]

Creates a code block with information of boundary shape.

Returns:

The text with the code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_crystal.S4CrystalElement(optical_element: S4Crystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

The base class for Shadow4 crystal element. It is made of a S4Crystal and an ElementCoordinates instance. It also includes the input beam.

Use derived classes for plane or other curved crystal surfaces.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

Return type:

instance of S4CrystalElement.

align_crystal()[source]

Sets the adequate incident and reflection angles to match the tuning energy.

set_crystalpy_diffraction_setup()[source]

Returns the crystalpy DiffractionSetup.

Return type:

instance of crystalpy DiffractionSetupAbstract

trace_beam(**params)[source]

Runs (ray tracing) the input beam through the element.

Parameters:
  • **params (accepted parameters, in particular:) –

  • flag_lost_value (float) – numeric value to set in the flag column when ray is lost.

Returns:

(output_beam, footprint) instances of S4Beam.

Return type:

tuple

shadow4.beamline.optical_elements.crystals.s4_ellipsoid_crystal module

The s4 ellipsoid crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_ellipsoid_crystal.S4EllipsoidCrystal(name='Ellipsoid crystal', boundary_shape=None, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, min_axis=0.0, maj_axis=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=1, dabax=None)[source]

Bases: S4Crystal, S4EllipsoidOpticalElementDecorator

Shadow4 Ellipsoid Crystal Class This is an ellipsoidal curved perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • is_cylinder (int, optional) – Flag to indicate that the surface has cylindrical symmetry (it is flat in one direction).

  • cylinder_direction (int, optional) – For is_cylinder=1, the direction where the surface is flat. Use synedDirection.TANGENTIAL (0) or Direction.SAGITTAL (1).

  • convexity (int, optional) – The surface is concave (0) or convex (1). Use syned Convexity.UPWARD (0) for concave or Convexity.DOWNWARD (1).

  • min_axis (float, optional) – The ellipse/ellipsoid minor axis.

  • maj_axis (float, optional) – The ellipse/ellipsoid major axis.

  • pole_to_focus (float, optional) – The distance from focus 1 (locus of the source) to the crystal pole

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4EllipsoidCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_ellipsoid_crystal.S4EllipsoidCrystalElement(optical_element: S4EllipsoidCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 ellipsoid crystal element. It is made of a S4EllipsoidCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_hyperboloid_crystal module

The s4 hyperboloid crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_hyperboloid_crystal.S4HyperboloidCrystal(name='Hyperboloid crystal', boundary_shape=None, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, min_axis=0.0, maj_axis=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=0, dabax=None)[source]

Bases: S4Crystal, S4HyperboloidOpticalElementDecorator

Shadow4 Hyperboloid Crystal Class This is a spherically curved perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • is_cylinder (int, optional) – Flag to indicate that the surface has cylindrical symmetry (it is flat in one direction).

  • cylinder_direction (int, optional) – For is_cylinder=1, the direction where the surface is flat. Use synedDirection.TANGENTIAL (0) or Direction.SAGITTAL (1).

  • convexity (int, optional) – The surface is concave (0) or convex (1). Use syned Convexity.UPWARD (0) for concave or Convexity.DOWNWARD (1).

  • min_axis (float, optional) – The hyperbola/hyperboloid minor axis.

  • maj_axis (float, optional) – The hyperbola/hyperboloid major axis.

  • pole_to_focus (float, optional) – The distance from focus 1 (locus of the source) to the crystal pole.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4HyperboloidCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_hyperboloid_crystal.S4HyperboloidCrystalElement(optical_element: S4HyperboloidCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 hyperboloid crystal element. It is made of a S4HyperboloidCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_numerical_mesh_crystal module

The s4 numerical mesh crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_numerical_mesh_crystal.S4NumericalMeshCrystal(name='Numerical Mesh Crystal', boundary_shape=None, xx=None, yy=None, zz=None, surface_data_file='', material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, f_bragg_a=False, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, f_ext=0, material_constants_library_flag=0, file_refl='', dabax=None)[source]

Bases: S4Crystal, S4NumericalMeshOpticalElementDecorator

Shadow4 Mesh Crystal Class This is a curved perfect crystal in reflection geometry (Bragg), using the diffracted beam. The surface shape is defined as a numerical mesh, either in an hdf5 file or in arrays.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • xx (numpy array, optional) – The array with the X (width) coordinates.

  • yy (numpy array, optional) – The array with the Y (length) coordinates.

  • zz (numpy array, optional) – The array with the Z(X,Y) coordinates.

  • surface_data_file (str, optional) – The h5 file name with the mesh following the Oasys convention.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4NumericalMeshCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_numerical_mesh_crystal.S4NumericalMeshCrystalElement(optical_element: S4NumericalMeshCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 mesh crystal element. It is made of a S4meshCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_paraboloid_crystal module

The s4 paraboloid crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_paraboloid_crystal.S4ParaboloidCrystal(name='Paraboloid crystal', boundary_shape=None, at_infinity=0, parabola_parameter=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=1, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, dabax=None)[source]

Bases: S4Crystal, S4ParaboloidOpticalElementDecorator

Shadow4 Paraboloid Crystal Class This is a spherically curved perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • is_cylinder (int, optional) – Flag to indicate that the surface has cylindrical symmetry (it is flat in one direction).

  • cylinder_direction (int, optional) – For is_cylinder=1, the direction where the surface is flat. Use synedDirection.TANGENTIAL (0) or Direction.SAGITTAL (1).

  • convexity (int, optional) – The surface is concave (0) or convex (1). Use syned Convexity.UPWARD (0) for concave or Convexity.DOWNWARD (1).

  • at_infinity (int, optional) – A flag to indicate if the source is at infinity or if the image is at infinity 0: at_infinity=Side.SOURCE; 1: at_infinity=Side.IMAGE

  • parabola_parameter (float, optional) – The parabola parameter in m.

  • pole_to_focus (float, optional) – The distance from the crystal pole to the focus in m.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (int, optional TODO: delete? for crystals is always 0) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters.

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4paraboloidCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_paraboloid_crystal.S4ParaboloidCrystalElement(optical_element: S4ParaboloidCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 paraboloid crystal element. It is made of a S4ParaboloidCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam..

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_plane_crystal module

The s4 plane crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_plane_crystal.S4PlaneCrystal(name='Plane crystal', boundary_shape=None, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, method_efields_management=0, dabax=None)[source]

Bases: S4Crystal, S4PlaneOpticalElementDecorator

Shadow4 Plane Crystal Class This is a plane perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4PlaneCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_plane_crystal.S4PlaneCrystalElement(optical_element: S4PlaneCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 plane crystal element. It is made of a S4PlaneCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_sphere_crystal module

The s4 sphere crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_sphere_crystal.S4SphereCrystal(name='Sphere crystal', boundary_shape=None, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, radius=1.0, is_cylinder=False, cylinder_direction=0, convexity=0, dabax=None)[source]

Bases: S4Crystal, S4SphereOpticalElementDecorator

Shadow4 Sphere Crystal Class This is a spherically curved perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • is_cylinder (int, optional) – Flag to indicate that the surface has cylindrical symmetry (it is flat in one direction).

  • cylinder_direction (int, optional) – For is_cylinder=1, the direction where the surface is flat. Use synedDirection.TANGENTIAL (0) or Direction.SAGITTAL (1).

  • convexity (int, optional) – The surface is concave (0) or convex (1). Use syned Convexity.UPWARD (0) for concave or Convexity.DOWNWARD (1).

  • radius (float, optional) – The surface spherical radius.

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4SphereCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_sphere_crystal.S4SphereCrystalElement(optical_element: S4SphereCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 sphere crystal element. It is made of a S4SphereCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

shadow4.beamline.optical_elements.crystals.s4_toroid_crystal module

The s4 toroid crystal (optical element and beamline element).

class shadow4.beamline.optical_elements.crystals.s4_toroid_crystal.S4ToroidCrystal(name='Toroid crystal', boundary_shape=None, material=None, miller_index_h=1, miller_index_k=1, miller_index_l=1, asymmetry_angle=0.0, is_thick=0, thickness=0.01, f_central=False, f_phot_cent=0, phot_cent=8000.0, file_refl='', f_bragg_a=False, f_ext=0, material_constants_library_flag=0, min_radius=0.1, maj_radius=1.0, f_torus=0, dabax=None)[source]

Bases: S4Crystal, S4ToroidOpticalElementDecorator

Shadow4 Toroid Crystal Class This is a toroid curved perfect crystal in reflection geometry (Bragg), using the diffracted beam.

Constructor.

Parameters:
  • name (str, optional) – A name for the crystal

  • boundary_shape (instance of BoundaryShape, optional) – The information on the crystal boundaries.

  • min_radius (float, optional) – The minor axis of the toroid in m. This corresponds to the sagittal optical surface.

  • maj_radius (float, optional) – The optical surface major radius in m. This corresponds to the tangential optical surface (it is not the radius of the toroid).

  • f_torus (int, optional) –

    Flag to indicate which optical surface is in use (where the mirror pole is located). Values are:
    • 0=lower/outer (tangential: concave / sagittal:concave),

    • 1=lower/inner (tangential: concave / sagittal:convex) ,

    • 2=upper/inner (tangential: convex / sagittal:concave),

    • 3=upper/outer (tangential: convex / sagittal:convex).

  • material (str, optional) – The crystal material name (a name accepted by crystalpy).

  • miller_index_h (int, optional) – The Miller index H.

  • miller_index_k (int, optional) – The Miller index K.

  • miller_index_l (int, optional) – The Miller index L.

  • f_bragg_a (int, optional) – Asymmetric crystal 0:No, 1:Yes.

  • asymmetry_angle (float, optional) – For f_bragg_a=1, the asymmetry angle (angle between crystal planes and surface) in rads.

  • is_thick (int, optional) – Use thick crystal approximation.

  • thickness (float, optional) – For is_thick=0, the crystal thickness in m.

  • f_central (int, optional) – Flag for autosetting the crystal to the corrected Bragg angle.

  • f_phot_cent (int, optional) – 0: setting photon energy in eV, 1:setting photon wavelength in m.

  • phot_cent (float, optional) – for f_central=1, the value of the photon energy (f_phot_cent=0) or photon wavelength (f_phot_cent=1).

  • f_ext (inf, optional) – Flag for autosetting the crystal surface parameters. 0: internal/calculated parameters, 1:external/user defined parameters. TODO: delete?

  • material_constants_library_flag (int, optional) – Flag for indicating the origin of the crystal data: 0: xraylib, 1: dabax, 2: preprocessor file v1, 3: preprocessor file v2.

  • file_refl (str, optional) – for material_constants_library_flag=2,3, the name of the file containing the crystal parameters.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for material_constants_library_flag=1).

Return type:

instance of S4ToroidCrystal.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

class shadow4.beamline.optical_elements.crystals.s4_toroid_crystal.S4ToroidCrystalElement(optical_element: S4ToroidCrystal = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4CrystalElement

The Shadow4 toroid crystal element. It is made of a S4ToroidCrystal and an ElementCoordinates instance. It also includes the input beam.

Constructor.

Parameters:
  • optical_element (instance of OpticalElement, optional) – The syned optical element.

  • coordinates (instance of ElementCoordinates, optional) – The syned element coordinates.

  • movements (instance of S4BeamlineElementMovements, optional) – The S4 element movements.

  • input_beam (instance of S4Beam, optional) – The S4 incident beam.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

Module contents