syned.beamline package

Subpackages

Submodules

syned.beamline.beamline module

Represents a beamline. The beamline is composed by a light source ans a list of beamline elements.

class syned.beamline.beamline.Beamline(light_source=<syned.storage_ring.light_source.LightSource object>, beamline_elements_list=None)[source]

Bases: SynedObject

Constructor.

Parameters:
  • light_source (instance of LightSource) – The light source

  • beamline_elements_list (list) – The beamline elements (each one an instance of BeamlineElement).

append_beamline_element(beamline_element=<syned.beamline.beamline_element.BeamlineElement object>)[source]

Appends a beamline element.

Parameters:

beamline_element (instance of BeamlineElement.) –

duplicate()[source]

Returns a copy of the beamline element instance.

Returns:

A copy of the object instance.

Return type:

BeamlineElement instance

get_beamline_element_at(index)[source]

gets an individual beamline element.

Parameters:

index (int) – The index of the beamline element to be retrieved.

Returns:

The wanted beamline element (referenced, not copied).

Return type:

instance of BeamlineElement

get_beamline_elements()[source]

returns the beamline elements.

Return type:

list

get_beamline_elements_number()[source]

Gets the number of beamline elements stored.

Return type:

int

get_light_source()[source]

Returns the light source

Return type:

instance of LightSource

set_light_source(light_source=<syned.storage_ring.light_source.LightSource object>)[source]

Sets a light source.

Parameters:

light_source (instance of LightSource) –

to_dictionary()[source]

Returns a dictionary with the object fields.

Returns:

A dictionary with the data.

Return type:

dict

syned.beamline.beamline_element module

Base class for all beamline elements. A beamline element is composed by an optical element (instance of OpticalElement) and its position in th ebeamline (an instance of ElementCoordinates).

class syned.beamline.beamline_element.BeamlineElement(optical_element=<syned.beamline.optical_element.OpticalElement object>, coordinates=<syned.beamline.element_coordinates.ElementCoordinates object>)[source]

Bases: SynedObject

Constructor

Parameters:
get_coordinates()[source]

Returns the element coordinates.

Return type:

instance of ElementCoordinates

get_optical_element()[source]

Returns the optical element.

Return type:

instance of OpticalElement

set_coordinates(value)[source]

Sets the coordinates.

Parameters:

value (instance of ElementCoordinates.) –

set_optical_element(value)[source]

Sets the optical element.

Parameters:

value (instance of OpticalElement) –

syned.beamline.element_coordinates module

Position coordinates of a beamline component.

class syned.beamline.element_coordinates.ElementCoordinates(p=0.0, q=0.0, angle_radial=0.0, angle_azimuthal=0.0, angle_radial_out=None)[source]

Bases: SynedObject

angle_azimuthal()[source]

Returns the azimuthal angle.

Return type:

float

angle_radial()[source]

Returns the radial angle.

Return type:

float

angle_radial_out()[source]

Returns the radial angle in the output direction.

Return type:

float

get_angles()[source]

Get the angles.

Returns:

(angle_radial, angle_radial_out, angle_azimuthal)

Return type:

tuple

get_p_and_q()[source]

Gets p and q.

Returns:

(p,q).

Return type:

tuple

get_positions()[source]

Gets the coordinates.

Returns:

(p, q, angle_radial, angle_radial_out, angle_azimuthal)

Return type:

tuple

p()[source]

Returns the distance from previous element.

Return type:

float

q()[source]

Returns the distance to next element.

Return type:

float

set_angles(angle_radial=0.0, angle_radial_out=None, angle_azimuthal=0.0)[source]

Sets the angles.

Parameters:
  • angle_radial (float, optional) – Radial inclination angle in rads.

  • angle_azimuthal (float, optional) – Azimuthal inclination angle in rads.

  • angle_radial_out (float, optional) – The radial angle in rads in the output direction (default=None, the same as angle_radial).

set_p_and_q(p=0.0, q=0.0)[source]

Set the distances p and q.

Parameters:
  • p (float, optional) – distance from previous element in m.

  • q (float, optional) – distance to next element in m.

set_positions(p=0.0, q=0.0, angle_radial=0.0, angle_radial_out=None, angle_azimuthal=0.0)[source]

Sets the coordinates.

Parameters:
  • p (float, optional) – distance from previous element in m.

  • q (float, optional) – distance to next element in m.

  • angle_radial (float, optional) – Radial inclination angle in rads.

  • angle_azimuthal (float, optional) – Azimuthal inclination angle in rads.

  • angle_radial_out (float, optional) – The radial angle in rads in the output direction (default=None, the same as angle_radial).

syned.beamline.optical_element module

Base class for an optical element.

class syned.beamline.optical_element.OpticalElement(name='Undefined', boundary_shape=None)[source]

Bases: SynedObject

Constructor.

Parameters:
  • name (str) – The element name.

  • boundary_shape (instance of BoundaryShape, optional) – The element shape. The default=None means no shape associated to the optical element.

get_boundary_shape()[source]

Returns the boundary shape.

Return type:

None or instance of BoundaryShape

get_name()[source]

returns the optical element name.

Return type:

str

syned.beamline.optical_element_with_surface_shape module

Base classes for optical elements with shape(s).

  • OpticalElementsWithSurfaceShape (e.g. an elliptical mirror).

  • OpticalElementsWithMultipleShapes (e.g. a lens that has two surfaces).

class syned.beamline.optical_element_with_surface_shape.OpticalElementsWithMultipleShapes(name='', surface_shapes=None, boundary_shape=None)[source]

Bases: OpticalElement

Constructor.

Parameters:
  • name (str) – The optical elemnt name.

  • surface_shapes (list) – List with surface shapes (instances of SurfaceShape)

  • boundary_shape (instance of BoundaryShape, optional) – The element shape. The default=None means no shape associated to the optical element.

get_surface_shape(index)[source]

Gets the surface shape.

Parameters:

index (int) – The index of the requested surface shape in the list.

Returns:

The requested surface shape.

Return type:

instance of SurfaceShape

set_surface_shape(index, surface_shape=None)[source]

Sets a surface shape.

Parameters:
  • index (int) – The index of the surface shape to be set in the list.

  • surface_shape (instances of SurfaceShape, optional) – The surface shape to be set (If None, initialize to SurfaceShape())

class syned.beamline.optical_element_with_surface_shape.OpticalElementsWithSurfaceShape(name, surface_shape=None, boundary_shape=None)[source]

Bases: OpticalElementsWithMultipleShapes

Constructor.

Parameters:
  • name (str) – The optical elemnt name.

  • surface_shape (instances of SurfaceShape) – The surface shape.

  • boundary_shape (instance of BoundaryShape, optional) – The element shape. The default=None means no shape associated to the optical element.

get_surface_shape()[source]

Gets the surface shape.

Returns:

The requested surface shape.

Return type:

instance of SurfaceShape

set_surface_shape(surface_shape=None)[source]

Sets a surface shape.

Parameters:

surface_shape (instances of SurfaceShape, optional) – The surface shape to be set (If None, initialize to SurfaceShape())

syned.beamline.shape module

Classes with geometrical shapes.

  • Shape: Base class for all possible geometric shapes.

  • SurfaceShape: Base class to caracterize the shape (sphere, flat, etc.) of the optical element surface

  • BoundaryShape: Base class to characterize the optical element dimensions (rectangle, etc.).

Additional classes help to define flags:
  • Convexity: NONE = -1, UPWARD = 0, DOWNWARD = 1

  • Direction: TANGENTIAL = 0, SAGITTAL = 1

  • Side: SOURCE = 0, IMAGE = 1

class syned.beamline.shape.BoundaryShape[source]

Bases: Shape

Constructor.

get_boundaries()[source]

Returns the boundary shape. It must be defined in the children classes.

Raises:

NotImplementedError

class syned.beamline.shape.Circle(radius=5e-05, x_center=0.0, y_center=0.0)[source]

Bases: BoundaryShape

Constructor.

Parameters:
  • radius (float) – The radius of the circle.

  • x_center (float) – The x coordinate of the center of the circle.

  • y_center (float) – The y coordinate of the center of the circle.

get_boundaries()[source]

Returns the circle parameters.

Returns:

(radius, x_center, y_center).

Return type:

tuple

get_center()[source]

Returns the coordinates of the circle.

Returns:

[x_center, y_center]

Return type:

list

get_radius()[source]

Returns the radius of the circle.

Return type:

float

set_boundaries(radius=1.0, x_center=0.0, y_center=0.0)[source]

Sets the circle parameters.

Parameters:
  • radius (float) – The radius of the circle.

  • x_center (float) – The x coordinate of the center of the circle.

  • y_center (float) – The y coordinate of the center of the circle.

class syned.beamline.shape.Conic(conic_coefficients=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])[source]

Bases: SurfaceShape

Defines a conic surface shape expresses via the 10 conic coeffcients.

Parameters:

conic_coefficients (list, optional) – A list with the 10 coefficients.

get_conic_coefficients()[source]

Returns the coefficients.

Returns:

A list with the 10 coefficients.

Return type:

list

class syned.beamline.shape.Convexity[source]

Bases: object

DOWNWARD = 1
NONE = -1
UPWARD = 0
class syned.beamline.shape.Cylinder(cylinder_direction=0)[source]

Bases: SynedObject

Defines that a surface shape is cylindrical in one direction.

Usage: must be used with double inheritance in other classes (e.g. ParabolicCylinder). It should not be used standalone.

Parameters:

cylinder_direction (int, optional) – TANGENTIAL = 0, SAGITTAL = 1.

get_cylinder_direction()[source]

Returns the cylinder direction.

Returns:

TANGENTIAL = 0, SAGITTAL = 1.

Return type:

int

class syned.beamline.shape.Direction[source]

Bases: object

SAGITTAL = 1
TANGENTIAL = 0
class syned.beamline.shape.DoubleCircle(radius1=5e-05, x_center1=0.0, y_center1=0.0, radius2=5e-05, x_center2=0.0001, y_center2=0.0001)[source]

Bases: MultiplePatch

Constructor.

Parameters:
  • radius1 (float) – The radius of the circle 1.

  • x_center1 (float) – The x coordinate of the center of the circle 1.

  • y_center1 (float) – The y coordinate of the center of the circle 1.

  • radius2 (float) – The radius of the circle 2.

  • x_center2 (float) – The x coordinate of the center of the circle 2.

  • y_center2 (float) – The y coordinate of the center of the circle 2.

set_boundaries(radius1=5e-05, x_center1=0.0, y_center1=0.0, radius2=5e-05, x_center2=0.0001, y_center2=0.0001)[source]

Sets the coordinates of the circles.

Parameters:
  • radius1 (float) – The radius of the circle 1.

  • x_center1 (float) – The x coordinate of the center of the circle 1.

  • y_center1 (float) – The y coordinate of the center of the circle 1.

  • radius2 (float) – The radius of the circle 2.

  • x_center2 (float) – The x coordinate of the center of the circle 2.

  • y_center2 (float) – The y coordinate of the center of the circle 2.

class syned.beamline.shape.DoubleEllipse(a_axis_min1=-0.01, a_axis_max1=0.0, b_axis_min1=-0.02, b_axis_max1=0.0, a_axis_min2=-0.01, a_axis_max2=0.01, b_axis_min2=-0.001, b_axis_max2=0.02)[source]

Bases: MultiplePatch

Constructor.

Parameters:
  • a_axis_min1 (float, optional) – The coordinate (signed) of the minimum (left) along the major axis of ellipse 1.

  • a_axis_max1 (float, optional) – The coordinate (signed) of the maximum (right) along the major axis of ellipse 1.

  • b_axis_min1 (float, optional) – The coordinate (signed) of the minimum (left) along the minor axis of ellipse 1.

  • b_axis_max1 (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis of ellipse 1.

  • a_axis_min2 (float, optional) – The coordinate (signed) of the minimum (left) along the major axis of ellipse 2.

  • a_axis_max2 (float, optional) – The coordinate (signed) of the maximum (right) along the major axis of ellipse 2.

  • b_axis_min2 (float, optional) – The coordinate (signed) of the minimum (left) along the minor axis of ellipse 2.

  • b_axis_max2 (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis of ellipse 2.

set_boundaries(a_axis_min1=-0.01, a_axis_max1=0.0, b_axis_min1=-0.02, b_axis_max1=0.0, a_axis_min2=-0.01, a_axis_max2=0.01, b_axis_min2=-0.001, b_axis_max2=0.02)[source]

Sets the coordinates of the ellipses.

Parameters:
  • a_axis_min1 (float, optional) – The coordinate (signed) of the minimum (left) along the major axis of ellipse 1.

  • a_axis_max1 (float, optional) – The coordinate (signed) of the maximum (right) along the major axis of ellipse 1.

  • b_axis_min1 (float, optional) – The coordinate (signed) of the minimum (left) along the minor axis of ellipse 1.

  • b_axis_max1 (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis of ellipse 1.

  • a_axis_min2 (float, optional) – The coordinate (signed) of the minimum (left) along the major axis of ellipse 2.

  • a_axis_max2 (float, optional) – The coordinate (signed) of the maximum (right) along the major axis of ellipse 2.

  • b_axis_min2 (float, optional) – The coordinate (signed) of the minimum (left) along the minor axis of ellipse 2.

  • b_axis_max2 (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis of ellipse 2.

class syned.beamline.shape.DoubleRectangle(x_left1=-0.01, x_right1=0.0, y_bottom1=-0.02, y_top1=0.0, x_left2=-0.01, x_right2=0.01, y_bottom2=-0.001, y_top2=0.02)[source]

Bases: MultiplePatch

Constructor.

Parameters:
  • x_left1 (float, optional) – The coordinate (signed) of the minimum (left) along the X axis of rectangle 1.

  • x_right1 (float, optional) – The coordinate (signed) of the maximum (right) along the X axis of rectangle 1.

  • y_bottom1 (float, optional) – The coordinate (signed) of the minimum (left) along the Y axis of rectangle 1.

  • y_top1 (float, optional) – The coordinate (signed) of the maximum (right) along the Y axis of rectangle 1.

  • x_left2 (float, optional) – The coordinate (signed) of the minimum (left) along the X axis of rectangle 2.

  • x_right2 (float, optional) – The coordinate (signed) of the maximum (right) along the X axis of rectangle 2.

  • y_bottom2 (float, optional) – The coordinate (signed) of the minimum (left) along the Y axis of rectangle 2.

  • y_top2 (float, optional) – The coordinate (signed) of the maximum (right) along the Y axis of rectangle 2.

set_boundaries(x_left1=-0.01, x_right1=0.0, y_bottom1=-0.02, y_top1=0.0, x_left2=-0.01, x_right2=0.01, y_bottom2=-0.001, y_top2=0.02)[source]
class syned.beamline.shape.Ellipse(a_axis_min=-1e-05, a_axis_max=1e-05, b_axis_min=-5e-06, b_axis_max=5e-06)[source]

Bases: BoundaryShape

Constructor.

Parameters:
  • a_axis_min (float, optional) – The coordinate (signed) of the minimum (left) along the major axis.

  • a_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the major axis.

  • b_axis_min (float, optional) – The coordinate (signed) of the minimum (left) along the minor axis.

  • b_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis.

get_axis()[source]

Returns the length of the ellipse axes.

Returns:

(a_length, b_length).

Return type:

tuple

get_boundaries()[source]

Returns the coordinates of the ellipse.

Returns:

(a_axis_min, a_axis_max, b_axis_min, b_axis_max).

Return type:

tuple

class syned.beamline.shape.Ellipsoid(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0)[source]

Bases: SurfaceShape

Constructor.

Ellipsoid: Revolution ellipsoid (rotation around major axis). It is defined with three parameters: axes of the ellipse and an additional parameter defining the position of the origin of the mirror. This additional parameter can be “p”, “x0”, “y0” or the angle beta from the ellipsoid center (tan(beta)=y0/x0). For simplicity, we store “p” in syned.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

References

Conic Surfaces and Transformations for X-Ray Beamline Optics Modeling, Manuel Sanchez del Rio and Kenneth Goldberg (2024) https://arxiv.org/abs/2406.04079

classmethod create_ellipsoid_from_axes(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0)[source]

Creates an ellipsoid.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

Return type:

instance of Ellipsoid

classmethod create_ellipsoid_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, convexity=0)[source]

Creates an ellipsoid from factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

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

Return type:

instance of Ellipsoid

get_a()[source]

Returns a = half of the major axis.

Return type:

float

get_angle_pole_from_origin()[source]

Return the angle from pole to origin (beta).

Return type:

float

get_axes()[source]

Returns the ellipsoid axes. Note that the third axis of the ellipsoid is the same as the minor axis (revolution ellipsoid).

Returns:

(minor_axis, major_axis)

Return type:

tuple

classmethod get_axis_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Calculates the ellipse axes from the factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

Returns:

(minor_axis, major_axis).

Return type:

tuple

get_b()[source]

Returns b = half of the minor axis.

Return type:

float

get_c()[source]

Returns c = sqrt(a^2 - b^2).

Return type:

float

get_eccentricity()[source]

returns the eccentricity e = c / a.

Return type:

float

get_grazing_angle()[source]

Returns the grazing angle.

Return type:

float

get_mirror_center()[source]

Returns the coordinates of the mirror pole or center.

Returns:

(coor_along_axis_maj, coor_along_axis_min).

Return type:

tuple

get_p_focus()[source]

Returns p (=p_focus).

Return type:

float

get_p_q(grazing_angle=None)[source]

Returns p and q for a given grazing angle.

Parameters:

grazing_angle (None, float) – The grazing angle in rad. If None it calculates it using a,b,p. ** This is not used, as it is calculated from the ellipsoid parameters **

Returns:

(p, q)

Return type:

tuple

classmethod get_p_q_from_axis(min_axis=2.0, maj_axis=1.0, grazing_angle=0.003)[source]

Calculates the p and q values from axis and grazing angle.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • grazing_angle (float, optional) – grazing angle in rad.

Returns:

(p, q).

Return type:

tuple

get_q_focus()[source]

Returns q.

Return type:

float

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Sets the ellipsoid parameters as calculated from the factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

initialize_from_shadow_parameters(axmaj=2.0, axmin=1.0, ell_the=0.003, convexity=0)[source]

Sets the ellipsoid parameters as calculated from the parameters used in SHADOW.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • ell_the (float, optional) – the angle beta from the ellipsoid center in rads.

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

class syned.beamline.shape.EllipticalCylinder(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0, cylinder_direction=0)[source]

Bases: Ellipsoid, Cylinder

Constructor.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

classmethod create_elliptical_cylinder_from_axes(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0, cylinder_direction=0)[source]

Returns an EllipticalCylinder instance from main parameters.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of EllipticalCylinder

classmethod create_elliptical_cylinder_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, convexity=0, cylinder_direction=0)[source]

Returns an EllipticalCylinder instance from factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of EllipticalCylinder

get_p_q(grazing_angle=None)[source]

Returns p and q distances for a given grazing angle.

Parameters:

grazing_angle (float, None) – The grazing angle in rad. If None it calculates it using a,b,p. ** This is not longer used, as it is calculated from the Ellipse parameters **

Returns:

(p, q).

Return type:

tuple

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Sets the ellipsoid parameters for given factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

class syned.beamline.shape.HyperbolicCylinder(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0, cylinder_direction=0)[source]

Bases: Hyperboloid, Cylinder

Constructor.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

classmethod create_hyperbolic_cylinder_from_axes(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0, cylinder_direction=0)[source]

Returns an HyperbolicCylinder instance from main parameters.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of HyperbolicCylinder

classmethod create_hyperbolic_cylinder_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, convexity=0, cylinder_direction=0)[source]

Returns an HyperbolicCylinder instance from factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of HyperbolicCylinder

get_p_q(grazing_angle=None)[source]

Returns p and q distances for a given grazing angle.

Parameters:

grazing_angle (float) – The grazing angle in rad. If None it calculates it using a,b,p. ** This is not longer used as it is calculates from the Hyperbola parameters **

Returns:

(p, q).

Return type:

tuple

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Sets the hyperboloid parameters for given factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

class syned.beamline.shape.Hyperboloid(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0)[source]

Bases: SurfaceShape

Constructor.

Hyperboloid: Revolution hyperboloid (two sheets: rotation around major axis). It is defined with three parameters: axes of the hyperbola and an additional parameter defining the position of the origin of the mirror. This additional parameter can be “p”, “x0”, “y0” or the angle beta from the ellipsoid center (tan(beta)=y0/x0). For simplicity, we store “p” in syned.

Parameters:
  • min_axis (float, optional) – the hyperbola minor axis.

  • maj_axis (float, optional) – the hyperbola major axis.

  • p_focus (float, optional) – the distance from the first focus (source position) to the mirror pole.

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

References

Some equations can be found here: https://github.com/srio/shadow3-docs/blob/master/doc/conics.pdf

classmethod create_hyperboloid_from_axes(min_axis=0.0, maj_axis=0.0, p_focus=0.0, convexity=0)[source]

Creates an hyperboloid from main parameters.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • p_focus (float, optional) – the angle beta from the hyperbola center in rads.

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

Return type:

instance of Hyperboloid

classmethod create_hyperboloid_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, convexity=0)[source]

Creates an hyperboloid from factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

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

Return type:

instance of Hyoerboloid

get_a()[source]

Returns a = half of the major axis.

Return type:

float

get_axes()[source]

Returns the hyperboloid axes. Note that the third axis of the ellipsoid is the same as the minor axis (revolution ellipsoid).

Returns:

(minor_axis, major_axis)

Return type:

tuple

classmethod get_axis_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, branch_sign=None)[source]

Calculates the hyperbola axes from the factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

  • branch_sign (None, int) – +1 (positive) when p > q; or -1 (negative) when p < q.If None, it is internally calculated.

Returns:

(minor_axis, major_axis).

Return type:

tuple

get_b()[source]

Returns b = half of the minor axis.

Return type:

float

get_c()[source]

Returns c = sqrt(a^2 + b^2).

Return type:

float

get_eccentricity()[source]

returns the eccentricity e = c / a.

Return type:

float

get_grazing_angle()[source]

Returns the grazing angle.

Return type:

float

get_mirror_center()[source]

Returns the coordinates of the mirror pole or center.

Returns:

(coor_along_axis_maj, coor_along_axis_min).

Return type:

tuple

get_p_focus()[source]

Returns p (=p_focus).

Return type:

float

get_p_q(grazing_angle=None)[source]

Returns p and q for a given grazing angle.

Parameters:

grazing_angle (float, None) – The grazing angle in rad. If None it calculates it using a,b,p. ** This is not longer used as it is calculates from the Hyperbola parameters **

Returns:

(p, q)

Return type:

tuple

classmethod get_p_q_from_axis(min_axis=2.0, maj_axis=1.0, grazing_angle=0.003, branch_sign=1)[source]

Calculates the p and q values from axis and grazing angle.

Parameters:
  • min_axis (float, optional) – the ellipse minor axis.

  • maj_axis (float, optional) – the ellipse majot axis.

  • grazing_angle (float, optional) – grazing angle in rad.

Returns:

(p, q).

Return type:

tuple

get_q_focus()[source]

Returns q.

Return type:

float

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Sets the hyperboloid parameters as calculated from the factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

class syned.beamline.shape.MultiplePatch(patch_list=None)[source]

Bases: BoundaryShape

Constructor.

Parameters:

patch_list (list) – A list of patches (each one can be a Circle, Rectangle, Polygon, etc.)

append_circle(radius, x_center=0.0, y_center=0.0)[source]

Appends a circle.

Parameters:
  • radius (float) – The radius of the circle.

  • x_center (float) – The x coordinate of the center of the circle.

  • y_center (float) – The y coordinate of the center of the circle.

append_ellipse(a_axis_min, a_axis_max, b_axis_min, b_axis_max)[source]

Appends an ellipse.

Parameters:
  • a_axis_min (float, optional) – The coordinate (signed) of the minimum (left) along the major axis.

  • a_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the major axis.

  • b_axis_min (float, optional) – TThe coordinate (signed) of the minimum (left) along the minor axis.

  • b_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis.

append_patch(patch=<syned.beamline.shape.BoundaryShape object>)[source]

Append a patch.

Parameters:

patch (instance of Rectangle, Circle, etc.) –

append_polygon(x, y)[source]

Appends a polygon.

Parameters:
  • x (list) – The polygon X coordinates.

  • y (list) – The polygon Y coordinates.

append_rectangle(x_left=-0.01, x_right=0.01, y_bottom=-0.02, y_top=0.02)[source]

Appends a rectangle.

Parameters:
  • x_left (float, optional) – The coordinate (signed) of the minimum (left) along the X axis.

  • x_right (float, optional) – The coordinate (signed) of the maximum (right) along the X axis.

  • y_bottom (float, optional) – The coordinate (signed) of the minimum (left) along the Y axis.

  • y_top (float, optional) – The coordinate (signed) of the maximum (right) along the Y axis.

get_boundaries()[source]

Returns a list with the concatenated boundaries of the sotred patches.

Return type:

list

get_name_of_patch(index)[source]

Returns the name of the patch with a given index.

Parameters:

index (int) – The index of the wanted patch.

Return type:

str

get_number_of_patches()[source]

Returns the number of stored patches.

Return type:

int

get_patch(index)[source]

Returns the patch corresponding to a given index.

Parameters:

index (int) – The index of the wanted patch.

Return type:

instance of BoundaryShape (Circle, Rectangle, etc.).

get_patches()[source]

Returns a list with the patches.

Return type:

list

reset()[source]

Removes all existing patches.

to_dictionary()[source]

Gets the dictionary with the multiple patch parameters.

Return type:

dict

class syned.beamline.shape.NumericalMesh(xx=None, yy=None, zz=None, surface_data_file=None)[source]

Bases: SurfaceShape

Implements an optical surface from a numerical mesh.

Constructor.

Parameters:
  • xx (numpy array, optional) – The x vector.

  • yy (numpy array, optional) – The y vector.

  • zz (numpy array, optional) – The z (2D) array.

  • surface_data_file (str, optional) – a file name from where the dara may come.

Notes

This is exactly the same as OasysSurfaceData class OasysSurfaceData(object), with added methods.

has_surface_data()[source]

Returns True is data is loaded.

Return type:

boolean

has_surface_data_file()[source]

Returns True is data file is set.

Return type:

boolean

class syned.beamline.shape.ParabolicCylinder(parabola_parameter=0.0, at_infinity=0, pole_to_focus=None, convexity=0, cylinder_direction=0)[source]

Bases: Paraboloid, Cylinder

Constructor.

Parameters:
  • parabola_parameter (float, optional) – parabola_parameter = 2 * focal_distance = - 0.5 * ccc_9 / ccc_2.

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

  • pole_to_focus (float, optional) – The p distance.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

classmethod create_parabolic_cylinder_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, at_infinity=0, convexity=0, cylinder_direction=0)[source]

Returns a ParabolicCylinder instance from factory parameters.

Parameters:
  • p (float) – The distance p (used if at_infinity=Side.IMAGE)

  • q (float) – The distance q (used if at_infinity=Side.SOURCE)

  • grazing_angle (float) – The distance p

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of ParabolicCylinder

classmethod create_parabolic_cylinder_from_parabola_parameter(parabola_parameter=0.0, at_infinity=0, pole_to_focus=None, convexity=0, cylinder_direction=0)[source]

Returns a ParabolicCylinder instance.

Parameters:
  • parabola_parameter (float, optional) – parabola_parameter = 2 * focal_distance = - 0.5 * ccc_9 / ccc_2.

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

  • pole_to_focus (float, optional) – The p distance.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of ParabolicCylinder

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, at_infinity=0)[source]

Sets the parameters calculated from factory parameters.

Parameters:
  • p (float) – The distance p (used if at_infinity=Side.IMAGE)

  • q (float) – The distance q (used if at_infinity=Side.SOURCE)

  • grazing_angle (float) – The distance p

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

Return type:

instance of ParabolicCylinder

class syned.beamline.shape.Paraboloid(parabola_parameter=0.0, at_infinity=0, pole_to_focus=None, convexity=0)[source]

Bases: SurfaceShape

Constructor.

Paraboloid: Revolution paraboloid (rotation around symmetry axis).

It is defined with three parameters: the parabola_parameter and two more parameters defining the position of the origin of the mirror.

The parabola_parameter = 2 * focal_length = - 0.5 * ccc_9 / ccc_2

The additional parameter can be the focal distances (“p” or “q”, one is infinity), “x0”, “y0” or the grazing angle. Here, we selected the at_infinity and the finite focal distance p or q or distance from the mirror pole to focus (pole to focus).

The parabola equation is:

ccc_2 y^2 + ccc_9 z = 0 or

y^2 = -ccc_9/ccc_2 z = 2 parabola_parameter z = 4 focal_length z

The focus is at (0, 0, focal_length).

The directrix is at (0, 0, -focal_length).

The distance from the directrix to focus is 2 * focal_length.

The radius of curvature at the vertex is 2 * focal_length.

Parameters:
  • parabola_parameter (float, optional) – parabola_parameter = 2 * focal_length = - 0.5 * ccc_9 / ccc_2. Equation: y^2 = 2 parabola_parameter z.

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

  • pole_to_focus (float, optional) – The p distance.

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

References

https://en.wikipedia.org/wiki/Parabola

https://doi.org/10.1107/S1600577522004593

https://arxiv.org/abs/2406.04079

classmethod create_paraboloid_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, at_infinity=0, convexity=0)[source]

Creates a paraboloid from the factory parameters.

Parameters:
  • p (float) – The distance p (used if at_infinity=Side.IMAGE)

  • q (float) – The distance q (used if at_infinity=Side.SOURCE)

  • grazing_angle (float) – The distance p

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

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

Return type:

instance of Paraboloid

classmethod create_paraboloid_from_parabola_parameter(parabola_parameter=0.0, at_infinity=0, pole_to_focus=None, convexity=0)[source]

Create a paraboloid.

Parameters:
  • parabola_parameter (float, optional) – parabola_parameter = 2 * focal_distance = - 0.5 * ccc_9 / ccc_2.

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

  • pole_to_focus (float, optional) – The p distance.

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

Return type:

instance of Paraboloid

get_at_infinity()[source]

Returns the “at_infinity” flag.

Returns:

SOURCE = 0, IMAGE = 1.

Return type:

int (as defined by Side)

get_grazing_angle()[source]

Returns the grazing angle.

Return type:

float

get_parabola_parameter()[source]

Returns the parabola parameter.

Return type:

float

classmethod get_parabola_parameter_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, at_infinity=0)[source]

Calculates the parabola parameter from the factory parameters.

Parameters:
  • p (float) – The distance p (used if at_infinity=Side.IMAGE)

  • q (float) – The distance q (used if at_infinity=Side.SOURCE)

  • grazing_angle (float) – The distance p

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

Returns:

The parabola parameter.

Return type:

float

get_pole_to_focus()[source]

Returns the distance from focus to pole.

Return type:

float

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, at_infinity=0)[source]

Sets the paraboloid parameters as calculated from the factory parameters.

Parameters:
  • p (float) – The distance p (used if at_infinity=Side.IMAGE)

  • q (float) – The distance q (used if at_infinity=Side.SOURCE)

  • grazing_angle (float) – The distance p

  • at_infinity (int (as defined by Side), optional) – SOURCE = 0, IMAGE = 1.

Return type:

instance of Paraboloid

class syned.beamline.shape.Plane[source]

Bases: SurfaceShape

Defines a plane surface shape.

class syned.beamline.shape.Polygon(x=[], y=[])[source]

Bases: BoundaryShape

Constructor.

Parameters:
  • x (list, optional) – A list with the X coordinates of the patch vertices.

  • y (list, optional) – A list with the Y coordinates of the patch vertices.

check_inside(x, y)[source]

Checks if a set of points are inside the patch (closed as polygon).

Parameters:
  • x0 (list) – The X coordinates of the points to check.

  • y0 (list) – The Y coordinates of the points to check.

Returns:

0=No, 1=Yes (inside).

Return type:

numpy array

References

https://stackoverflow.com/questions/36399381/whats-the-fastest-way-of-checking-if-a-point-is-inside-a-polygon-in-python

check_inside_one_point(x0, y0)[source]

Checks if a single point is inside the patch (closed as polygon).

Parameters:
  • x0 (float) – The X coordinate pf the point to check.

  • y0 (float) – The Y coordinate pf the point to check.

Return type:

boolean

References

https://stackoverflow.com/questions/36399381/whats-the-fastest-way-of-checking-if-a-point-is-inside-a-polygon-in-python

check_inside_vector(x0, y0)[source]

Checks if a set of points are inside the patch (closed as polygon).

Parameters:
  • x0 (numpy array) – The X coordinates of the points to check.

  • y0 (numpy array) – The Y coordinates of the points to check.

Returns:

0=No, 1=Yes (inside).

Return type:

numpy array

References

https://stackoverflow.com/questions/36399381/whats-the-fastest-way-of-checking-if-a-point-is-inside-a-polygon-in-python

check_outside(x0, y0)[source]

Checks if a set of points are outside the patch (closed as polygon).

Parameters:
  • x0 (list) – The X coordinates of the points to check.

  • y0 (list) – The Y coordinates of the points to check.

Returns:

0=No, 1=Yes (outside).

Return type:

numpy array

References

https://stackoverflow.com/questions/36399381/whats-the-fastest-way-of-checking-if-a-point-is-inside-a-polygon-in-python

get_boundaries()[source]

Returns the coordinates of the patch vertices.

Returns:

(list_of_x_coordinates, list_of_y_coordinates).

Return type:

tuple

get_number_of_vertices()[source]

Returns the number of vertices.

Return type:

int

get_polygon()[source]

Returns the vertices arranges as a polugon.

Returns:

[[x0,y0], [x1,y1], …]

Return type:

list

set_boundaries(x, y)[source]

Sets the coordinates of the patch vertices.

Parameters:
  • x (list) – A list with the X coordinates of the patch vertices.

  • y (list) – A list with the Y coordinates of the patch vertices.

class syned.beamline.shape.Rectangle(x_left=-0.01, x_right=0.01, y_bottom=-0.02, y_top=0.02)[source]

Bases: BoundaryShape

Constructor.

Parameters:
  • x_left (float, optional) – The coordinate (signed) of the minimum (left) along the X axis.

  • x_right (float, optional) – The coordinate (signed) of the maximum (right) along the X axis.

  • y_bottom (float, optional) – The coordinate (signed) of the minimum (left) along the Y axis.

  • y_top (float, optional) – The coordinate (signed) of the maximum (right) along the Y axis.

get_boundaries()[source]

Return the rectangle coordinates.

Returns:

(x_left, x_right, y_bottom, y_top).

Return type:

tuple

set_boundaries(x_left=-0.01, x_right=0.01, y_bottom=-0.02, y_top=0.02)[source]

Sets the rectangle coordinates.

Parameters:
  • x_left (float, optional) – The coordinate (signed) of the minimum (left) along the X axis.

  • x_right (float, optional) – The coordinate (signed) of the maximum (right) along the X axis.

  • y_bottom (float, optional) – The coordinate (signed) of the minimum (left) along the Y axis.

  • y_top (float, optional) – The coordinate (signed) of the maximum (right) along the Y axis.

set_width_and_length(width=0.01, length=0.03)[source]

Sets the rectangle parameters from width and length (centered at the origin).

Parameters:
  • width (float, optional) – The rectangle width.

  • length (float, optional) – The rectangle length.

class syned.beamline.shape.Shape[source]

Bases: SynedObject

Constructor.

class syned.beamline.shape.Side[source]

Bases: object

IMAGE = 1
SOURCE = 0
class syned.beamline.shape.Sphere(radius=1.0, convexity=0)[source]

Bases: SurfaceShape

Defines an spherical surface.

Parameters:
  • radius (float) – The sphere radius.

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

classmethod create_sphere_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, convexity=0)[source]

Defines an spherical surface.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

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

Return type:

instance of Sphere

classmethod create_sphere_from_radius(radius=0.0, convexity=0)[source]

Defines an spherical surface.

Parameters:
  • radius (float) – The sphere radius.

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

Return type:

instance of Sphere

get_radius()[source]

Returns the radius of the sphere.

Returns:

The radius of the sphere.

Return type:

float

classmethod get_radius_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Calculates the radius of the sphere from factory parameters (1/p+1/q=2/(R sin theta_grazing)))

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

Returns:

the calculated radius.

Return type:

float

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Defines an spherical surface.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

class syned.beamline.shape.SphericalCylinder(radius=1.0, convexity=0, cylinder_direction=0)[source]

Bases: Sphere, Cylinder

Constructor.

Parameters:
  • radius (float) – the radius of the circular section.

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

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

classmethod create_spherical_cylinder_from_p_q(p=2.0, q=1.0, grazing_angle=0.003, convexity=0, cylinder_direction=0)[source]
Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of SphericalCylinder

classmethod create_spherical_cylinder_from_radius(radius=0.0, convexity=0, cylinder_direction=0)[source]

Creates a spherical cylinder.

Parameters:
  • radius (float) – the radius of the circular section.

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

  • cylinder_direction (int (as defined by Direction), optional) – TANGENTIAL = 0, SAGITTAL = 1.

Return type:

instance of SphericalCylinder

classmethod get_radius_from_p_q_sagittal(p=2.0, q=1.0, grazing_angle=0.003)[source]

Calculates the sagittal radius from the factory parameters (1/p + 1/q = 2 sin(grazing_angle)/Rs).

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

Returns:

The calculated radius.

Return type:

float

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Calculates and sets the radius of curvature in the corresponding direction (tangential or sagittal. :param p: distance source-optical element. :type p: float, optional :param q: distance optical element to focus. :type q: float, optional :param grazing_angle: grazing angle in rad. :type grazing_angle: float, optional

class syned.beamline.shape.SurfaceShape(convexity=0)[source]

Bases: Shape

Constructor.

Parameters:

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

get_convexity()[source]

Gets the convexity flag.

Returns:

NONE = -1, UPWARD = 0, DOWNWARD = 1

Return type:

int

class syned.beamline.shape.Toroid(min_radius=0.0, maj_radius=0.0)[source]

Bases: SurfaceShape

Creator.

Parameters:
  • min_radius (float, optional) – The toroid minor radius

  • maj_radius (float, optional) – The toroid major radius. Note that this is the “optical” major radius at the farest surface from the center of the toroid. Indeed, it corresponds to the “toroid major radius” plus the min_radius.

classmethod create_toroid_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

returns a Toroid from factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

Return type:

instance of Toroid

classmethod create_toroid_from_radii(min_radius=0.0, maj_radius=0.0)[source]

returns a Toroid from main parameters (radii).

Parameters:
  • min_radius (float, optional) – The toroid minor radius

  • maj_radius (float, optional) – The toroid major radius. Note that this is the “optical” major radius at the farest surface from the center of the toroid. Indeed, it corresponds to the “toroid major radius” plus the min_radius.

Return type:

instance of Toroid

get_maj_radius()[source]

Returns the major (optical) radius.

Return type:

float

get_min_radius()[source]

Returns the minor radius.

Return type:

float

get_radii()[source]

Returns the radii.

Returns:

(min_radius, maj_radius).

Return type:

tuple

initialize_from_p_q(p=2.0, q=1.0, grazing_angle=0.003)[source]

Sets the parameters calculated from the factory parameters.

Parameters:
  • p (float, optional) – distance source-optical element.

  • q (float, optional) – distance optical element to focus.

  • grazing_angle (float, optional) – grazing angle in rad.

class syned.beamline.shape.TwoEllipses(a1_axis_min=-1e-05, a1_axis_max=1e-05, b1_axis_min=-5e-06, b1_axis_max=5e-06, a2_axis_min=-2e-05, a2_axis_max=2e-05, b2_axis_min=-8e-06, b2_axis_max=8e-06)[source]

Bases: BoundaryShape

Constructor.

Parameters:
  • a1_axis_min (float, optional) – The coordinate (signed) of the minimum (left) along the major axis of ellipse 1.

  • a1_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the major axis of ellipse 1.

  • b1_axis_min (float, optional) – TThe coordinate (signed) of the minimum (left) along the minor axis of ellipse 1.

  • b1_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis of ellipse 1.

  • a2_axis_min (float, optional) – The coordinate (signed) of the minimum (left) along the major axis of ellipse 2.

  • a2_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the major axis of ellipse 2.

  • b2_axis_min (float, optional) – TThe coordinate (signed) of the minimum (left) along the minor axis of ellipse 2.

  • b2_axis_max (float, optional) – The coordinate (signed) of the maximum (right) along the minor axis of ellipse 2.

get_axis()[source]

Returns the lengths of the axes of the two ellipses.

Returns:

(a1_length, b1_length, a2_length, b2_length).

Return type:

tuple

get_boundaries()[source]

Return the coordinates of the ellipses.

Returns:

(a1_axis_min, a1_axis_max, b1_axis_min, b1_axis_max, a2_axis_min, a2_axis_max, b2_axis_min, b2_axis_max).

Return type:

tuple

Module contents