priors

banded_angles(\*models)
cartesian2polar(ratios) ratios : np.ndarray (k, n):
difference_operator(order, nobs) Get a finite difference operator matrix of size nobs.
polar2cartesian(angles[, radius, …]) Convert a set of angles of a sphere defined in n-dimensional space to cartesian coordinates.
sample_spherical_polar(ndimensions[, …])
sample_uniform_hypersphere(ndimensions[, …]) S2 has a solution: http://mathworld.wolfram.com/SpherePointPicking.html
sample_uniform_sphere([nsamples]) S2 has a solution: http://mathworld.wolfram.com/SpherePointPicking.html
show_spherical_angles([theta1, theta2, …]) Draw a vector on the unit sphere defined by the angles theta1 (inclination on last axis, x_3, x_3->x1) and theta2 (asymuth x_1->x_2 plane).
simple_polar2cartesian(angle[, radius]) Given some polar coordinates, return the cartesian coordinates.
simple_sphere_angle(x, y, z)
simple_sphere_coord([radius, theta1, theta2])
spherical_coordinates_n2([offset, nsamples, …])
spherical_coordinates_n3([offset, nsamples, …])
standard_sphere_coord(angle[, radius]) standard physics way theta1: inclination (angle between z and x/y theta2: asymuth (angle on x-y plane)
test_spherical_coords()

banded_angles

tikreg.priors.banded_angles(*models)

cartesian2polar

tikreg.priors.cartesian2polar(ratios)
ratios : np.ndarray (k, n):
k coordinates in n dimensional space
Returns:
angles : np.ndarray (k, n-1)

Poolar angles defining the ratios

[x_1, …, x_n]
phi_i is angle

difference_operator

tikreg.priors.difference_operator(order, nobs)

Get a finite difference operator matrix of size nobs.

Parameters:
order : int

The order of the derivative (e.g. 2nd derivative)

nobs : int

The size of the output matrix

Returns:
mat : (nobs,`nobs`) np.ndarray

polar2cartesian

tikreg.priors.polar2cartesian(angles, radius=1.0, physics_convention=False)

Convert a set of angles of a sphere defined in n-dimensional space to cartesian coordinates.

Parameters:
angles : np.ndarray (n-1, k)

The k angles in n dimensional space to convert from polar to cartesian coordinates.

raw : bool

Use hypersphere standard form. This differs from the standard 3-dimensional sphere in axis orientation.

Returns:
coords : np.ndarray (n, k)

All the x_i coordinates corresponding to the k angles

Notes

theta_1 is angle away from x_{n} (inclination towards x_{n-1}) in [0,pi] theta_2 is angle away from x_{n-1} (inclination towards x_{n-2}) in [0,pi] …etc theta_{n-1} is the angle between x_1 and x_2 (asymuth) in [0,2pi]

https://en.wikipedia.org/wiki/N-sphere#Spherical_coordinates

sample_spherical_polar

tikreg.priors.sample_spherical_polar(ndimensions, offset=1, nsamples=10, max_angle=90.0, spacing=<function linspace at 0x7f65ad9021b8>)

sample_uniform_hypersphere

tikreg.priors.sample_uniform_hypersphere(ndimensions, nsamples=10)

S2 has a solution: http://mathworld.wolfram.com/SpherePointPicking.html

S3 has a solution: http://mathworld.wolfram.com/HyperspherePointPicking.html

No general solution for higher dimensions

sample_uniform_sphere

tikreg.priors.sample_uniform_sphere(nsamples=10)

S2 has a solution: http://mathworld.wolfram.com/SpherePointPicking.html

show_spherical_angles

tikreg.priors.show_spherical_angles(theta1=30.0, theta2=60.0, physics_convention=False)

Draw a vector on the unit sphere defined by the angles theta1 (inclination on last axis, x_3, x_3->x1) and theta2 (asymuth x_1->x_2 plane).

simple_polar2cartesian

tikreg.priors.simple_polar2cartesian(angle, radius=1.0)

Given some polar coordinates, return the cartesian coordinates.

Parameters:
angle : vector (p,)

The angles should be given in radians

radius: float-like

The n-sphere radius

Returns:
coords : vector, (p+1,)

The cartesian coordinate of the points (x_n,…,x_1)

simple_sphere_angle

tikreg.priors.simple_sphere_angle(x, y, z)

simple_sphere_coord

tikreg.priors.simple_sphere_coord(radius=1.0, theta1=45.0, theta2=45.0)

spherical_coordinates_n2

tikreg.priors.spherical_coordinates_n2(offset=0, nsamples=10, spacing=<function linspace at 0x7f65ad9021b8>)

spherical_coordinates_n3

tikreg.priors.spherical_coordinates_n3(offset=0, nsamples=10, spacing=<function linspace at 0x7f65ad9021b8>)

standard_sphere_coord

tikreg.priors.standard_sphere_coord(angle, radius=1.0)

standard physics way theta1: inclination (angle between z and x/y theta2: asymuth (angle on x-y plane)

test_spherical_coords

tikreg.priors.test_spherical_coords()