nbodykit.meshtools

Functions

SlabIterator(coords[, axis, symmetry_axis]) Iterate over the specified dimension of the coordinate mesh,

Classes

MeshSlab(islab, coords, axis, symmetry_axis) A convenience class to represent a specific slab of a mesh,
class nbodykit.meshtools.MeshSlab(islab, coords, axis, symmetry_axis)[source]

A convenience class to represent a specific slab of a mesh, which is denoted as a slab

Attributes

hermitian_symmetric Whether the slab is Hermitian-symmetric
hermitian_weights Weights to be applied to quantities on the slab in order
index Return an indexing list appropriate for selecting the slicing the
meshshape Return the local shape of the mesh on this rank, as determined
nonsingular The indices on the slab of the positive frequencies
shape Return the shape of the slab

Methods

coords(i) Return the coordinate array for dimension i on this slab,
mu(los) The mu value defined at each point on the slab for the
norm2() The square of coordinate grid norm defined at each point on the slab.
__init__(islab, coords, axis, symmetry_axis)[source]
Parameters:
  • islab (int, [0, x[0]shape[0]]) – the index of the slab, which indexes the first dimension of the mesh (the x coordinate), thus producing a y-z plane
  • coords (list of arrays) – the coordinate arrays of the mesh, with proper 3D shapes for easy broadcasting; if the mesh has size (Nx, Ny, Nz), then the shapes of x are: [(Nx, 1, 1), (1, Ny, 1), (1, 1, Nz)]
  • axis (int, {0, 1, 2}) – the index of the mesh axis to iterate over
  • symmetry_axis (int, optional) – if provided, the axis that has been compressed due to Hermitian symmetry
coords(i)[source]

Return the coordinate array for dimension i on this slab,

Note

The return value will be properly squeezed for easy broadcasting, i.e., if i is self.axis, then an array of shape (1,1) array is returned, otherwise, the shape is (N_i, 1) or (1, N_i)

Parameters:i (int, {0,1,2}) – the index of the desired dimension
Returns:the coordinate array for dimension i on the slab; see the note about the shape of the return array for details
Return type:array_like
hermitian_symmetric

Whether the slab is Hermitian-symmetric

hermitian_weights

Weights to be applied to quantities on the slab in order to account for Hermitian symmetry

These weights double-count the positive frequencies along the symmetry_axis.

index

Return an indexing list appropriate for selecting the slicing the appropriate slab out of a full 3D array of shape (Nx, Ny, Nz)

meshshape

Return the local shape of the mesh on this rank, as determined by the input coordinates array

mu(los)[source]

The mu value defined at each point on the slab for the specified line-of-sight index

Parameters:los (array_like,) – the direction of the line-of-sight, which mu is defined with respect to; must have a norm of 1.
Returns:the mu value at each point in the slab
Return type:array_like, (slab.shape)
nonsingular

The indices on the slab of the positive frequencies along the dimension specified by symmetry_axis

Returns:idx – Return a boolean array with the shape of the slab, with True elements giving the elements with positive freq along symmetry_axis
Return type:array_like, self.shape
norm2()[source]

The square of coordinate grid norm defined at each point on the slab.

This broadcasts the coordinate arrays along each dimension to compute the norm at each point in the slab.

Returns:the square of coordinate mesh at each point in the slab
Return type:array_like, (slab.shape)
shape

Return the shape of the slab

nbodykit.meshtools.SlabIterator(coords, axis=0, symmetry_axis=None)[source]

Iterate over the specified dimension of the coordinate mesh, returning a MeshSlab for each iteration

Parameters:
  • coords (list of arrays) – the coordinate arrays of the mesh, with proper 3D shapes for easy broadcasting; if the mesh has size (Nx, Ny, Nz), then the shapes of x3d should be: [(Nx, 1, 1), (1, Ny, 1), (1, 1, Nz)]
  • axis (int, optional) – the index of the mesh axis to iterate over
  • symmetry_axis (int, optional) – if provided, the axis that has been compressed due to Hermitian symmetry