shadow4.beamline.optical_elements.gratings package

Submodules

shadow4.beamline.optical_elements.gratings.s4_additional_numerical_mesh_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_additional_numerical_mesh_grating.S4AdditionalNumericalMeshGrating(ideal_grating: S4Grating = None, numerical_mesh_grating: S4NumericalMeshGrating = None, name='Grating with Additional Numerical Mesh')[source]

Bases: S4NumericalMeshGrating

Constructor.

Parameters:
  • ideal_grating (instance of S4Grating) – The grating baseline.

  • numerical_mesh_grating (instance of S4NumericalMeshGrating) – The numerical mesh to be added to the ideal grating.

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

Return type:

instance of S4AdditionalNumericalMeshGrating.

get_ideal()[source]

get the ideal optical element.

Return type:

instance of S4Grating

ideal_grating()[source]

get the ideal optical element.

Return type:

instance of S4Grating

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.gratings.s4_additional_numerical_mesh_grating.S4AdditionalNumericalMeshGratingElement(optical_element: S4AdditionalNumericalMeshGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_conic_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_conic_grating.S4ConicGrating(name='Conic Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, conic_coefficients=None)[source]

Bases: S4Grating, S4ConicOpticalElementDecorator

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, ndarray, optional) – The list of the 10 conic coefficients.

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4ConicGrating.

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.gratings.s4_conic_grating.S4ConicGratingElement(optical_element: S4ConicGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_ellipsoid_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_ellipsoid_grating.S4EllipsoidGrating(name='Ellipsoid Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, min_axis=0.0, maj_axis=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=1)[source]

Bases: S4Grating, S4EllipsoidOpticalElementDecorator

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:

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

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4EllipsoidGrating.

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.gratings.s4_ellipsoid_grating.S4EllipsoidGratingElement(optical_element: S4EllipsoidGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_grating.S4Grating(name='Undefined', surface_shape=None, boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0)[source]

Bases: GratingVLS, S4OpticalElementDecorator

Shadow4 Grating Class This is a base class for a grating.

Use derived classes for plane or other curved crystal surfaces.

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.

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4Grating.

get_info()[source]

Returns the specific information of the S4 grating 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.gratings.s4_grating.S4GratingElement(optical_element: S4Grating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

The base class for Shadow4 grating element. It is made of a S4Grating 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 S4GratingElement.

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.gratings.s4_hyperboloid_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_hyperboloid_grating.S4HyperboloidGrating(name='Hyperboloid Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, min_axis=0.0, maj_axis=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=1)[source]

Bases: S4Grating, S4HyperboloidOpticalElementDecorator

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:

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

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4HyperboloidGrating.

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.gratings.s4_hyperboloid_grating.S4HyperboloidGratingElement(optical_element: S4HyperboloidGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_numerical_mesh_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_numerical_mesh_grating.S4NumericalMeshGrating(name='NumericalMesh Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, xx=None, yy=None, zz=None, surface_data_file='')[source]

Bases: S4Grating, S4NumericalMeshOpticalElementDecorator

Constructor.

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

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

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

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4NumericalMeshGrating.

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.gratings.s4_numerical_mesh_grating.S4NumericalMeshGratingElement(optical_element: S4NumericalMeshGrating = None, coordinates: ElementCoordinates = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

Constructor.

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

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

  • 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.gratings.s4_paraboloid_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_paraboloid_grating.S4ParaboloidGrating(name='Paraboloid Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, at_infinity=0, parabola_parameter=0.0, pole_to_focus=0.0, is_cylinder=False, cylinder_direction=0, convexity=1)[source]

Bases: S4Grating, S4ParaboloidOpticalElementDecorator

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:

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

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4ParaboloidGrating.

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.gratings.s4_paraboloid_grating.S4ParaboloidGratingElement(optical_element: S4ParaboloidGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_plane_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_plane_grating.S4PlaneGrating(name='Undefined', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0)[source]

Bases: S4Grating, S4PlaneOpticalElementDecorator

Constructor.

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

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

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4PlaneGrating.

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.gratings.s4_plane_grating.S4PlaneGratingElement(optical_element: S4PlaneGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_sphere_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_sphere_grating.S4SphereGrating(name='Sphere Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, radius=1.0, is_cylinder=False, cylinder_direction=0, convexity=1)[source]

Bases: S4Grating, S4SphereOpticalElementDecorator

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:

    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.

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4SphereGrating.

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.gratings.s4_sphere_grating.S4SphereGratingElement(optical_element: S4SphereGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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.gratings.s4_toroid_grating module

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

class shadow4.beamline.optical_elements.gratings.s4_toroid_grating.S4ToroidGrating(name='Toroid Grating', boundary_shape=None, ruling=800000.0, ruling_coeff_linear=0.0, ruling_coeff_quadratic=0.0, ruling_coeff_cubic=0.0, ruling_coeff_quartic=0.0, coating=None, coating_thickness=None, order=0, f_ruling=0, min_radius=0.1, maj_radius=1.0, f_torus=0)[source]

Bases: S4Grating, S4ToroidOpticalElementDecorator

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

  • ruling (float, optional) – The constant term of the ruling in lines/m.

  • ruling_coeff_linear (float, optional) – The linear term of the ruling in lines/m^2.

  • ruling_coeff_quadratic (float, optional) – The quadratic term of the ruling in lines/m^3.

  • ruling_coeff_cubic (float, optional) – The cubic term of the ruling in lines/m^4.

  • ruling_coeff_quartic (float, optional) – The quartic term of the ruling in lines/m^5.

  • coating (str, optional) – The identified if the coating material (not used, passed to syned).

  • coating_thickness (float, optional) – The thickness of the coating in m (not used, passed to syned).

  • order (int, optional) – The diffraction order.

  • f_ruling (int, optional) –

    A flag to define the type of ruling:
      1. constant on X-Y plane (0)

      1. polynomial line density (5 in shadow3).

Return type:

instance of S4________Grating.

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.gratings.s4_toroid_grating.S4ToroidGratingElement(optical_element: S4ToroidGrating = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4GratingElement

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