ParallelCalculated

class marxs.simulator.ParallelCalculated(**kwargs)[source] [edit on github]

Bases: Parallel

Base class for containers that automatically determine positions of elements

ParallelCalculated derives from Parallel. It adds a mechanism to automatically calculate the pos4d matrices 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.

ParallelCalculated assumes that the pos4d matrix 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_spec as 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_spec defines 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 of parallel_spec. If this is a homogeneous coordinate (a point or direction), see normal_spec. If this is a callable, it will be called with two arguments, the output of pos_spec and normal_spec and should return an array of the same size.

Define a new MARXS element.

Methods Summary

calculate_elempos()

Calculate the position of elements based on some algorithm.

get_elemxyzw()

get_spec(specname, xyzw, *args, **kwargs)

Methods Documentation

calculate_elempos()[source] [edit on github]

Calculate the position of elements based on some algorithm.

Classes derived from ParallelCalculated can overwrite this method if they want to provide a way to calculate the pos4d matrices for the elements that make up this ParallelCalculated element.

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.

get_elemxyzw()[source] [edit on github]
get_spec(specname, xyzw, *args, **kwargs)[source] [edit on github]