evoxels.voxelgrid
Classes
|
Handles most basic properties |
|
Abstract backend adapter: handles array conversion and padding. |
|
|
|
- class evoxels.voxelgrid.Grid(shape: Tuple[int, int, int], origin: Tuple[float, float, float], spacing: Tuple[float, float, float], convention: str)
Handles most basic properties
- __init__(shape: Tuple[int, int, int], origin: Tuple[float, float, float], spacing: Tuple[float, float, float], convention: str) None
- convention: str
- origin: Tuple[float, float, float]
- shape: Tuple[int, int, int]
- spacing: Tuple[float, float, float]
- class evoxels.voxelgrid.VoxelGrid(grid: Grid, lib)
Abstract backend adapter: handles array conversion and padding.
- average(field)
Return the spatial average of
field.
- axes() Tuple[Any, ...]
Returns the 1D coordinate arrays along each axis.
- concatenate(fieldlist, dim)
Concatenate fields in
fieldlist.
- expand_dim(field, dim)
Add a singleton dimension to
field.
- export_scalar_field_to_numpy(field)
Export backend field back to NumPy.
- fft_axes() Tuple[Any, ...]
- fft_k_squared()
- fft_k_squared_nonperiodic()
- fft_mesh() Tuple[Any, ...]
- fftn(field, shape)
Compute the n-dimensional discrete Fourier transform.
- init_scalar_field(array)
Convert and pad a NumPy array for simulation.
- meshgrid() Tuple[Any, ...]
Returns full 3D mesh grids for each axis.
- pad_periodic(field)
Pad a field with periodic boundary conditions.
- pad_zeros(field)
Pad a field with zeros.
- real_of_ifftn(field, shape)
Return the real part of the inverse FFT.
- rfft_axes() Tuple[Any, ...]
- rfft_k_squared()
- set(field, index, value)
Set
field[index]tovalueand returnfield.
- squeeze(field, dim)
Remove
dimfromfield.
- to_backend(field)
Convert a NumPy array to the backend representation.
- to_numpy(field)
Convert a backend array to
numpy.ndarray.
- class evoxels.voxelgrid.VoxelGridJax(grid: Grid, precision='float32')
- __init__(grid: Grid, precision='float32')
Create a JAX backed grid.
- Parameters:
grid – Grid description.
precision – Floating point precision for arrays.
- concatenate(fieldlist, dim)
Concatenate fields in
fieldlist.
- expand_dim(field, dim)
Add a singleton dimension to
field.
- fftn(field, shape)
Compute the n-dimensional discrete Fourier transform.
- irfftn(field, shape)
- pad_periodic(field)
Pad a field with periodic boundary conditions.
- pad_zeros(field)
Pad a field with zeros.
- real_of_ifftn(field, shape)
Return the real part of the inverse FFT.
- rfftn(field, shape)
- set(field, index, value)
Set
field[index]tovalueand returnfield.
- squeeze(field, dim)
Remove
dimfromfield.
- to_backend(np_arr)
Convert a NumPy array to the backend representation.
- to_numpy(field)
Convert a backend array to
numpy.ndarray.
- class evoxels.voxelgrid.VoxelGridTorch(grid: Grid, precision='float32', device: str = 'cuda')
- __init__(grid: Grid, precision='float32', device: str = 'cuda')
Create a torch backed grid.
- Parameters:
grid – Grid description.
precision – Floating point precision.
device – Torch device string.
- concatenate(fieldlist, dim)
Concatenate fields in
fieldlist.
- expand_dim(field, dim)
Add a singleton dimension to
field.
- fftn(field, shape)
Compute the n-dimensional discrete Fourier transform.
- irfftn(field, shape)
- pad_periodic(field)
Pad a field with periodic boundary conditions.
- pad_zeros(field)
Pad a field with zeros.
- real_of_ifftn(field, shape)
Return the real part of the inverse FFT.
- rfftn(field, shape)
- set(field, index, value)
Set
field[index]tovalueand returnfield.
- squeeze(field, dim)
Remove
dimfromfield.
- to_backend(np_arr)
Convert a NumPy array to the backend representation.
- to_numpy(field)
Convert a backend array to
numpy.ndarray.