waveformtools.grids

Classes to hold grid information

Classes

spherical_grid: grid info.

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

gl_gridgrid info

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

Classes

gl_grid([nphi, ntheta, L, nghosts])

A class to store the coordinate grid on a sphere.

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

A class to store the coordinate grid on a sphere.

class waveformtools.grids.gl_grid(nphi=None, ntheta=None, L=47, nghosts=2)[source]

A class to store the coordinate grid on a sphere.

Notes

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

\(N_ heta = L+1\)

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

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

Attributes:
ntheta: int

The number of angular points in the \(\theta\) direction, including ghost zones.

nphi: int

The number of angular points in the \(\phi\) direction, including ghost zones.

nghosts: int

The number of ghost zones at the end of each direction.

meshgrid: tuple of 2d array

The 2d array containing the meshgrid of (\(\theta, \phi\)) angular points.

theta_1d: 1d array

The 1d array of angular points along the \(\theta\) axis.

phi_1d: 1d array

The 1d array of angular points along the \(\phi\) axis.

dtheta: float

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

dphi: float

The angular step size inthe \(\phi\) direction.

npix_act: int

The total number of gridpoints on the sphere, excluding the ghost points.

meshgrid:

Get the 2d angular grid.

Methods

theta_1d:

Get the \(\theta\) axis.

phi_1d:

Get the \(\phi\) axis.

property L

Return the maximum mode number that this grid can integrate out.

property dphi

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

property dtheta_1d

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

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

Excludes the ghost zones.

Returns:
theta: 2d array

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

phi: 2d array

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

property nghosts

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

property nphi

Return the (max) total number of pixels, including the ghost and buffer zones at one iteration.

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

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

property ntheta

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

property ntheta_act

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

property phi_1d

Returns the coordinate values phi 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_1d: int / 1d array

The phi coordinate index or axis.

Returns:
phi_1d: float or 1d array

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

property shape

Return the shape of the grid.

property theta_1d

Returns the coordinate values 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_index: int/ 1d array

The theta coordinate index or axis.

Returns:
theta_1d: float

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.spherical_grid(nphi=80, ntheta=41, nphimax=124, nthetamax=66, nghosts=2)[source]

A class to store the coordinate grid on a sphere.

Attributes:
ntheta: int

The number of angular points in the \(\theta\) direction, including ghost zones.

nphi: int

The number of angular points in the \(\phi\) direction, including ghost zones.

nghosts: int

The number of ghost zones at the end of each direction.

meshgrid: tuple of 2d array

The 2d array containing the meshgrid of (\(\theta, \phi\)) angular points.

theta_1d: 1d array

The 1d array of angular points along the \(\theta\) axis.

phi_1d: 1d array

The 1d array of angular points along the \(\phi\) axis.

dtheta: float

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

dphi: float

The angular step size inthe \(\phi\) direction.

npix_act: int

The total number of gridpoints on the sphere, excluding the ghost points.

meshgrid:

Get the 2d angular grid.

Methods

theta_1d:

Get the \(\theta\) axis.

phi_1d:

Get the \(\phi\) axis.

property dphi

Return the coordinate spacing \(d\phi\).

property dtheta

Return the coodinate spacing \(d\theta.\)

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

Excludes the ghost zones.

Returns:
theta: 2d array

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

phi: 2d array

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

property nbuffer

Return the number of buffer zones (excluding ghosts)

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

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

property npix_max

Return the (max) total number of pixels, including the ghost and buffer zones at one iteration.

property ntheta_act

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

phi_1d(phi_index=None)[source]

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_1d: int / 1d array

The phi coordinate index or axis.

Returns:
phi_1d: float or 1d array

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

theta_1d(theta_index=None)[source]

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_index: int/ 1d array

The theta coordinate index or axis.

Returns:
theta_1d: float

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