Module API¶
mesh_illustris.core module¶
mesh_illustris.il_util module¶
il_util module defines some commonly used functions for Illustris.
-
mesh_illustris.il_util.loadFile(fn, partType, fields=None, mdi=None, float32=True, index=None)¶ Load a subset of particles/cells in one chunk file. This function applies numpy.memmap to minimize memory usage.
- Parameters
fn (str) – File name to be loaded.
partType (str or list of str) – Particle types to be loaded.
fields (str or list of str) – Particle fields to be loaded.
mdi (None or list of int, default to None) – sub-indeces to be loaded. None to load all.
float32 (bool, default to False) – Whether to use float32 or not.
index (list of list of int) – List of Fancy indices for slicing.
- Returns
Entire or subset of data, depending on whether index == None.
- Return type
dict
-
mesh_illustris.il_util.partTypeNum(partType)¶ Map common names to numeric particle types.
- Parameters
partType (str) – Common names of particle type.
- Returns
Numeric particle type.
- Return type
int
-
mesh_illustris.il_util.snapPath(basePath, snapNum, chunkNum=0)¶ Return path to a chunk file of snapshot.
- Parameters
basePath (str) – Base path of the simulation data. This path usually ends with “output”.
snapNum (int) – Number of the snapshot.
chunkNum (int, default to 0) – Number of the chunk.
- Returns
Path to a chunk file.
- Return type
str
-
mesh_illustris.il_util.getNumPart(header)¶ Calculate number of particles of all types given a snapshot header.
- Parameters
header (h5py.Group) – header of the snapshot.
- Returns
Number of particles of each type.
- Return type
numpy.ndarray of int
mesh_illustris.loader module¶
mesh_illustris.mesh module¶
mesh module defines the Mesh to tessellate the entire volume.
-
class
mesh_illustris.mesh.Mesh(pos, length, offset, boundary, depth)¶ Bases:
objectMesh class tessellates the entire volume.
-
property
boundary¶ Boundary of the box, with shape of (3, 2).
- Type
numpy.ndarray of scalar
-
property
depth¶ Depth of Mesh. For example, depth = 8 corresponds to the Mesh dimension of (2^8, 2^8, 2^8)
- Type
int, default to 8
-
build()¶ Build index for the points according to the Mesh. The indexing process produces a “rand” and a “mark” variables, which link the index of each point to its location in the Mesh.
- Returns
(rank, mark).
- Return type
tuple of numpy.ndarray of int
-
property