GratingArrayStructure¶
- class marxs.design.rowland.GratingArrayStructure(**kwargs)[source] [edit on github]¶
Bases:
ElementsOnTorus
Collection of diffraction gratings on the Rowland Torus
When a
GratingArrayStructure
(GAS) is initialized, it places elements in the space available on the Rowland circle, most commonly, this class is used to place grating facets.After generation, individual facet positions can be adjusted by hand by editing the attributes
elem_pos
orelem_uncertainty
. SeeParallel
for details.After any of the
elem_pos
,elem_uncertainty
oruncertainty
is changed,generate_elements
needs to be called to regenerate the facets on the GAS.- Parameters:
- radiuslist of 2 floats
Inner and outer radius of the GAS as measured in the yz-plane from the origin.
- phifloat or list of 2 floats
Bounding angles for a segment covered by the GSA. \(\phi=0\) is on the positive y axis. The segment fills the space from
phi1
tophi2
in the usual mathematical way (counterclockwise). Angles are given in radian. Note thatphi[1] < phi[0]
is possible if the segment crosses the y axis. Alternatively,phi
can just be a single number. In that case, there will be exactly one element per radius.
Define a new MARXS element.
Methods Summary
distribute_elements_on_arc
(radius)Distribute elements on an arc.
Distributes elements as evenly as possible along a radius.
Specify the element position in the yz plane
max_elements_on_arc
(radius)Calculate maximal number of elements that can be placed at a certain radius.
max_elements_on_radius
(radius)Distribute elements on a radius.
Methods Documentation
- distribute_elements_on_arc(radius)[source] [edit on github]¶
Distribute elements on an arc.
The elements are distributed as evenly as possible over the arc.
Note
Contrary to
distribute_elements_on_radius
, elements never stretch beyond the limits set by thephi
parameter of the GAS. If an arc segment is not wide enough to accommodate at least a single element, it will go empty. (The exception to that is isphi
is a single value. In that case, there will be exactly one element.)- Parameters:
- radiusfloat
radius of arc where the elements are to be distributed.
- Returns:
- centeranglesarray
The phi angles for centers of the elements at
radius
.
- distribute_elements_on_radius()[source] [edit on github]¶
Distributes elements as evenly as possible along a radius.
Note
Unlike
distribute_elements_on_arc
, this function will have elements reaching beyond the limits of the radius, if the distance between inner and outer radius is not an integer multiple of the element size.- Returns:
- radiinp.ndarray
Radii of the element center positions.
- elemposyz()[source] [edit on github]¶
Specify the element position in the yz plane
For the torus, the Rowland circle lies in the xy plane and the symmetry axis of the torus is the y-axis. In this class, the position of the elements is specified in the yz plane in the coordinates of the torus and the remaining coordinate.
This function will be customized by derived classes.
- Returns:
- ypos, zposnp.array
1D arrays of y and z positions for the elements distributed in 2D.
- max_elements_on_arc(radius)[source] [edit on github]¶
Calculate maximal number of elements that can be placed at a certain radius.
- Parameters:
- radiusfloat
Radius of circle where the centers of all elements will be placed.
- max_elements_on_radius(radius)[source] [edit on github]¶
Distribute elements on a radius.
- Parameters:
- radiuslist of two floats
inner and outer radius that should be covered by elements
- Returns:
- nint
Number of elements needed to cover a given radius segment. Elements might reach beyond the radius limits if the difference between inner and outer radius is not an integer multiple of the element size.