shadow4.beamline.optical_elements.mirrors package

Submodules

shadow4.beamline.optical_elements.mirrors.s4_additional_numerical_mesh_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_additional_numerical_mesh_mirror.S4AdditionalNumericalMeshMirror(ideal_mirror: S4Mirror = None, numerical_mesh_mirror: S4NumericalMeshMirror = None, name='Mirror with Additional Numerical Mesh')[source]

Bases: S4NumericalMeshMirror

Constructor.

Parameters:
  • ideal_mirror (instance of S4Mirror) – The mirror baseline.

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

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

Return type:

instance of S4AdditionalNumericalMeshMirror.

get_ideal()[source]

get the ideal optical element.

Return type:

instance of S4Mirror

ideal_mirror()[source]

get the ideal optical element.

Return type:

instance of S4Mirror

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.mirrors.s4_additional_numerical_mesh_mirror.S4AdditionalNumericalMeshMirrorElement(optical_element: S4AdditionalNumericalMeshMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4AdditionalNumericalMeshMirrorElement

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.mirrors.s4_conic_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_conic_mirror.S4ConicMirror(name='Conic Mirror', 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], f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4ConicOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

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

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4ConicMirror.

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.mirrors.s4_conic_mirror.S4ConicMirrorElement(optical_element: S4ConicMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4ConicMirrorElement

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.mirrors.s4_ellipsoid_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_ellipsoid_mirror.S4EllipsoidMirror(name='Ellipsoid Mirror', boundary_shape=None, surface_calculation=0, is_cylinder=False, cylinder_direction=0, convexity=0, min_axis=0.0, maj_axis=0.0, pole_to_focus=0.0, p_focus=0.0, q_focus=0.0, grazing_angle=0.0, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4EllipsoidOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • surface_calculation (int, optional) –

    flag:

    0 = SurfaceCalculation.INTERNAL, 1 = SurfaceCalculation.EXTERNAL.

  • is_cylinder (int, optional) –

    flag:

    0=No (there is revolution symmetry along Y) 1=Yes (flat surface along X or Y).

  • cylinder_direction (int (as defined by Direction), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • convexity (int (as defined by Convexity), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • min_axis (float, optional) – For surface_calculation=0, The minor axis of the ellipsoid (2a).

  • maj_axis (float, optional) – For surface_calculation=0, The major axis of the ellipsoid (2b)

  • pole_to_focus (float, optional) – For surface_calculation=0, the p or q distance (from focus to center of the optical element).

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4EllipsoidMirror.

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.mirrors.s4_ellipsoid_mirror.S4EllipsoidMirrorElement(optical_element: S4EllipsoidMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4EllipsoidMirrorElement

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.mirrors.s4_hyperboloid_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_hyperboloid_mirror.S4HyperboloidMirror(name='Hyperboloid Mirror', boundary_shape=None, surface_calculation=0, is_cylinder=False, cylinder_direction=0, convexity=0, min_axis=0.0, maj_axis=0.0, pole_to_focus=0.0, p_focus=0.0, q_focus=0.0, grazing_angle=0.0, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4HyperboloidOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • surface_calculation (int, optional) –

    flag:

    0 = SurfaceCalculation.INTERNAL, 1 = SurfaceCalculation.EXTERNAL.

  • is_cylinder (int, optional) –

    flag:

    0=No (there is revolution symmetry along Y) 1=Yes (flat surface along X or Y).

  • cylinder_direction (int (as defined by Direction), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • convexity (int (as defined by Convexity), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • min_axis (float, optional) – For surface_calculation=0, The minor axis of the hyperboloid (2a).

  • maj_axis (float, optional) – For surface_calculation=0, The major axis of the hyperboloid (2b)

  • pole_to_focus (float, optional) – For surface_calculation=0, the p or q distance (from focus to center of the optical element).

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=erefraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4HyperboloidMirror.

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.mirrors.s4_hyperboloid_mirror.S4HyperboloidMirrorElement(optical_element: S4HyperboloidMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4HyperboloidMirrorElement

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.mirrors.s4_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_mirror.S4Mirror(name='Undefined', boundary_shape=None, surface_shape=None, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: Mirror

Shadow4 Mirror Class This is a base class for mirrors. Use derived classes for plane or other curved mirror surfaces.

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • surface_shape (instance of SurfaceShape, optional) – The surface shape of the mirror.

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4Mirror.

get_info()[source]

Returns the specific information of the S4 mirror 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.mirrors.s4_mirror.S4MirrorElement(optical_element: S4Mirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

The base class for Shadow4 mirror element. It is made of a S4Mirror 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 S4MirrorElement.

set_grazing_angle(theta_grazing, theta_azimuthal=None)[source]

Sets the grazing angle.

Parameters:
  • theta_grazing (float, optional) – The grazing angle in rad.

  • theta_azimuthal (float, optional) – The azimuthal angle in rad.

trace_beam(**params)[source]

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

Parameters:
  • **params (generic parameters can be passed, in particular:) –

  • flag_lost_value (float, optional) – value to flag lost rays (default=-1).

  • change_reference_system_in (boolean, optional) – indicates if the input beam is converted to local o.e. frame (default=True).

  • change_reference_system_out (boolean, optional) – indicates if the outgoing beam is converted image o.e. frame (default=True).

Returns:

(output_beam, footprint) instances of S4Beam.

Return type:

tuple

shadow4.beamline.optical_elements.mirrors.s4_numerical_mesh_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_numerical_mesh_mirror.S4NumericalMeshMirror(name='Numerical Mesh Mirror', boundary_shape=None, xx=None, yy=None, zz=None, surface_data_file='', f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4NumericalMeshOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • xx (ndarray, optional) – the 1D array with the X points.

  • yy (ndarray, optional) – the 1D array with the Y points.

  • zz (ndarray, optional) – the 2D [shape Nx,Ny] array with the Z points.

  • surface_data_file (str, optional) – the name of the h5 file with the mesh.

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4NumericalMeshMirror.

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.mirrors.s4_numerical_mesh_mirror.S4NumericalMeshMirrorElement(optical_element: S4NumericalMeshMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4NumericalMeshMirrorElement

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.mirrors.s4_paraboloid_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_paraboloid_mirror.S4ParaboloidMirror(name='Paraboloid Mirror', boundary_shape=None, at_infinity=0, surface_calculation=0, p_focus=0.0, q_focus=0.0, grazing_angle=0.0, parabola_parameter=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=0, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4ParaboloidOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • surface_calculation (int, optional) –

    flag:

    0 = SurfaceCalculation.INTERNAL, 1 = SurfaceCalculation.EXTERNAL.

  • is_cylinder (int, optional) –

    flag:

    0=No (there is revolution symmetry along Y) 1=Yes (flat surface along X or Y).

  • cylinder_direction (int (as defined by Direction), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • convexity (int (as defined by Convexity), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • parabola_parameter (float, optional) – For surface_calculation=0, The parabola parameter PARAM (y^2 = 2 PARAM z)

  • at_infinity (int, optional) –

    For surface_calculation=0, flag to indicate that

    0: the source is at infinity (focusing paraboloid) = Side.SOURCE. 1: the image is at infinity (collimating paraboloid) = Side.IMAGE.

  • pole_to_focus (float, optional) – For surface_calculation=0, the p or q distance (from focus to center of the optical element).

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4ParaboloidMirror.

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.mirrors.s4_paraboloid_mirror.S4ParaboloidMirrorElement(optical_element: S4ParaboloidMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4ParaboloidMirrorElement

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.mirrors.s4_plane_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_plane_mirror.S4PlaneMirror(name='Plane Mirror', boundary_shape=None, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4PlaneOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4PlaneMirror.

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.mirrors.s4_plane_mirror.S4PlaneMirrorElement(optical_element: S4PlaneMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4PlaneMirrorElement

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.mirrors.s4_sphere_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_sphere_mirror.S4SphereMirror(name='Sphere Mirror', boundary_shape=None, surface_calculation=1, is_cylinder=False, cylinder_direction=0, convexity=0, radius=1.0, p_focus=0.0, q_focus=0.0, grazing_angle=0.0, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4SphereOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • surface_calculation (int, optional) –

    flag:

    0 = SurfaceCalculation.INTERNAL, 1 = SurfaceCalculation.EXTERNAL.

  • is_cylinder (int, optional) –

    flag:

    0=No (there is revolution symmetry along Y) 1=Yes (flat surface along X or Y).

  • cylinder_direction (int (as defined by Direction), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • convexity (int (as defined by Convexity), optional) – NONE = -1, UPWARD = 0, DOWNWARD = 1.

  • radius (float, optional) – The radius of the sphere.

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file,

    • 1=refraction index,

    • 2=user defined file (1D angle in mrad, reflectivity),

    • 3=user defined file (1D energy in eV, reflectivity),

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity),

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4SphereMirror.

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.mirrors.s4_sphere_mirror.S4SphereMirrorElement(optical_element: S4SphereMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4SphereMirrorElement

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.mirrors.s4_toroid_mirror module

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

class shadow4.beamline.optical_elements.mirrors.s4_toroid_mirror.S4ToroidMirror(name='Toroid Mirror', boundary_shape=None, surface_calculation=1, min_radius=0.1, maj_radius=1.0, f_torus=0, p_focus=0.0, q_focus=0.0, grazing_angle=0.0, f_reflec=0, f_refl=0, file_refl='', refraction_index=1.0, coating_material='', coating_density=1.0, coating_roughness=0.0, dabax=None)[source]

Bases: S4Mirror, S4ToroidOpticalElementDecorator

Constructor.

Parameters:
  • name (str, optional) – The name of the mirror.

  • boundary_shape (instance of BoundaryShape, optional) – The boundary shape of the mirror.

  • surface_calculation (int, optional) –

    flag:

    0 = SurfaceCalculation.INTERNAL, 1 = SurfaceCalculation.EXTERNAL.

  • 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).

  • f_reflec (int, optional) –

    the reflectivity of surface:
    • 0=no reflectivity,

    • 1=full polarization.

  • f_refl (int, optional) –

    A flag to indicate the source of reflectivities:
    • 0=prerefl file

    • 1=refraction index

    • 2=user defined file (1D angle in mrad, reflectivity)

    • 3=user defined file (1D energy in eV, reflectivity)

    • 4=user defined file (2D energy in eV, angle in mrad, reflectivity)

    • 5=direct calculation using xraylib,

    • 6=direct calculation using dabax.

  • file_refl (str, optional) – name of user defined file (for f_refl=0).

  • refraction_index (complex, optional) – complex scalar with refraction index n (for f_refl=1).

  • material (str, optional) – string with material formula (for f_refl=5,6)

  • density (float, optional) – material density in g/cm^3 (for f_refl=5,6)

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

Return type:

instance of S4ToroidMirror.

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.mirrors.s4_toroid_mirror.S4ToroidMirrorElement(optical_element: S4ToroidMirror = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MirrorElement

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 S4ToroidMirrorElement

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

Module contents