ParallelHoleCollimatorGeometry.det_axes¶
- ParallelHoleCollimatorGeometry.det_axes(angle)¶
Return the detector axes tuple at
angle
.- Parameters:
- anglefloat or
array-like
Angle(s) in radians describing the counter-clockwise rotation of the detector around
axis
.
- anglefloat or
- Returns:
- axes
numpy.ndarray
Unit vectors along which the detector is aligned. If
angle
is a single parameter, the returned array has shape(2, 3)
, otherwisebroadcast(*angle).shape + (2, 3)
.
- axes
Notes
To get an array that enumerates the detector axes in the first dimension, move the second-to-last axis to the first position:
axes = det_axes(angle) axes_enumeration = np.moveaxis(deriv, -2, 0)
Examples
Calling the method with a single angle produces a
(2, 3)
array of vertically stacked vectors:>>> apart = odl.uniform_partition(0, np.pi, 10) >>> dpart = odl.uniform_partition([-1, -1], [1, 1], (20, 20)) >>> geom = Parallel3dAxisGeometry(apart, dpart) >>> geom.det_axes(0) array([[ 1., 0., 0.], [ 0., 0., 1.]]) >>> np.allclose(geom.det_axes(np.pi / 2), [[0, 1, 0], ... [0, 0, 1]]) True
The method is vectorized, i.e., it can be called with multiple angles at once (or n-dimensional arrays of parameters):
>>> np.allclose(geom.det_axes([0, np.pi / 2]), ... [[[1, 0, 0], ... [0, 0, 1]], ... [[0, 1, 0], ... [0, 0, 1]]]) True >>> geom.det_axes(np.zeros((4, 5))).shape (4, 5, 2, 3)