CylindricalDetector.surface_deriv¶
-
CylindricalDetector.
surface_deriv
(self, param)[source]¶ Return the surface derivative at
param
.The derivative at parameters
phi
andh
is given byderiv = R * ((-radius * sin(phi), 0), (-radius * cos(phi), 0), ( 0, 1))
where
R
is a rotation matrix.- Parameters
- param
array-like
or sequence Parameter value(s) at which to evaluate. A sequence of parameters must have length 2.
- param
- Returns
- deriv
numpy.ndarray
Array representing the derivative vector(s) at
param
. Ifparam
is a single parameter, the returned array has shape(2,)
, otherwiseparam.shape + (2,)
.
- deriv
See also
Examples
The method works with a single parameter, resulting in a single vector:
>>> part = odl.uniform_partition( ... [-np.pi / 2, -4], [np.pi / 2, 4], (10,8)) >>> det = CylindricalDetector( ... part, axes=[(1, 0, 0), (0, 0, 1)], radius = 2) >>> np.round(det.surface_deriv([0, 0]), 10) array([[ 2., -0., 0.], [ 0., 0., 1.]])
It is also vectorized, i.e., it can be called with multiple parameters at once (or an n-dimensional array of parameters):
>>> # 2 pairs of parameters, resulting in 3 vectors for each axis >>> deriv = det.surface_deriv([[0, np.pi / 2], [0, 1]]) >>> np.round(deriv[0], 10) array([[ 2., -0., 0.], [ 0., 0., 1.]]) >>> np.round(deriv[1], 10) array([[ 0., -2., 0.], [ 0., 0., 1.]]) >>> # Pairs of parameters in a (4, 5) array each >>> param = (np.zeros((4, 5)), np.zeros((4, 5))) # pairs of params >>> det.surface_deriv(param).shape (4, 5, 2, 3)