SphericalDetector.surface¶
-
SphericalDetector.
surface
(self, param)[source]¶ Return the detector surface point corresponding to
param
.For parameters
phi
andtheta
, the surface point is given bysurf = R * radius * ( cos(phi) * cos(theta), -sin(phi) * cos(theta), sin(theta)) + t
where
R
is a rotation matrix andt
is a translation vector. Note that increase ofphi
corresponds to rotation in the clockwise direction, by analogy to flat detectors.- Parameters
- param
array-like
or sequence Parameter value(s) at which to evaluate. A sequence of parameters must have length 2.
- param
- Returns
- point
numpy.ndarray
Vector(s) pointing from the origin to the detector surface point at
param
. Ifparam
is a single parameter, the returned array has shape(3,)
, otherwisebroadcast(*param).shape + (3,)
.
- point
Examples
The method works with a single parameter, resulting in a single vector:
>>> part = odl.uniform_partition([-np.pi / 2, -np.pi / 3], ... [ np.pi / 2, np.pi / 3], [20, 10]) >>> det = SphericalDetector( ... part, axes=[(1, 0, 0), (0, 0, 1)], radius = 2) >>> det.surface([0, 0]) array([ 0., 0., 0.]) >>> np.round(det.surface([ np.pi / 2, np.pi / 3]), 2) array([ 1. , -2. , 1.73])
It is also vectorized, i.e., it can be called with multiple parameters at once (or an n-dimensional array of parameters):
>>> # 3 pairs of parameters, resulting in 3 vectors >>> np.round(det.surface([[-np.pi / 2, 0, np.pi / 2], ... [-np.pi / 3, 0, np.pi / 3]]), 2) array([[-1. , -2. , -1.73], [ 0. , 0. , 0. ], [ 1. , -2. , 1.73]]) >>> # Pairs of parameters in a (4, 5) array each >>> param = (np.zeros((4, 5)), np.zeros((4, 5))) >>> det.surface(param).shape (4, 5, 3)