coords.Coords.super_spherical#
- Coords.super_spherical(n=1.0, e=1.0, k=0.0, dir=(0, 1, 2), scale=(1.0, 1.0, 1.0), angle_spec=0.017453292519943295, colat=False)#
Perform a superspherical transformation.
super_sphericalis much like
spherical_to_cartesian(), but adds some extra parameters to enable the quick creation of a wide range of complicated shapes. Again, the input coordinates are interpreted as the longitude, latitude and distance in a spherical coordinate system.Parameters#
- n: float, >=0
Exponent defining the variation of the distance in north-south (latitude) direction. The default value 1 turns constant r-values into circular meridians. See notes.
- e: float, >=0
Exponent defining the variation of the distance in east-west (longitude) direction. The default value 1 turns constant r-values into a circular latitude lines. See notes.
- k: float, -1 < k < 1
Eggness factor. If nonzero, creates asymmetric northern and southern hemisheres. Values > 0 enlarge the southern hemisphere and shrink the northern, while negative values yield the opposite.
- dir: tuple of 3 ints, optional
If provided, it is a permutation of (0,1,2) and specifies which of the current coordinates are interpreted as resp. longitude (theta), latitude (phi) and distance (r). This allows the axis to be aligned with any of the global axes. Default order is (0,1,2). Beware that using a permutation that is not conserving the order of the globale axes (0,1,2), may lead to a confusing left-handed system.
- scale: tuple of 3 floats, optional
Scaling factors that are applied on the coordinate values prior to making the conversion from spherical to cartesian coordinates. These factors are always given in the order (theta,phi,r), irrespective of the permutation by dir.
- angle_spec: float, at.DEG or RAD, optional
Multiplication factor for angle coordinates. The default (at.DEG) interpretes the angles in degrees. Use RAD to specify the angles in radians.
- colat: bool
If True, the second coordinate is the colatitude instead. The colatitude is the angle measured from the north pole toward the south. In degrees, it is equal to
90 - latitudeand ranges from 0 to 180. Applications that deal with regions around the pole may benefit from using this option.
Raises#
- ValueError
If one of n, e or k is out of the acceptable range.
Notes#
Values of n and e should not be negative. Values equal to 1 create a circular shape. Other values keep the radius at angles corresponding to multiples of 90 degrees, while the radius at the intermediate 45 degree angles will be maximally changed. Values larger than 1 shrink at 45 degrees directions, while lower values increase it. A value 2 creates a straight line between the 90 degrees points (the radius at 45 degrees being reduced to 1/sqrt(2).
Examples#
>>> X = Coords([[ 0. , 0. , 1. ], ... [ 0. , 22.5, 1. ], ... [ 0. , 45. , 1. ], ... [ 0. , 67.5, 1. ], ... [ 0. , 90. , 1. ]]) >>> X.super_spherical(n=3).cartesian_to_spherical() Coords([[ 0. , 0. , 1. ], [ 0. , 4.0651, 0.7906], [ 0. , 45. , 0.5 ], [ 0. , 85.9349, 0.7906], [ 0. , 90. , 1. ]])
The result is smaller radius at angle 45.