shadow4.beamline.optical_elements.refractors package

Submodules

shadow4.beamline.optical_elements.refractors.s4_additional_numerical_mesh_interface module

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

class shadow4.beamline.optical_elements.refractors.s4_additional_numerical_mesh_interface.S4AdditionalNumericalMeshInterface(ideal_interface: S4Interface = None, numerical_mesh_interface: S4NumericalMeshInterface = None, name='Refractive interface with Additional Numerical Mesh')[source]

Bases: S4NumericalMeshInterface

Constructor.

Parameters:
  • ideal_interface (instance of S4Interface) – The refractive interface baseline.

  • numerical_mesh_interface (instance of S4NumericalMeshInterface) – The numerical mesh to be added to the ideal refractive interface.

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

Return type:

instance of S4AdditionalNumericalMeshInterface.

get_ideal()[source]

get the ideal optical element.

Return type:

instance of S4Interface

ideal_interface()[source]

get the ideal optical element.

Return type:

instance of S4Interface

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.refractors.s4_additional_numerical_mesh_interface.S4AdditionalNumericalMeshInterfaceElement(optical_element: S4AdditionalNumericalMeshInterface = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4InterfaceElement

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 S4AdditionalNumericalMeshInterfaceElement

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.refractors.s4_conic_interface module

The s4 conic refractive interface (optical element and beamline element).

class shadow4.beamline.optical_elements.refractors.s4_conic_interface.S4ConicInterface(name='Conic Refractive Interface', boundary_shape=None, material_object='', material_image='', density_object=1.0, density_image=1.0, f_r_ind=0, r_ind_obj=1.0, r_ind_ima=1.0, r_attenuation_obj=0.0, r_attenuation_ima=0.0, file_r_ind_obj='', file_r_ind_ima='', dabax=None, conic_coefficients=array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]))[source]

Bases: S4Interface, 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.

  • material_object (str, optional) – string with material formula (just a nema, not used, passed to syned).

  • material_image (str, optional) – string with material formula (just a nema, not used, passed to syned).

  • density_object (float, optional) – density for material_object (used when f_r_ind>3).

  • density_image (float, optional) – density for material_image (used when f_r_ind>3).

  • f_r_ind (int, optional) –

    source of optical constants, from constant value or PREREFL preprocessor (file):
      1. constant value in both object and image spaces,

      1. file in object space, constant value in image space,

      1. constant value in object space, file in image space,

      1. file in both object and image space.

      1. xraylib in object space, constant value in image space,

      1. constant value in object space, xraylib in image space,

      1. xraylib in both object and image space.

      1. dabax in object space, constant value in image space,

      1. constant value in object space, dabax in image space,

      1. dabax in both object and image space.

  • r_ind_obj (float or numpy array) – (for f_r_ind=0,2): index of refraction (real) in object space.

  • r_ind_ima (float or numpy array) – (for f_r_ind=0,1): index of refraction (real) in image space.

  • r_attenuation_obj (float or numpy array) – (for f_r_ind=0,2): attenuation coefficient in object space. Units of m^(-1)

  • r_attenuation_ima (float or numpy array) – (for f_r_ind=0,1): attenuation coefficient in image space. Units of m^(-1)

  • file_r_ind_obj (str, optional) – (for f_r_ind=1,3): file generated by PREREFL preprocessor.

  • file_r_ind_ima (str, optional) – (for f_r_ind=2,3): file generated by PREREFL preprocessor.

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

Return type:

instance of S4ConicInterface.

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.refractors.s4_conic_interface.S4ConicInterfaceElement(optical_element: S4ConicInterface = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4InterfaceElement

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.refractors.s4_crl module

The s4 compound refractive lens, CRL (optical element and beamline element).

class shadow4.beamline.optical_elements.refractors.s4_crl.S4CRL(name='Undefined', n_lens=1, piling_thickness=0.0, boundary_shape=None, material='', density=1.0, thickness=0.0, surface_shape=1, convex_to_the_beam=1, cylinder_angle=0, ri_calculation_mode=0, prerefl_file=None, refraction_index=1.0, attenuation_coefficient=0.0, dabax=None, radius=0.0005, conic_coefficients1=None, conic_coefficients2=None)[source]

Bases: CRL, S4RefractiveLensOpticalElementDecorator

Constructor.

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

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

  • n_lens (int, optional) – The number of (identical) lenses. Note: it is possible to set n_lens=0, in this case empty screens are used in the place of the interfaces of the lens. Lens thickness is considered.

  • piling_thickness (float, optional) – The distance from one lens to the next one in m.

  • material (str, optional) – A string with the material element symbol or compound formula.

  • density (float, optional) – The density of the material in the lens in g/cm^3.

  • thickness (float, optional) – The thickness of a single lens in m. (Distance between the two interfaces at the center of the lenses.)

  • surface_shape (int, optional) – A flag to indicate the shape of the optical surfaces: 0=plane, 1=sphere, 2=parabola, 3=conic coefficients.

  • convex_to_the_beam (int, optional) – A flag to indicate the convexity of the first optical surface. Used for surface_shape > 0. The first interface exposed to the beam is convex: 0=No, 1=Yes. The second interface has opposite convexity.

  • cylinder_angle (int, optional) –

    A flag to indicate is the CRL is 2D0fucusing, aor 1D focusing and in which direction: Used for surface_shape > 0. Values are:

    0=CRL is focusing in 2D (not cylindrical), 1=CRL is focusing in 1D (meridional focusing), 2=CRL is focusing in 2D (sagittal focusing).

  • ri_calculation_mode (int, optional) –

    A flag to indicate the source of the refraction index. Values are:
    • 0=User,

    • 1=prerefl file,

    • 2=direct calculation using xraylib,

    • 3=direct calculation using dabax.

  • prerefl_file (str, optional) – For ri_calculation_mode=1, the prerefl preprocessor file name.

  • refraction_index (float, optional) – For ri_calculation_mode=0, the real part of the refraction index.

  • attenuation_coefficient (float, optional) – For ri_calculation_mode=0, the attenuation coefficient in m^-1 !!!.

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

  • radius (float, optional) – For surface_shape=(1,2), the lens radius in m. (For parabolic lenses, it is the radius at the tip for paraboloid.)

  • conic_coefficients1 (None or list, optional) – For surface_shape=3, A list with the 10 conic coefficients of interface 1. None is considered as Plane.

  • conic_coefficients2 (None or list, optional) – For surface_shape=3, A list with the 10 conic coefficients of interface 2. None is considered as Plane.

Return type:

instance of S4CRL.

get_info()[source]

Returns the specific information of the S4 CRL optical element.

Return type:

str

get_lens_interfaces()[source]
interthickness()[source]

Returns the interthickness of the beamline element, which is the distance covered by the element along the optical axis. Elements with a single optical surface (mirrors, crystals, etc.) have interthickness zero. Elements like lenses, CRL, transfocators, etc. have interthickness > 0. It is redefined in this method. Note that the interthickness is the projection along the (image) optical axis.

Return type:

float

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

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.refractors.s4_crl.S4CRLElement(optical_element: S4CRL = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

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. (The same movements are applied to the two interfaces. Therefore, each rotation is applied around the local axes of each interface, which are different.)

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

Return type:

instance of S4CRLElement.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

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.refractors.s4_interface module

S4 refractive interface.

class shadow4.beamline.optical_elements.refractors.s4_interface.S4Interface(name='Undefined', boundary_shape=None, surface_shape=None, material_object=None, material_image=None, density_object=1.0, density_image=1.0, f_r_ind=0, r_ind_obj=1.0, r_ind_ima=1.0, r_attenuation_obj=0.0, r_attenuation_ima=0.0, file_r_ind_obj='', file_r_ind_ima='', dabax=None)[source]

Bases: Interface

Shadow4 refractive interface class This is a base class for refractors. Use derived classes for Conic or other curved 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.

  • material_object (str, optional) – string with material symbol or formula (used when f_r_ind>3).

  • material_image (str, optional) – string with material symbol or formula (used when f_r_ind>3).

  • density_object (float, optional) – density for material_object (used when f_r_ind>3).

  • density_image (float, optional) – density for material_image (used when f_r_ind>3).

  • f_r_ind (int, optional) –

    source of optical constants, from constant value or PREREFL preprocessor (file):
      1. constant value in both object and image spaces,

      1. file in object space, constant value in image space,

      1. constant value in object space, file in image space,

      1. file in both object and image space.

      1. xraylib in object space, constant value in image space,

      1. constant value in object space, xraylib in image space,

      1. xraylib in both object and image space.

      1. dabax in object space, constant value in image space,

      1. constant value in object space, dabax in image space,

      1. dabax in both object and image space.

  • r_ind_obj (float or numpy array) – (for f_r_ind=0,2): index of refraction (real) in object space.

  • r_ind_ima (float or numpy array) – (for f_r_ind=0,1): index of refraction (real) in image space.

  • r_attenuation_obj (float or numpy array) – (for f_r_ind=0,2): attenuation coefficient in object space. Units of m^(-1)

  • r_attenuation_ima (float or numpy array) – (for f_r_ind=0,1): attenuation coefficient in image space. Units of m^(-1)

  • file_r_ind_obj (str, optional) – (for f_r_ind=1,3): file generated by PREREFL preprocessor.

  • file_r_ind_ima (str, optional) – (for f_r_ind=2,3): file generated by PREREFL preprocessor.

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

Return type:

instance of S4Interface.

apply_interface_refraction(**kwargs)[source]
get_attenuation_coefficients(photon_energy_eV=None)[source]

Calculates the attenuation coefficients for a given energy or energy array from the input data.

Parameters:

photon_energy_eV (float or numpy array, optional) – The photon energy in eV.

Returns:

(attenuation_coefficient_object, attenuation_coefficient_image) with the real part of the refraction indices.

Return type:

tuple

get_info()[source]

Returns the specific information of the S4 refractive interface optical element.

Return type:

str

get_refraction_indices(photon_energy_eV=None)[source]

Calculates the real part refraction indices for a given energy or energy array from the input data.

Parameters:

photon_energy_eV (float or numpy array, optional) – The photon energy in eV.

Returns:

(refraction_index_object, refraction_index_image) with the real part of the refraction indices.

Return type:

tuple

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

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.refractors.s4_interface.S4InterfaceElement(optical_element: S4Interface = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

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

get_stored_optical_constants()[source]

When running trace_beam() the optical constants (refraction index and attenuation coefficients for media 1 and 2) are calculated. They are stored for accelerating further calls. This method permits to retrieve the stored optical constants.

Returns:

(n1, mu1m n2, mu2) n1, n2: arrays with real part of the refraction indices for the object and image media, respectively. mu1, mu2: arrays with attenuation coefficient in m^(-1) for the object and image media, respectively.

Return type:

tuple

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.refractors.s4_lens module

The s4 refractive lens (optical element and beamline element).

class shadow4.beamline.optical_elements.refractors.s4_lens.S4Lens(name='Undefined', boundary_shape=None, material='', thickness=0.0, surface_shape=1, convex_to_the_beam=1, cylinder_angle=0, ri_calculation_mode=0, prerefl_file=None, refraction_index=1.0, attenuation_coefficient=0.0, density=1.0, dabax=None, radius=0.0005, conic_coefficients1=None, conic_coefficients2=None)[source]

Bases: Lens, S4RefractiveLensOpticalElementDecorator

Constructor.

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

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

  • material (str, optional) – A string with the material element symbol or compound formula.

  • density (float, optional) – The density of the material in the lens in g/cm^3.

  • thickness (float, optional) – The thickness of a single lens in m.

  • surface_shape (int, optional) – A flag to indicate the shape of the optical surfaces: 0=plane, 1=sphere, 2=parabola, 3=conic coefficients.

  • convex_to_the_beam (int, optional) – A flag to indicate the convexity of the first optical surface. Used for surface_shape > 0. The first interface exposed to the beam is convex: 0=No, 1=Yes. The second interface has opposite convexity.

  • cylinder_angle (int, optional) –

    A flag to indicate is the CRL is 2D0fucusing, aor 1D focusing and in which direction: Used for surface_shape > 0. Values are:

    0=CRL is focusing in 2D (not cylindrical), 1=CRL is focusing in 1D (meridional focusing), 2=CRL is focusing in 2D (sagittal focusing).

  • ri_calculation_mode (int, optional) –

    A flag to indicate the source of the refraction index. Values are:
    • 0=User,

    • 1=prerefl file,

    • 2=direct calculation using xraylib,

    • 3=direct calculation using dabax.

  • prerefl_file (str, optional) – For ri_calculation_mode=1, the prerefl preprocessor file name.

  • refraction_index (float, optional) – For ri_calculation_mode=0, the real part of the refraction index.

  • attenuation_coefficient (float, optional) – For ri_calculation_mode=0, the attenuation coefficient in m^-1 !!!.

  • dabax (None or instance of DabaxXraylib,) – The pointer to the dabax library (used for ri_calculation_mode=3). If None, the default is used.

  • radius (float, optional) – For surface_shape=(1,2), the lens radius in m. (For parabolic lenses, it is the radius at the tip for paraboloid.)

  • conic_coefficients1 (None or list, optional) – For surface_shape=3, A list with the 10 conic coefficients of interface 1. None is considered as Plane.

  • conic_coefficients2 (None or list, optional) – For surface_shape=3, A list with the 10 conic coefficients of interface 2. None is considered as Plane.

get_lens_interfaces()[source]
interthickness()[source]

Returns the interthickness of the beamline element, which is the distance covered by the element along the optical axis. Elements with a single optical surface (mirrors, crystals, etc.) have interthickness zero. Elements like lenses, CRL, transfocators, etc. have interthickness > 0. It is redefined in this method. Note that the interthickness is the projection along the (image) optical axis.

Return type:

float

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

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.refractors.s4_lens.S4LensElement(optical_element: S4Lens = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

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. (The same movements are applied to the two interfaces. Therefore, each rotation is applied around the local axes of each interface, which are different.)

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

Return type:

instance of S4LensElement.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

Return type:

str

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.refractors.s4_numerical_mesh_interface module

The s4 numerical mesh refractive interface (optical element and beamline element).

class shadow4.beamline.optical_elements.refractors.s4_numerical_mesh_interface.S4NumericalMeshInterface(name='Undefined', boundary_shape=None, surface_shape=None, material_object='', material_image='', density_object=1.0, density_image=1.0, f_r_ind=0, r_ind_obj=1.0, r_ind_ima=1.0, r_attenuation_obj=0.0, r_attenuation_ima=0.0, file_r_ind_obj='', file_r_ind_ima='', dabax=None, xx=None, yy=None, zz=None, surface_data_file='')[source]

Bases: S4Interface, S4NumericalMeshOpticalElementDecorator

Constructor.

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

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

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

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

  • material_object (str, optional) – string with material symbol or formula (used when f_r_ind>3).

  • material_image (str, optional) – string with material symbol or formula (used when f_r_ind>3).

  • density_object (float, optional) – density for material_object (used when f_r_ind>3).

  • density_image (float, optional) – density for material_image (used when f_r_ind>3).

  • f_r_ind (int, optional) –

    source of optical constants, from constant value or PREREFL preprocessor (file):
      1. constant value in both object and image spaces,

      1. file in object space, constant value in image space,

      1. constant value in object space, file in image space,

      1. file in both object and image space.

      1. xraylib in object space, constant value in image space,

      1. constant value in object space, xraylib in image space,

      1. xraylib in both object and image space.

      1. dabax in object space, constant value in image space,

      1. constant value in object space, dabax in image space,

      1. dabax in both object and image space.

  • r_ind_obj (float or numpy array) – (for f_r_ind=0,2): index of refraction (real) in object space.

  • r_ind_ima (float or numpy array) – (for f_r_ind=0,1): index of refraction (real) in image space.

  • r_attenuation_obj (float or numpy array) – (for f_r_ind=0,2): attenuation coefficient in object space. Units of m^(-1)

  • r_attenuation_ima (float or numpy array) – (for f_r_ind=0,1): attenuation coefficient in image space. Units of m^(-1)

  • file_r_ind_obj (str, optional) – (for f_r_ind=1,3): file generated by PREREFL preprocessor.

  • file_r_ind_ima (str, optional) – (for f_r_ind=2,3): file generated by PREREFL preprocessor.

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

Return type:

instance of S4NumericalMeshInterface.

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.refractors.s4_numerical_mesh_interface.S4NumericalMeshInterfaceElement(optical_element: S4NumericalMeshInterface = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4InterfaceElement

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.refractors.s4_transfocator module

The s4 transfocator (optical element and beamline element).

class shadow4.beamline.optical_elements.refractors.s4_transfocator.S4Transfocator(name='Undefined', n_lens=[1], piling_thickness=[0.0], boundary_shape=None, material=[''], density=[1.0], thickness=[0.0], surface_shape=[1], convex_to_the_beam=[1], cylinder_angle=[0], ri_calculation_mode=[0], prerefl_file=[None], refraction_index=[1.0], attenuation_coefficient=[0.0], dabax=None, radius=[0.0005], conic_coefficients1=[None], conic_coefficients2=[None], empty_space_after_last_interface=[0.0])[source]

Bases: OpticalElement, S4OpticalElementDecorator

Constructor.

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

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

  • n_lens (list of int, optional) – The number of (identical) lenses.

  • piling_thickness (list of float, optional) – The distance from one lens to the next one in m.

  • material (list of str, optional) – A string with the material element symbol or compound formula.

  • density (float, optional) – The density of the material in the lens in g/cm^3.

  • thickness (list of float, optional) – The thickness of a single lens in m. (Distance between the two interfaces at the center of the lenses.)

  • surface_shape (list of int, optional) – A flag to indicate the shape of the optical surfaces: 0=plane, 1=sphere, 2=parabola, 3=conic coefficients.

  • convex_to_the_beam (list of int, optional) – A flag to indicate the convexity of the first optical surface. Used for surface_shape > 0. The first interface exposed to the beam is convex: 0=No, 1=Yes. The second interface has opposite convexity.

  • cylinder_angle (list of int, optional) –

    A flag to indicate is the CRL is 2D0fucusing, aor 1D focusing and in which direction: Used for surface_shape > 0. Values are:

    0=CRL is focusing in 2D (not cylindrical), 1=CRL is focusing in 1D (meridional focusing), 2=CRL is focusing in 2D (sagittal focusing).

  • ri_calculation_mode (list of int, optional) –

    A flag to indicate the source of the refraction index. Values are:
    • 0=User,

    • 1=prerefl file,

    • 2=direct calculation using xraylib,

    • 3=direct calculation using dabax.

  • prerefl_file (list of str, optional) – For ri_calculation_mode=1, the prerefl preprocessor file name.

  • refraction_index (float, optional) – For ri_calculation_mode=0, the real part of the refraction index.

  • attenuation_coefficient (list of float, optional) – For ri_calculation_mode=0, the attenuation coefficient in m^-1 !!!.

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

  • radius (list of float, optional) – For surface_shape=(1,2), the lens radius in m. (For parabolic lenses, it is the radius at the tip for paraboloid.)

  • conic_coefficients1 (list of (None or list), optional) – For surface_shape=3, A list with the 10 conic coefficients of interface 1. None is considered as Plane.

  • conic_coefficients2 (list of (None or list), optional) – For surface_shape=3, A list with the 10 conic coefficients of interface 2. None is considered as Plane.

Return type:

instance of S4Transfocator.

get_crl_at_index(index)[source]
get_crls()[source]
get_info()[source]

Returns the specific information of the S4 Transfocator optical element.

Return type:

str

interthickness()[source]

Returns the interthickness of the beamline element, which is the distance covered by the element along the optical axis. Elements with a single optical surface (mirrors, crystals, etc.) have interthickness zero. Elements like lenses, CRL, transfocators, etc. have interthickness > 0. It is redefined in this method. Note that the interthickness is the projection along the (image) optical axis.

Return type:

float

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

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.refractors.s4_transfocator.S4TransfocatorElement(optical_element: S4CRL = None, coordinates: ElementCoordinates = None, movements: S4BeamlineElementMovements = None, input_beam: S4Beam = None)[source]

Bases: S4BeamlineElement

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. (The same movements are applied to the two interfaces. Therefore, each rotation is applied around the local axes of each interface, which are different.)

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

Return type:

instance of S4CRLElement.

to_python_code(**kwargs)[source]

Creates the python code for defining the element.

Parameters:

**kwargs

Returns:

Python code.

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

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

Module contents