Cylinder¶
- class marxs.math.geometry.Cylinder(kwargs={})[source]¶
Bases:
GeometryA 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
zoomkeyword, 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_limto the limits, e.g.[-np.pi / 2, np.pi / 2]makes a “half-pipe”.
Attributes Summary
Methods Summary
from_rowland(rowland, width[, rotation, kwargs])Generate a
Cylinderfrom aRowlandTorus.get_local_euklid_bases(interpos_local)Obtain a local euclidean 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]¶
Generate a
Cylinderfrom aRowlandTorus.According to the definition of the
marxs.design.rowland.RowlandTorusthe 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.piplaces 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]¶
Obtain a local euclidean base at a set of positions.
Parameters¶
- interpos_local
numpy.ndarrayof shape (N, 2) coordinates in the coordinate system of the geometry (e.g. (x, y), or (r, phi)).
Returns¶
- e_1, e_2, n
numpy.ndarrayof shape (N, 4) Vectors pointing in direction 1, 2, and normal to the surface.
- interpos_local
- intersect(dir, pos, transform=True)[source]¶
Calculate the intersection point between a ray and the element
Parameters¶
- dir
numpy.ndarrayof shape (N, 4) homogeneous coordinates of the direction of the ray
- pos
numpy.ndarrayof 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; ifFalseinput is in local coordinates.
Returns¶
- intersectboolean array of length N
Trueif an intersection point is found.- interpos
numpy.ndarrayof shape (N, 4) homogeneous coordinates of the intersection point. Values are set to
np.nanis no intersecton point is found.- interpos_local
numpy.ndarrayof shape (N, 2) phi, z coordiantes (in the local frame) for one of the intersection points. If both intersection points are required, reset
self.innerand call this function again.
- dir
- parametric_surface(phi=None, z=None, display={})[source]¶
Parametric description of the tube.
This is just another way to obtain the shape of the tube, e.g. for visualization.
Parameters¶
- phinp.array
phiis the angle around the tube profile. Set toNoneto use the extend of the element itself.- znp.array
The coordiantes along the radius coordinate. Set to
Noneto 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.
- position, orientation, zoom, pos4dsee description of