Package: pyssht
SSHT Python DocumentationThis guide is intended to explain the python interface of SSHT. For a
description of the workings of SSHT seehere. The
python package also offers an interface to some of the functionality fromducc0, including forward and inverse
transforms.pyssht.forwardflm = pyssht.forward(f, int L, Spin=0, Method='MW', Reality=False)Performs the forward spherical harmonic transform.Inputsfthe signal on the sphere,numpy.ndarraytypecomplexorreal, ndim 2. NB different for'MW_pole'sampling.Lthe band limit of the signal, non-zero positive integerSpinthe spin of the signal, non-negative integer (default = 0)Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]Realitydetermines if the signal is real or complex, Boolean (default = False)backendthe backend that runs the transforms:'SSHT'this package'ducc'interface toducc0. "MW_pole"
is not available in this backend.nthreads: number of threads when calling into the'ducc'backend. Ignored otherwise.Outputflmthe spherical harmonic transform off, 1Dnumpy.ndarraytypecomplexNote on'MW_pole'samplingThis is the same as the'MW'sampling however the south pole is expressed as a double only not a vector. Therefore the size of the array is one smaller on the (\theta) direction.fis now a tuple containing either:(f_array, f_sp, phi_sp)if complex transform(f_array, f_sp)if real transformpyssht.inversef = pyssht.inverse(np.ndarray[ double complex, ndim=1, mode="c"] f_lm not None, L, Spin=0, Method='MW', Reality=False)Performs the inverse spherical harmonic transform.Inputsflmthe spherical harmonic transform off,numpy.ndarraytypecomplex, ndim 1Lthe band limit of the signal, non-zero positive integerSpinthe spin of the signal, non-negative integer (default = 0)Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]Realitydetermines if the signal is real or complex, Boolean (default = False)backendthe backend that runs the transforms:'SSHT'this package'ducc'interface toducc0. "MW_pole"
is not available in this backend.nthreads: number of threads when calling into the'ducc'backend. Ignored otherwise.Outputfthe signal on the sphere, 2Dnumpy.ndarraytypecomplexorreal. NB different for'MW_pole'sampling.Note on'MW_pole'samplingThis is the same as the'MW'sampling however the south pole is expressed as a double only not a vector. Therefore the size of the array is one smaller on the (\theta) direction.fis now a tuple containing either:(f_array, f_sp, phi_sp)if complex transform(f_array, f_sp)if real transformpyssht.forward_adjointf = pyssht.forward_adjoint(np.ndarray[ double complex, ndim=1, mode="c"] f_lm not None, L, Spin=0, Method='MW', Reality=False)Performs the adjoint of the forward spherical harmonic transform.Inputsflmthe spherical harmonic transform off,numpy.ndarraytypecomplex, ndim 1Lthe band limit of the signal, non-zero positive integerSpinthe spin of the signal, non-negative integer (default = 0)Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MWSS'[McEwen & Wiaux symmetric sampling]Realitydetermines if the signal is real or complex, Boolean (default = False)backendthe backend that runs the transforms:'SSHT'this package'ducc'interface toducc0.nthreads: number of threads when calling into the'ducc'backend. Ignored otherwise.Outputfthe signal on the sphere, 2Dnumpy.ndarraytypecomplexorreal.pyssht.inverse_adjointflm = pyssht.inverse_adjoint(f, int L, Spin=0, Method='MW', Reality=False)Performs the adjoint of the inverse spherical harmonic transform.Inputsfthe signal on the sphere,numpy.ndarraytypecomplexorreal, ndim 2.Lthe band limit of the signal, non-zero positive integerSpinthe spin of the signal, non-negative integer (default = 0)Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MWSS'[McEwen & Wiaux symmetric sampling]Realitydetermines if the signal is real or complex, Boolean (default = False)backendthe backend that runs the transforms:'SSHT'this package'ducc'interface toducc0.nthreads: number of threads when calling into the'ducc'backend. Ignored otherwise.Outputflmthe spherical harmonic transform off, 1Dnumpy.ndarraytypecomplexpyssht.elm2indindex = pyssht.elm2ind( int el, int m)Computes the index in theflmarray of a particular harmonic coefficient (\ell ) and (m).Inputselthe scale parameter of the spherical harmonic coefficients, integer from (0) to (L-1), where (L) is the band limit.emthe azimuthal parameter, integer from -el to el.OutputIndex of the coefficient inflmarray, integerpyssht.ind2elm(el, em) = pyssht.ind2elm(int ind)Computes harmonic coefficient (\ell ) and (m) from the index in theflmarray.Inputsindindex of theflmarrayOutputTuple containing(el, em)elthe scale parameter of the spherical harmonic coefficients, integer from (0) to (L-1), where (L) is the band limit.emthe azimuthal parameter, integer from -el to el.pyssht.theta_to_indexp = pyssht.theta_to_index(double theta, int L, str Method="MW")Outputs the (\theta) index (the first) in the 2 dimensional array used to store spherical images. The index returned is that of the closest (\theta) sample smaller then the angle given on input.Inputsthetathe angle (\theta)Lthe band limit of the signal, non-zero positive integerMethodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]OutputIntpof corresponding to the angle (\theta).pyssht.phi_to_indexq = pyssht.phi_to_index(double phi, int L, str Method="MW")Outputs the (\phi) index (the second) in the 2 dimensional array used to store spherical images. The index returned is that of the closest (\phi) sample smaller then the angle given on input.Inputsphithe angle (\phi)Lthe band limit of the signal, non-zero positive integerMethodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]OutputIntqof corresponding to the angle (\phi).pyssht.sample_lengthn = pyssht.sample_length(int L, Method = 'MW')Outputs a size of the array used for storing the data on the sphere for different sampling schemes.InputsLthe band limit of the signal, non-zero positive integerMethodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]OutputIntnequal to the collapsed 1 dimensional size of the 2 dimensional array used to store data on the sphere.pyssht.sample_shape(n_theta, n_phi) = pyssht.sample_shape(int L, Method='MW')Outputs a tuple with the shape of the array used for storing the data on the sphere for different sampling schemes.InputsLthe band limit of the signal, non-zero positive integerMethodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]OutputTuple containing(n_theta, n_phi)n_thetathe number of samples in the (\theta) direction, integern_phithe number of samples in the (\phi) direction, integerpyssht.sample_positions(thetas, phis) = pyssht.sample_positions(int L, Method = 'MW', Grid=False)Computes the positions on the sphere of the samples.InputsLthe band limit of the signal, non-zero positive integerMethodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]Griddescribes if the output is a vector of the sample positions or a 2D array the same shape as the signal on the sphere, defaultFalseOutputsTuple containing(thetas, phis)thetaspositions of the samples in the (\theta) directionphispositions of the samples in the (\theta) directionpyssht.s2_to_cart(x, y, z) = pyssht.s2_to_cart(theta, phi)Computes the (x), (y), and (z) coordinates from (\theta) and (\phi) on the sphere.Inputstheta(\theta) values, typenumpy.ndarrayphi(\phi) values, typenumpy.ndarrayOutputTuple containing(x, y, z)xthe (x) coordinate of each point, typenumpy.ndarrayythe (y) coordinate of each point, typenumpy.ndarrayzthe (z) coordinate of each point, typenumpy.ndarraypyssht.cart_to_s2thetas, phis = cart_to_s2(x, y, z)Computes the (\theta) and (\phi) on the coordinates on the sphere from (x), (y), and (z) coordinates.Inputsx(x) values, typenumpy.ndarrayy(y) values, typenumpy.ndarrayz(z) values, typenumpy.ndarrayOutputTuple containing(theta, phi)thetathe (\theta) coordinate of each point, typenumpy.ndarrayphithe (\phi) coordinate of each point, typenumpy.ndarraypyssht.spherical_to_cart(x, y, z) = pyssht.spherical_to_cart(r, theta, phi)Computes the (x), (y), and (z) coordinates from the spherical coordinates (r), (\theta) and (\phi).Inputsr(r) values, typenumpy.ndarraytheta(\theta) values, typenumpy.ndarrayphi(\phi) values, typenumpy.ndarrayOutputTuple containing(x, y, z)xthe (x) coordinate of each point, typenumpy.ndarrayythe (y) coordinate of each point, typenumpy.ndarrayzthe (z) coordinate of each point, typenumpy.ndarraypyssht.cart_to_sphericalr, theta, phi = pyssht.cart_to_spherical(x, y, z)Computes the (\r), (\theta) and (\phi) on the spherical coordinates from (x), (y), and (z) coordinates.Inputsx(x) values, typenumpy.ndarrayy(y) values, typenumpy.ndarrayz(z) values, typenumpy.ndarrayOutputTuple containing(r, theta, phi)rthe (r) coordinate of each point, typenumpy.ndarraythetathe (\theta) coordinate of each point, typenumpy.ndarrayphithe (\phi) coordinate of each point, typenumpy.ndarraypyssht.theta_phi_to_ra_dec(dec, ra) = pyssht.theta_phi_to_ra_dec(theta, phi, Degrees=False)Computes the Right Assension and declination from an array of (\theta) and (\phi) values.Inputstheta(\theta) values, typenumpy.ndarrayphi(\phi) values, typenumpy.ndarrayDegreesdefines if the output is in degrees or radiansOutputTuple containing(dec, ra)decthe declination angle,numpy.ndarrayrathe Right Assension,numpy.ndarraypyssht.ra_dec_to_theta_phi(theta, phi) = pyssht.ra_dec_to_theta_phi(ra, dec, Degrees=False)Computes the (\theta) and (\phi) values from an array of Right Assension and declination values.Inputsdecthe declination angle,numpy.ndarrayrathe Right Assension,numpy.ndarrayDegreesdefines if the input is in degrees or radians, if degrees they are convertedOutputTuple containing(theta, phi])theta(\theta) values, typenumpy.ndarrayphi(\phi) values, typenumpy.ndarraypyssht.make_rotation_matrixrot_much = pyssht.make_rotation_matrix(list rot)Computes the 3 by 3 rotation matrix from the Euler angles given on inputInputsrotList of length 3. Each element are the Euler angles[alpha, beta, gamma]Output3 by 3rot_matrixthe rotation matrix typendarraydtypefloatpyssht.rot_cartx_p, y_p, z_p = pyssht.rot_cart(x, y, z, list rot)Computes the rotations of the cartesian coordinates given a set of Euler angles. The inputs can be any shapendarrays. For speed if the arrays are 1 or 2 dimensional it is recommended to usepyssht.rot_cart_1Dorpyssht.rot_cart_2D.Inputsx(x) values, typenumpy.ndarrayy(y) values, typenumpy.ndarrayz(z) values, typenumpy.ndarrayrotList of length 3. Each element are the Euler angles[alpha, beta, gamma]OutputTuple containing(x_p, y_p, z_p)the rotated coordinates the same shape and type as the inputs.pyssht.rot_cart_1d and pyssht.rot_cart_2d(x_p, y_p, z_p) = pyssht.rot_cart_1d(np.ndarray[np.float_t, ndim=1] x, np.ndarray[np.float_t, ndim=1] y, np.ndarray[np.float_t, ndim=1] z, list rot)(x_p, y_p, z_p) = pyssht.rot_cart_2d(np.ndarray[np.float_t, ndim=2] x, np.ndarray[np.float_t, ndim=2] y, np.ndarray[np.float_t, ndim=2] z, list rot)Computes the rotations of the cartesian coordinates given a set of Euler angles. The inputs can be any shapendarrays. Same aspyssht.rot_cartexcept optimised for arrays that are 1 or 2 dimensional.Inputsx(x) values, typenumpy.ndarray, dtypefloat, ndim 1 or 2y(y) values, typenumpy.ndarray, dtypefloat, ndim 1 or 2z(z) values, typenumpy.ndarray, dtypefloat, ndim 1 or 2rotList of length 3. Each element are the Euler angles[alpha, beta, gamma]OutputTuple containing(x_p, y_p, z_p)the rotated coordinates the same shape and type as the inputs.pyssht.plot_spherepyssht.plot_sphere(
    f, L, Method='MW', Close=True, Parametric=False,
    Parametric_Scaling=[0.0,0.5], Output_File=None,
    Show=True, Color_Bar=True, Units=None, Color_Range=None,
    Axis=True
)Plots data on to a sphere. It is really slow and not very good!Inputsfthe signal on the sphere,numpy.ndarraytypecomplexorreal, ndim 2. NB different for'MW_pole'sampling.Lthe band limit of the signal, non-zero positive integerMethodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MW_pole'[McEwen & Wiaux sampling with the south pole as a separate double.]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]Closeif true the full sphere is plotted (without a gap after the last (\phi) position), defaultTrueParametricthe radius of the object at a certain point is defined by the function (not just the color), defaultFalseParametric_Salingused ifParametric=True, defines the radius of the shape at a particular angler = norm(f)*Parametric_Saling[1] + Parametric_Saling[0], default[0.0,0.5]Output_Fileif set saves the plot to a file of that nameShowifTrueshows you the plot, defaultFalseColor_BarifTrueshows the color bar, defaultTrueUnitsis set puts a label on the color barColor_Rangeif set saturates the color bar in that range, else the function min and max is usedAxisifTrueshows the 3d axis, defaultTrueOutputsNonepyssht.mollweide_projectionf_plot, mask = pyssht.mollweide_projection(
    f, L, resolution=500, rot=None,
    zoom_region=[np.sqrt(2.0)*2,np.sqrt(2.0)],
    Method="MW"
)Creates anndarrayof the mollweide projection of a spherical image and a mask array. This is useful for plotting results, not to be used for analysis on the plane. Elements in the signalfthat areNaNs are marked in the mask. This allows one to plot these regions the color of their choice.Here is an example of using the function to plot real spherical data.f_plot, mask = pyssht.mollweide_projection(f, L, Method="MW") # make projection
plt.figure() # start figure
imgplot = plt.imshow(f_real_plot,interpolation='nearest') # plot the projected image
plt.colorbar(imgplot,fraction=0.025, pad=0.04) # plot color bar (these extra keywords make the bar a reasonable size)
plt.imshow(mask_real, interpolation='nearest', cmap=cm.gray, vmin=-1., vmax=1.) # plot the NaN regions in grey
plt.gca().set_aspect("equal") # ensures the region is the correct proportions
plt.axis('off') # removes axis (looks better)
plt.show()Inputsfthe signal on the sphere,numpy.ndarraytypecomplexorreal, ndim 2.Lthe band limit of the signal, non-zero positive integerresolutionsize of the projected image, default 500rotIf the image should be rotated before projecting, None.rotshould be a list of length 1 or 3. If 1 then the image is rotated around the (z) axis by that amount. If 3 then the image is rotated by the Euler angles given in the list.zoom_regionthe region of the sphere to be plotted, default[np.sqrt(2.0)*2,np.sqrt(2.0)]is the full sphere.Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]OutputsIf the input is real:Tuple containing:f_plotthe projection of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmaskthe projection of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.If the input is complex:Tuple containing:f_plot_realthe projection of the real part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_realthe projection of the masked regions (NaNs in inputf.real) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.f_plot_imagthe projection of the imaginary part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_imagthe projection of the masked regions (NaNs in inputf.imag) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.pyssht.equatorial_projectionf_proj_real, mask_real, (f_proj_imag, mask_imag)\
            = pyssht.equatorial_projection(f, int L, int resolution=500,\
             rot=None, list zoom_region=[-1,-1], str Method="MW", \
             str Projection="MERCATOR", int Spin=0)Createsndarrays of the projections of a spherical image and a mask array. This is useful for plotting results and performing analysis on the plane. All the spherical samples that fall in one planar pixel is averaged, if no samples fall in a pixel then the pixel is assigned the value of the closest spherical sample. Elements in the signalfthat areNaNs are marked in the mask. This allows one to plot these regions the color of their choice.There are two projections supported.The Mercator projection often used in maps.The Sinusoidal projection a simple equal area projection.Here is an example of using the function to plot real spherical data using the Mercator projection.f_proj, mask \
        = pyssht.equatorial_projection(f, L, resolution=500, Method="MW", \
        Projection="MERCATOR")
plt.figure() # start figure
imgplot = plt.imshow(f_proj,interpolation='nearest')# plot the projected image (north part)
plt.colorbar(imgplot) # plot color bar
plt.imshow(mask, interpolation='nearest', cmap=cm.gray, vmin=-1., vmax=1.) # plot the NaN regions in grey
plt.axis('off') # removes axis

plt.show()Inputsfthe signal on the sphere,numpy.ndarraytypecomplexorreal, ndim 2.Lthe band limit of the signal, non-zero positive integerresolutionsize of the projected image, default 500rotIf the image should be rotated before projecting, None.rotshould be a list of length 1 or 3. If 1 then the image is rotated around the (z) axis by that amount. If 3 then the image is rotated by the Euler angles given in the list.zoom_regionthe region of the sphere to be plotted in radians. The first element is the angle left and right of the centre, default isnp.pifor both projections. The second element is up and down of the equator, default isnp.pi/2for the Sinusoidal projection and7*np.pi/16for the Mercator projection.Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]Projectionstring describing which of the projections to use. Use"MERCATOR"for the Mercator projection and"SINE"for the Sinusoidal projection, default is"MERCATOR"Spinthe spin of the signal. If the signal has non-zero spin then on projection the signal must be rotated to account for the changing direction of the definition of the signal. By setting this to a non-zero integer will ensure this rotation is performed.OutputsIf the input is real:Tuple containing:f_plotthe projection of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmaskthe projection of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.If the input is complex:Tuple containing:f_plot_realthe projection of the real part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_realthe projection of the real part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.f_plot_imagthe projection of the imaginary part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_imagthe projection of the imaginary part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.pyssht.polar_projectionf_proj_north_real, mask_north_real, f_proj_south_real, mask_south_real,\
(f_proj_north_imag, mask_north_imag, f_proj_south_imag, mask_south_imag\ )
        = pyssht.polar_projection(f, int L, int resolution=500, rot=None,\
        float zoom_region=-1, str Method="MW", str Projection="OP",int Spin=0):Creates an twondarrays of the polar projection of a spherical image and a mask array. This is useful for plotting results and performing analysis on the plane. All the spherical samples that fall in one planar pixel is averaged, if no samples fall in a pixel then the pixel is assigned the value of the closest spherical sample. Elements in the signalfthat areNaNs are marked in the mask. This allows one to plot these regions the color of their choice.All the projections are centred around a pole. There are three projections supported.The Gnomic projection, defined by drawing a line from the centre of the circle trough the sphere on to the plane.The Stereographic projection, defined by drawing a line starting at the opposite pole through the sphere to the plane.The Orthographic, defined by a vertical projection on the plane.Here is an example of using the function to plot real spherical data.f_proj_north, mask_north, f_proj_south, mask_south \
        = pyssht.polar_projection(f, L, resolution=500, Method="MW", \
        Projection="OP")
plt.figure() # start figure
imgplot = plt.imshow(f_proj_north,interpolation='nearest')# plot the projected image (north part)
plt.colorbar(imgplot) # plot color bar
plt.imshow(mask_north, interpolation='nearest', cmap=cm.gray, vmin=-1., vmax=1.) # plot the NaN regions in grey
plt.axis('off') # removes axis (looks better)

plt.figure()
imgplot = plt.imshow(f_proj_south,interpolation='nearest')# plot the projected image (south part)
plt.colorbar(imgplot)
plt.imshow(mask_south, interpolation='nearest', cmap=cm.gray, vmin=-1., vmax=1.)
plt.title("orthographic projection south")
plt.axis('off')
plt.show()Inputsfthe signal on the sphere,numpy.ndarraytypecomplexorreal, ndim 2.Lthe band limit of the signal, non-zero positive integerresolutionsize of the projected image, default 500rotIf the image should be rotated before projecting, default None.rotshould be a list of length 1 or 3. If 1 then the image is rotated around the (z) axis by that amount. If 3 then the image is rotated by the Euler angles given in the list.zoom_regionthe region of the sphere to be plotted in radians, defaultnp.pi/2is the full half sphere for the orthographic and stereographic projections andnp.pi/4for the gnomic projection as the equator is at infinity in this projection.Methodthe sampling scheme used, string:'MW'[McEwen & Wiaux sampling (default)]'MWSS'[McEwen & Wiaux symmetric sampling]'DH'[Driscoll & Healy sampling]'GL'[Gauss-Legendre sampling]Projectionstring describing which of the projections to use. Use"GP"for the Gnomic projection,"SP"for the Stereographic projection and"OP"for the Orthographic projection, default is"OP"Spinthe spin of the signal. If the signal has non-zero spin then on projection the signal must be rotated to account for the changing direction of the definition of the signal. By setting this to a non-zero integer will ensure this rotation is performed.OutputsIf the input is real:Tuple containing:f_plot_norththe projection of the north part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_norththe projection of the north part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.f_plot_souththe projection of the south part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_souththe projection of the south part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.If the input is complex:Tuple containing:f_plot_north_realthe projection of the north part of the real part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_north_realthe projection of the north part of the real part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.f_plot_south_realthe projection of the south part of the real part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_south_realthe projection of the south part of the real part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.f_plot_north_imagthe projection of the north part of the imaginary part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_north_imagthe projection of the north part of the imaginary part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.f_plot_south_imagthe projection of the south part of the imaginary part of the image as a 2 dimensionalndarrayof typefloat. Masked regions and regions not in the sphere areNaNs to make them clear when plottedmask_south_imagthe projection of the south part of the imaginary part of the masked regions (NaNs in inputf) as a 2 dimensionalndarrayof typefloat. Masked regions have a value0.0and regions not in the sphere areNaNs to make them clear when plotted.pyssht.dl_beta_recursedl = pyssht.dl_beta_recurse(np.ndarray[ double, ndim=2, mode="c"] dl not None,\
            double beta, int L, int el, \
            np.ndarray[ double, ndim=1, mode="c"] sqrt_tbl not None,\
            np.ndarray[ double, ndim=1, mode="c"] signs not None)Compute the el-th plane of the Wigner small-d functions (from the (el-1)-th plane) using Risbo's method.Inputsdlthe Wigner plane for all m and n, indexed dl[m][n] of size (2L-1)(2*L-1)betaangle to calculate Wigner D matrix at, typedoubleLthe band limit of the signal, non-zero positive integerelis the current harmonic degree (i.e. dl input should already be computed for el-1, and dl output will be computed for el)sqrt_tblprecomputed square-roots from (0) to (2*(L-1)+1)signsprecomputed ((-1)^m) signs from (m=0) to (L)OutputsNumpy ndarraydl, typefloat_of the Wigner plane for all m and npyssht.dln_beta_recursedl = pyssht.dln_beta_recurse(np.ndarray[ double, ndim=1, mode="c"] dl not None,\
            np.ndarray[ double, ndim=1, mode="c"] dlm1 not None, double beta,\
            int L, int el, int n, np.ndarray[ double, ndim=1, mode="c"] sqrt_tbl not None,\
            np.ndarray[ double, ndim=1, mode="c"] signs not None)Compute the el-th line of the Wigner small-d functions for given n (from the (el-1)-th and (el-2)-th lines) using 3-term recursion of Kostelec.Inputsdlthe Wigner line for el for non-negative m and given n of size Ldlm1is the line for el-1 and dlp1 is the line computed for el+1betaangle to calculate Wigner D matrix at, typedoubleLthe band limit of the signal, non-zero positive integerelel is the current harmonic degreenthe third index in Wigner D matricessqrt_tblprecomputed square-roots from (0) to (2*(L-1)+1)signsprecomputed ((-1)^m) signs from (m=0) to (L)OutputsNumpy ndarraydl, typefloat_the Wigner line for el for non-negative m and given n of sizepyssht.generate_dldl_array = pyssht.generate_dl(double beta, int L)Generates the small Wigner D matrices up to a given band limit for a given (\beta)Inputsbetaangle to calculate Wigner D matrix at, typedoubleLthe band limit of the signal, non-zero positive integerOutputsNumpy ndarraydl_array, typefloat_of the small Wigner D matricespyssht.rotate_flmsflm_rotated = pyssht.rotate_flms(
                np.ndarray[ double complex, ndim=1, mode="c"] f_lm not None,\
                double alpha, double beta, double gamma, int L, dl_array=None,\
                M=None, Axisymmetric=False, Keep_dl=False)Function to rotate a set of spherical harmonic coefficients by the set of Euler angles (\alpha, \beta, \gamma ) using the (z,y,z) convention.Inputsflmthe spherical harmonic transform off,numpy.ndarraytypecomplex, ndim 1alpharotation angle (\alpha), typedoublebetarotation angle (\beta), typedoublegammarotation angle (\gamma), typedoubleLthe band limit of the signal, non-zero positive integerdl_arrayif set should be the precomputed small Wigner D matrix for angle (\beta) and harmonic band limitL. If not set this is calculated in the function. (This parameter is ignored when using theduccbackend.)Mif set is the azimuthal band limit of the function to be rotated, defaultM=L.Axisymmetricset if the function is axisymmetric and axisymmetric harmonic coefficients are parsed.Keep_dlif set the output is changed to allow one to keep the computeddl_array. (This parameter is ignored when using theduccbackend.)backendthe backend that runs the transforms:'SSHT'this package'ducc'interface toducc0OutputIfKeep_dlis not set the output is the rotated set of spherical harmonic coefficients. If it is the output is a tuple(flm_rotated, dl_array), ie the rotated harmonic coefficients and the small Wigner D matrix computed for that band limit and (\alpha) value.pyssht.guassian_smoothingfs_lm = pyssht.guassian_smoothing(np.ndarray[ double complex, ndim=1, mode="c"] f_lm not None, int L, sigma_in=None, bl_in = None)Smooths a set of harmonic coefficients either with a precomputed smoothing kernelblor with a Gaussian given on input.Inputsf_lmthe spherical harmonic transform off,numpy.ndarraytypecomplex, ndim 1Lthe band limit of the signal, non-zero positive integersigma_inthe input sigma of the Gaussian to smooth the signal with, defaultNonebl_inthe smoothing kernel to smooth the signal with, defaultNoneOutputfs_lmthe smoothed harmonic coefficients.pyssht.create_ylmylm = pyssht.create_ylm(thetas, phis, int L, int Spin=0, str recursion='Kostelec')Computes spherical harmonic functions for all el and all 0<=|m|<= el using various recursions.Inputsthetaspositions of the samples in the (\theta) directionphispositions of the samples in the (\phi) directionLthe band limit of the signal, non-zero positive integerSpinthe spin of the signal, non-negative integer (default = 0)recursionthe recursion scheme used, string:'Kostelec'[3-term recursion, e.g. Kostelec (default)]'Risbo'[Risbo recursion]'NumericalRecipes'[Numerical Recipes]Outputylmthe spherical harmonics indexedylm[ind][theta][phi], whereind = pyssht.elm2ind(el, m)