shadow4.beamline.optical_elements.multilayers package

Submodules

shadow4.beamline.optical_elements.multilayers.s4_additional_numerical_mesh_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_additional_numerical_mesh_multilayer.S4AdditionalNumericalMeshMultilayer(ideal_multilayer: S4Multilayer = None, numerical_mesh_multilayer: S4NumericalMeshMultilayer = None, name='Multilayer with Additional Numerical Mesh')[source]

Bases: S4NumericalMeshMultilayer

Constructor.

Parameters:
  • ideal_multilayer (instance of S4Multilayer) – The multilayer baseline.

  • numerical_mesh_multilayer (instance of S4NumericalMeshMultilayer) – The numerical mesh to be added to the ideal multilayer.

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

Return type:

instance of S4AdditionalNumericalMeshMultilayer.

get_ideal()[source]

get the ideal optical element.

Return type:

instance of S4Multilayer

ideal_multilayer()[source]

get the ideal optical element.

Return type:

instance of S4Multilayer

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.multilayers.s4_additional_numerical_mesh_multilayer.S4AdditionalNumericalMeshMultilayerElement(optical_element: S4AdditionalNumericalMeshMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4AdditionalNumericalMeshMultilayerElement

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.multilayers.s4_conic_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_conic_multilayer.S4ConicMultilayer(name='Conic Multilayer', 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_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4ConicOpticalElementDecorator

Constructor.

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

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

  • 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=electric susceptibility

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

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

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.multilayers.s4_conic_multilayer.S4ConicMultilayerElement(optical_element: S4ConicMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4ConicMultilayerElement

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.multilayers.s4_ellipsoid_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_ellipsoid_multilayer.S4EllipsoidMultilayer(name='Ellipsoid Multilayer', 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_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4EllipsoidOpticalElementDecorator

Constructor.

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

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

  • 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=electric susceptibility

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

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

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.multilayers.s4_ellipsoid_multilayer.S4EllipsoidMultilayerElement(optical_element: S4EllipsoidMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4EllipsoidMultilayerElement

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.multilayers.s4_hyperboloid_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_hyperboloid_multilayer.S4HyperboloidMultilayer(name='Hyperboloid Multilayer', 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_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4HyperboloidOpticalElementDecorator

Constructor.

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

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

  • 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=electric susceptibility

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

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

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.multilayers.s4_hyperboloid_multilayer.S4HyperboloidMultilayerElement(optical_element: S4HyperboloidMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4HyperboloidMultilayerElement

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.multilayers.s4_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_multilayer.S4Multilayer(name='Undefined', boundary_shape=None, surface_shape=None, f_refl=0, file_refl='<not defined>', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: Multilayer

Shadow4 Multilayer Class This is a base class for multilayers. Use derived classes for plane or other curved multilayer 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_refl (int, optional) –

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

    • 1=electric susceptibility,

    • 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.multilayers.s4_multilayer.S4MultilayerElement(optical_element: S4Multilayer = 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

Returns:

(output_beam, footprint) instances of S4Beam.

Return type:

tuple

shadow4.beamline.optical_elements.multilayers.s4_numerical_mesh_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_numerical_mesh_multilayer.S4NumericalMeshMultilayer(name='Numerical Mesh Multilayer', boundary_shape=None, xx=None, yy=None, zz=None, surface_data_file='', f_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4NumericalMeshOpticalElementDecorator

Constructor.

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

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

  • 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=electric susceptibility

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

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

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.multilayers.s4_numerical_mesh_multilayer.S4NumericalMeshMultilayerElement(optical_element: S4NumericalMeshMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4NumericalMeshMultilayerElement

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.multilayers.s4_paraboloid_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_paraboloid_multilayer.S4ParaboloidMultilayer(name='Paraboloid Multilayer', 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_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4ParaboloidOpticalElementDecorator

Constructor.

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

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

  • 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=electric susceptibility

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

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

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.multilayers.s4_paraboloid_multilayer.S4ParaboloidMultilayerElement(optical_element: S4ParaboloidMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4ParaboloidMultilayerElement

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.multilayers.s4_plane_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_plane_multilayer.S4PlaneMultilayer(name='Plane Multilayer', boundary_shape=None, f_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, 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=electric susceptibility

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

  • 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.multilayers.s4_plane_multilayer.S4PlaneMultilayerElement(optical_element: S4PlaneMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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.multilayers.s4_sphere_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_sphere_multilayer.S4SphereMultilayer(name='Sphere Multilayer', 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_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4SphereOpticalElementDecorator

Constructor.

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

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

  • 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=electric susceptibility

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

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

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.multilayers.s4_sphere_multilayer.S4SphereMultilayerElement(optical_element: S4SphereMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4SphereMultilayerElement

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.multilayers.s4_toroid_multilayer module

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

class shadow4.beamline.optical_elements.multilayers.s4_toroid_multilayer.S4ToroidMultilayer(name='Toroid Multilayer', 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_refl=0, file_refl='', structure='[B/W]x50+Si', period=25.0, Gamma=0.5, dabax=None)[source]

Bases: S4Multilayer, S4ToroidOpticalElementDecorator

Constructor.

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

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

  • 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 multilayer 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=electric susceptibility

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

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

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.multilayers.s4_toroid_multilayer.S4ToroidMultilayerElement(optical_element: S4ToroidMultilayer = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4MultilayerElement

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 S4ToroidMultilayerElement

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

Module contents