I was wondering if it is possible to generate a voxel grid which is separate from the simulation cell. For example when working with Fourier transformed spatial data, is it possible to create a 2d or 3d voxel plot in reciprocal space?
Yes, this is how you can define a grid’s domain:
https://www.ovito.org/docs/current/python/modules/ovito_data.html#ovito.data.VoxelGrid.domain
It can be completely independent from other Simulation cells in the scene.
Here is a slightly modified version of the code snippet given in the linked manual article as an example:
nx = 10; ny = 6; nz = 1
field_data = numpy.random.random((nx, ny))
grid = data.grids.create(
identifier="field",
domain=SimulationCell(matrix=[[10,0,0,15],[0,10,0,15],[0,0,10,15]], pbc=(1,1,1), is2D=True),
shape=(nx,ny,nz),
grid_type=VoxelGrid.GridType.CellData,
vis=VoxelGridVis(enabled=True, transparency=0.)
)
grid.create_property('Field Value', data=field_data.flatten(order='F'))
Ah, I didn’t realize the domain had to be a SimulationCell object, I was just trying to use a numpy array. I will try this again.