# PYME.Analysis.points.spherical_harmonics module¶

Estimate spherical harmonics from a point data set

PYME.Analysis.points.spherical_harmonics.cart2sph(x, y, z)
PYME.Analysis.points.spherical_harmonics.r_sph_harm(m, n, theta, phi)

return real valued spherical harmonics. Uses the convention that m > 0 corresponds to the cosine terms, m < zero the sine terms

Parameters: m : int n : int theta : ndarray the azimuth angle in [0, 2pi] phi : ndarray the elevation in [0, pi]
PYME.Analysis.points.spherical_harmonics.reconstruct_from_modes(modes, coeffs, theta, phi)
PYME.Analysis.points.spherical_harmonics.sph2cart(az, el, r)

Convert sperical coordinates into cartesian

Parameters: az : ndarray azimuth (angle in x,y plane) el : ndarray elevation (angle from z axis) r : ndarray radius x, y, z
PYME.Analysis.points.spherical_harmonics.sphere_expansion(x, y, z, mmax=3, centre_points=True)

Project coordinates onto spherical harmonics

Parameters: x : ndarray x coordinates y : ndarray y coordinates z : ndarray z coordinates mmax : int Maximum order to calculate to centre_points : bool Subtract the mean from the co-ordinates before projecting modes : list of tuples a list of the (m, n) modes projected onto c : ndarray the mode coefficients centre : tuple the x, y, z centre of the object (if we centred the points pripr to calculation).
PYME.Analysis.points.spherical_harmonics.sphere_expansion_clean(x, y, z, mmax=3, centre_points=True, nIters=2, tol_init=0.3)

Project coordinates onto spherical harmonics

Parameters: x : ndarray x coordinates y : ndarray y coordinates z : ndarray z coordinates mmax : int Maximum order to calculate to centre_points : bool Subtract the mean from the co-ordinates before projecting modes : list of tuples a list of the (m, n) modes projected onto c : ndarray the mode coefficients centre : tuple the x, y, z centre of the object (if we centred the points prior to calculation).
PYME.Analysis.points.spherical_harmonics.visualize_reconstruction(modes, coeffs, d_phi=0.1, zscale=1.0)