swiftsimio.visualisation.slice module
Create image slices through a volume.
- swiftsimio.visualisation.slice.slice_gas(data: SWIFTDataset, resolution: int, z_slice: cosmo_quantity | None = None, project: str | None = 'masses', parallel: bool = False, rotation_matrix: ndarray | None = None, rotation_center: cosmo_array | None = None, region: cosmo_array | None = None, backend: str = 'sph', periodic: bool = True) cosmo_array[source]
Create a data field-weighted 2D slice through a SWIFT dataset as a pixel grid.
- Parameters:
data (SWIFTDataset) – Dataset from which slice is extracted.
resolution (int) – Specifies size of return np.array.
z_slice (cosmo_quantity) – Specifies the location along the z-axis where the slice is to be extracted, relative to the rotation center or the origin of the box if no rotation center is provided. If the perspective is rotated this value refers to the location along the rotated z-axis.
project (str, optional) – Data field to be projected. Default is mass. If
Nonethen simply count number of particles. The result is comoving if this is comoving, else it is physical.parallel (bool) – Used to determine if we will create the image in parallel. This defaults to False, but can speed up the creation of large images significantly at the cost of increased memory usage.
rotation_matrix (np.np.array, optional) – Rotation matrix (3x3) that describes the rotation of the box around
rotation_center. In the default case, this provides a slice perpendicular to the z axis.rotation_center (np.np.array, optional) – Center of the rotation. If you are trying to rotate around a galaxy, this should be the most bound particle.
region (cosmo_array, optional) –
Determines where the image will be created (this corresponds to the left and right-hand edges, and top and bottom edges) if it is not None. It should have a length of four, and take the form:
[x_min, x_max, y_min, y_max]
Particles outside of this range are still considered if their smoothing lengths overlap with the range.
backend (str, optional) – Backend to use. Choices are “sph” (default) for interpolation using kernel weights or “nearest_neighbours” for nearest neighbour interpolation.
periodic (bool, optional) – Account for periodic boundaries for the simulation box? Default is
True.
- Returns:
Slice image with units of project / length^2, of size
resxres. Comoving ifprojectdata are comoving, else physical.- Return type:
See also
render_gas_voxel_gridCreates a 3D voxel grid from a SWIFT dataset.