magpy.initial_conditions module


Point randomly drawn from a uniform distribution on the unit sphere.

Randomly picking a point on the unit sphere requires choosing the point so that each solid angle on the sphere is equally likely.

Set np.random.seed(seed) for reproducible results.

Returns:a 3d array with the x,y,z coordinates of a random point
Return type:np.ndarray

Random uniformly distributed quaternion

A quaternion defines an 3d axis of rotation and a corresponding angle of rotation. A random quaternion is drawn by first drawing a random rotation axis from the uniform random sphere and a uniform angle. Random quaternions are used for random rotation operations on arbitrary geometries.

Returns:a random quaternion from a uniform distribution
Return type:transforms3d.Quaternion

Random 3d vectors (axes) uniformly distributed on unit sphere.

Returns N 3d unit vectors drawn from a uniform distribution over the unit sphere.

Set np.random.seed(seed) for reproducible results.

Parameters:N (int) – number of random axes to draw.
Returns:a 2d array size (Nx3). Random 3d unit vectors on the uniform random sphere.
Return type:np.ndarray