waveformtools.grids

Classes to hold grid information

Classes

UniformGrid: grid info.

Stores information on the 2d grid in spherical polar coordinates.

GLGrid: grid info

Stores a Gauss-Legendre type grid on a spherical surface.

Classes

GLGrid([nphi, ntheta, nphi_act, ntheta_act, ...])

A class to store the coordinate grid on a sphere.

UniformGrid([nphi, ntheta, nphimax, ...])

A class to store the theta-phi grid info.

class waveformtools.grids.GLGrid(nphi=None, ntheta=None, nphi_act=None, ntheta_act=None, L=47, nghosts=2, integration_method='GL', grid_type='GL')[source]

A class to store the coordinate grid on a sphere.

Attributes:
nthetaint

Return the total number gridpoints along the theta direction, including the ghost zones at one iteration.

nphiint

Return the total number of gridpoints along the phi direction, including the ghost zones at one iteration.

nghostsint

Return the number of ghost zones

meshgridtuple of 2d array

The (\(\theta, \phi)\): coordinate meshes.

theta_1d1d array

Returns the coordinate value theta given the coordinate index.

phi_1d1d array

Returns the coordinate value theta given the coordinate index.

dthetafloat

The angular step size in the \(\theta\) direction.

dphifloat

Return the uniform angular stepping in \(\phi\) direction

npix_actint

Return the actual number of pixels,

meshgridtuple of 2darray

The (\(\theta, \phi)\): coordinate meshes.

Methods

theta_1d

Returns the coordinate value theta given the coordinate index.

phi_1d

Returns the coordinate value theta given the coordinate index.

Notes

The total number of points on the sphere is assumed to be \(2 (L+1)^2\)

\(N_\theta = L+1\)

\(N_\phi = 2(L+1)\)

This integrates out spherical harmonics of degree L exactly, given a regular function on the sphere.

In other words, given \(L+1\) points in the \(\theta\) direction, one can resolve spherical harmonics upto degree \(L\).

property L

Return the total number of pixels, including the ghost zones present at one iteration.

property dphi

Return the uniform angular stepping in \(\phi\) direction

property dtheta_1d

Return the non-uniform angular stepping in :math:` heta` direction

property grid_type
property integration_method

The default integration method

property meshgrid

The (\(\theta, \phi)\): coordinate meshes. Excludes the ghost zones.

Returns:
theta2d array

The \(\theta\) coordinate matrix for vectorization.

phi2d array

The \(\phi\) coordinate matrix for vectorization.

property nghosts

Return the number of ghost zones at each end in each direction

nphi()[source]

Return the total number of gridpoints along the phi direction, including the ghost zones at one iteration.

property nphi_act

Return the actual number of physical data points along the phi direction excluding the ghost and buffer zones at one iteration.

property npix

Return the total number of pixels, including the ghost zones present at one iteration.

property npix_act

Return the actual number of pixels, excluding the ghost zones present at one iteration

ntheta()[source]

Return the total number gridpoints along the theta direction, including the ghost zones at one iteration.

property ntheta_act

Return the actual number of physical data points along the theta direction excluding the ghost and buffer zones at one iteration.

property phi_1d

Returns the coordinate value theta given the coordinate index. The coordinate index lies in (0, nphi). The actual indices without the ghost and extra zones is (nghosts, nphi-nghosts).

Parameters:
phi_1dint / 1d array

The phi coordinate index or axis.

Returns:
phi_1dfloat or 1d array

The coordinate(s) \(\phi\) on the sphere.

property shape

Return the shape of the grif

property theta_1d

Returns the coordinate value theta given the coordinate index. The coordinate index ranges from (0, ntheta). The actual indices without the ghost and extra zones is (nghosts, ntheta-nghosts).

Parameters:
theta_indexint/ 1d array

The theta coordinate index or axis.

Returns:
theta_1dfloat

The coordinate(s) \(\theta\) on the sphere.

property weights

Return the integration weights along theta

property weights_grid

Return the integration weights on the coordinate mesh grid

class waveformtools.grids.UniformGrid(nphi=80, ntheta=41, nphimax=124, nthetamax=66, nghosts=2, integration_method='MP', grid_type='Uniform')[source]

A class to store the theta-phi grid info.

Attributes:
dphi
dtheta
grid_type
integration_method

The default integration method

meshgrid

The (\(\theta, \phi)\): coordinate meshes.

nbuffer
nphi_act

Return the actual number of valid pixels, excluding the ghost and buffer zones, along the phi axis at one iteration.

npix
npix_act
npix_max
ntheta_act

Return the actual number of valid pixels, excluding the ghost and buffer zones, along the theta axis at one iteration.

phi_1d

Returns the coordinate value theta given the coordinate index.

shape

Return the shape of the grif

theta_1d

Returns the coordinate value theta given the coordinate index.

Methods

get_data_on_GLGrid(func[, infoGL])

Get the data on a GLGrid given data on the uniform grid.

to_GLGrid()

Find the highest resolution closest equivalent GL grid of this grid

property dphi
property dtheta
get_data_on_GLGrid(func, infoGL=None)[source]

Get the data on a GLGrid given data on the uniform grid.

Parameters:
func2darray

The function to be interpolated onto the GLGrid

infoGLgrid_info, optional

The GLGrid onto which the function is to be interpolated. If not given, then the closeset equivalent GL grid to this instance of UniformGrid will be found and used.

Returns:
infoGLgrid_info

The GLGrid used for interpolation

func_on_GLGrid2darray

The function func values on the GLGrid

property grid_type
property integration_method

The default integration method

property meshgrid

The (\(\theta, \phi)\): coordinate meshes. Excludes the ghost zones.

Returns:
theta2d array

The \(\theta\) coordinate matrix for vectorization.

phi2d array

The \(\phi\) coordinate matrix for vectorization.

property nbuffer
property nphi_act

Return the actual number of valid pixels, excluding the ghost and buffer zones, along the phi axis at one iteration.

property npix
property npix_act
property npix_max
property ntheta_act

Return the actual number of valid pixels, excluding the ghost and buffer zones, along the theta axis at one iteration.

property phi_1d

Returns the coordinate value theta given the coordinate index. The coordinate index lies in (0, nphi). The actual indices without the ghost and extra zones is (nghosts, nphi-nghosts).

Parameters:
phi_1dint / 1d array

The phi coordinate index or axis.

Returns:
phi_1dfloat or 1d array

The coordinate(s) \(\phi\) on the sphere.

property shape

Return the shape of the grif

property theta_1d

Returns the coordinate value theta given the coordinate index. The coordinate index ranges from (0, ntheta). The actual indices without the ghost and extra zones is (nghosts, ntheta-nghosts).

Parameters:
theta_indexint/ 1d array

The theta coordinate index or axis.

Returns:
theta_1dfloat

The coordinate(s) \(\theta\) on the sphere.

to_GLGrid()[source]

Find the highest resolution closest equivalent GL grid of this grid