gizio.core module¶
Core interface.
-
gizio.core.
load
(prefix, suffix='.hdf5', spec='gizmo')[source]¶ Load snapshot.
- Parameters
prefix (str or pathlib.Path) – Snapshot file(s) prefix.
suffix (str, optional) – Snapshot file(s) suffix. (default: “.hdf5”)
spec (str or SpecBase, optional) – Snapshot format specification. If given as str, will use a built-in one. (default: “gizmo”)
- Returns
The loaded snapshot.
- Return type
-
class
gizio.core.
Snapshot
(paths, spec)[source]¶ Bases:
object
Simulation snapshot.
-
snap[key]
-
snap[ptype, field]
Load the field from file and cache in memory.
-
del snap[key]
-
del snap[ptype, field]
Delete the cache.
- Parameters
paths (typing.Iterable) – Snapshot file paths in correct order.
spec (SpecBase) – Snapshot format specification.
-
shape
¶ Data shape composed of {ptype_name: n_part} entries, in the specification ptypes order.
-
cosmology
¶ An astropy cosmology calculator.
-
unit_registry
¶ Simulation unit registry.
-
array
(value, unit)[source]¶ Helper method to create unyt array with snapshot unit registry.
- Parameters
value (typing.Iterable) – The value.
unit (str) – The unit.
- Returns
A unyt array.
- Return type
-
-
class
gizio.core.
ParticleSelector
(snap, masks)[source]¶ Bases:
object
High level snapshot field access for selected particles.
-
len(ps)
Return the number of selected particles.
-
ps[key]
Retrieve the field. Compute and create cache if not existing already.
-
del ps[key]
Delete the cache.
- Parameters
snap (Snapshot) – The snapshot to access.
-
pmask
¶ Particle mask.
-
shape
¶ Shape.
-
classmethod
from_ptypes
(snap, ptypes)[source]¶ Create particle selector for specified particle types.
- Parameters
- Returns
The corresponding particle selector.
- Return type
-
direct_fields
()[source]¶ Known direct fields.
- Returns
A dictionary mapping shorhand keys to raw field names.
- Return type
-
register_field
(key, func)[source]¶ Register a field.
- Parameters
key (str) – The key to retrieve the field.
func (typing.Callable) – The function to compute the field.
-