Cylinder¶
- class marxs.math.geometry.Cylinder(kwargs={})[source] [edit on github]¶
Bases:
Geometry
A Geometry shaped like a ring or tube.
This object is shaped like a tube. The form is a circle in the xy plane and flat along the z-direction. This can be used, for example to simulate a setup that can follow the Rowland circle geometry exactly which is useful, e.g. to study the resolution of a spectrograph without worrying about the details of the detector geometry.
- Parameters:
- position, orientation, zoom, pos4dsee description of
pos4d
The radius of the tube is given by the
zoom
keyword, seepos4d
. Usezoom[0] == zoom[1]
to make a circular tube.zoom[0] != zoom[1]
gives an elliptical profile.zoom[2]
sets the extension in the z direction.- phi_limlist
If a cylinder does not cover the full circle, set
phi_lim
to the limits, e.g.[-np.pi / 2, np.pi / 2]
makes a “half-pipe”.
- position, orientation, zoom, pos4dsee description of
Attributes Summary
Methods Summary
from_rowland
(rowland, width[, rotation, kwargs])Generate a
Cylinder
from aRowlandTorus
.get_local_euklid_bases
(interpos_local)Obtain a local eukledian base at a set of positions.
intersect
(dir, pos[, transform])Calculate the intersection point between a ray and the element
parametric_surface
([phi, z, display])Parametric description of the tube.
Attributes Documentation
- coos_limits = [array([-3.14159265, 3.14159265]), array([-1, 1])]¶
- loc_coos_name = ['phi', 'z']¶
- shape = 'surface'¶
Methods Documentation
- classmethod from_rowland(rowland, width, rotation=0.0, kwargs={})[source] [edit on github]¶
Generate a
Cylinder
from aRowlandTorus
.According to the definition of the
marxs.design.rowland.RowlandTorus
the origin phi=0 is at the “top”. When this class method is used to make a detector that catches all dispersed grating signal on the Rowland torus, arotation=np.pi
places the center of the Cylinder close to the center of the torus (the location of the focal point in the standard Rowland geometry).- Parameters:
- rowland
RowlandTorus
The circular detector is constructed to fit exactly into the Rowland Circle defined by
rowland
.- widthfloat
Half-width of the tube in the flat direction (z-axis) in mm
- rotationfloat
Rotation angle of the Cylinder around its z-axis compared to the phi=0 position of the Rowland torus.
- rowland
- get_local_euklid_bases(interpos_local)[source] [edit on github]¶
Obtain a local eukledian base at a set of positions.
- Parameters:
- interpos_local
numpy.ndarray
of shape (N, 2) coordinates in the coordiante system of the geometry (e.g. (x, y), or (r, phi)).
- interpos_local
- Returns:
- e_1, e_2, n
numpy.ndarray
of shape (N, 4) Vectors pointing in direction 1, 2, and normal to the surface.
- e_1, e_2, n
- intersect(dir, pos, transform=True)[source] [edit on github]¶
Calculate the intersection point between a ray and the element
- Parameters:
- dir
numpy.ndarray
of shape (N, 4) homogeneous coordinates of the direction of the ray
- pos
numpy.ndarray
of shape (N, 4) homogeneous coordinates of a point on the ray
- transformbool
If
True
, input is in global coordinates and needs to be transformed here for the calculations; ifFalse
input is in local coordinates.
- dir
- Returns:
- intersectboolean array of length N
True
if an intersection point is found.- interpos
numpy.ndarray
of shape (N, 4) homogeneous coordinates of the intersection point. Values are set to
np.nan
is no intersecton point is found.- interpos_local
numpy.ndarray
of shape (N, 2) phi, z coordiantes (in the local frame) for one of the intersection points. If both intersection points are required, reset
self.inner
and call this function again.
- parametric_surface(phi=None, z=None, display={})[source] [edit on github]¶
Parametric description of the tube.
This is just another way to obtain the shape of the tube, e.g. for visualization.
- Parameters:
- phinp.array
phi
is the angle around the tube profile. Set toNone
to use the extend of the element itself.- znp.array
The coordiantes along the radius coordinate. Set to
None
to use the extend of the element itself.
- Returns:
- xyzwnp.array
Ring coordinates in global homogeneous coordinate system. The array has the following shape (npoints, 2, 4).
xyzw[:, 0, :]
describes one rim of the cylinder,xyzw[:, 1, :]
the other rim.