coords.Coords.hyper_cylindrical#
- Coords.hyper_cylindrical(dir=(0, 1, 2), scale=(1.0, 1.0, 1.0), rfunc=None, zfunc=None, angle_spec=0.017453292519943295)#
Convert cylindrical coordinates to Cartesian with advanced, angle-dependent scaling.
This is similar to
cylindrical_to_cartesian()but allows extra scaling functions for the radial (r) and axial (z) coordinates that depend on the angular coordinate theta.Parameters#
dir, scale, angle_spec: see
cylindrical_to_cartesian()- rfunc: callable, optional
Function r(theta) taking a float theta (angle) and returning a multiplicative scaling factor for r. Applied after scale[0].
- zfunc: callable, optional
Function z(theta) taking a float theta (angle) and returning a multiplicative scaling factor for z. Applied after scale[2].
See Also#
cylindrical_to_cartesian(): similar but without the rfunc and zfunc options.
Examples#
>>> X = Coords([[1.0, 0.0, 1.0], ... [1.0, 1.0, 1.0], ... [1.0, 2.0, 1.0], ... [1.0, 3.0, 1.0], ... [1.0, 4.0, 1.0], ... [1.0, 5.0, 1.0]]) >>> rfunc = lambda theta: 1 + 0.1 * theta # increase radius with theta >>> zfunc = lambda theta: 1 + 0.05 * theta # increase height with theta >>> Y = X.hyper_cylindrical(scale=(1.0, 60.0, 1.0), rfunc=rfunc, zfunc=zfunc) >>> print(Y) [[ 1. 0. 1. ] [ 0.5524 0.9567 1.0524] [-0.6047 1.0474 1.1047] [-1.3142 -0. 1.1571] [-0.7094 -1.2288 1.2094] [ 0.7618 -1.3195 1.2618]]