ParallelCalculated¶
- class marxs.simulator.ParallelCalculated(**kwargs)[source]¶
Bases:
ParallelBase class for containers that automatically determine positions of elements
ParallelCalculatedderives fromParallel. It adds a mechanism to automatically calculate thepos4dmatrices of all elements in this container when the object is initialized.This class cannot be used directly since derived classes have to add that algorithm. The following text explains how that works.
ParallelCalculatedassumes that thepos4dmatrix for each element can constructed from three vectors:Position of the center
Direction of normal (x-axis of element)
Direction the y-axis of the element should be normal to.
Parameters¶
- pos_specnp.array of shape (n, 4) or callable
Specification of the center positions for all elements in homogeneous coordinates. If this is callable, it will be called with no argument and should return an np.array of shape (n, 4).
- normal_specnp.array of shape (4, ) or callable
Specification of the normal for each element. This can either by a point in homogeneous coordinates (such as the focal point of the mirror). In case, the normal of all elements will be directed towards that point. If this is a direction in homogeneous coordinates (last coordinate is 0), then all normal vectors are parallel to this one (e.g. to make CCD elements that are all perpendicular to the optical axis). Finally, this can be a callable. In that case, it will be called with the element positions from
pos_specas input and should return an array of the same size with normal vectors.- parallel_specnp.array of shape (4, ) or callable
Specification of a direction that one box side of each element should be parallel to.
normal_specdefines a plane, but any rotation in that plane is still allowed. The element will be rotated such that one of the planes of the element contains the direction ofparallel_spec. If this is a homogeneous coordinate (a point or direction), seenormal_spec. If this is a callable, it will be called with two arguments, the output ofpos_specandnormal_specand should return an array of the same size.
Define a new MARXS element.
Methods Summary
Calculate the position of elements based on some algorithm.
get_spec(specname, xyzw, *args, **kwargs)Methods Documentation
- calculate_elempos()[source]¶
Calculate the position of elements based on some algorithm.
Classes derived from
ParallelCalculatedcan overwrite this method if they want to provide a way to calculate the pos4d matrices for the elements that make up thisParallelCalculatedelement.Returns¶
- pos4dlist of arrays
List of affine transformations that bring an optical element centered on the origin of the coordinate system with the active plane in the yz-plane to the required facet position on the Rowland torus.