ParticleDataset#
- class pisces.particles.base.ParticleDataset(path: str | Path, mode='r+')[source]#
Base class for particle datasets in Pisces.
This class provides the standard interface for reading, writing, and interacting with particle datasets in the Pisces framework. It parallels the standard HDF5 formats used in codes like AREPO, GADGET, etc. but includes some additional flexibility and features.
Details regarding the expected structure of the dataset and how to work with particle datasets can be found at Particle Representations in Pisces.
Methods
__init__
(path[, mode])Initialize a
ParticleDataset
from a file on disk.add_particle_field
(group_name, field_name, data)Add a new field (dataset) to an existing particle group.
add_particle_ids
([groups, policy, overwrite])Add unique particle IDs to specified groups.
add_particle_type
(name, num_particles[, ...])Add a new particle group to the dataset.
apply_linear_transformation
(matrix[, ...])Apply a linear transformation matrix to vector fields in specified particle groups.
build_particle_dataset
(path, *args[, ...])Create a new
ParticleDataset
HDF5 file with the given fields.concatenate_inplace
(*others[, groups])Concatenate another
ParticleDataset
into this one, extending specified groups.copy
(output_path[, overwrite])Create a full copy of this particle dataset at a new location.
cut_particles_to_bbox
(bbox[, groups, center])Cut out particles outside the specified bounding box.
delete_field_metadata_keys
(group_name, ...)Delete one or more metadata keys from a specific field in a particle group.
delete_global_metadata_keys
(*keys)Delete one or more metadata keys from the global metadata.
delete_group_metadata_keys
(group_name, *keys)Delete one or more metadata keys from a specific particle group.
extend_group
(group_name, num_particles[, fields])Extend a particle group by adding new particles and updating all fields.
get_field_metadata
(group_name, field_name)Get the metadata attributes for a specific field in a particle group.
get_field_units
(group_name, field_name)Get the units of a specific particle field.
Get the global metadata attributes of the dataset.
get_group_metadata
(group_name)Get the metadata attributes for a specific particle group.
get_particle_field
(group_name, field_name)Get the particle field data as a unyt array.
get_particle_field_handle
(group_name, field_name)Get the HDF5 dataset handle for a specific field in a particle group.
get_particle_fields
(fields)Get multiple particle fields as a dictionary of unyt arrays.
get_particle_group_handle
(group_name)Get the HDF5 group handle for a specific particle group.
offset_particle_positions
(offset[, groups])Apply a constant offset to particle positions in specified groups.
offset_particle_velocities
(offset[, groups])Apply a constant offset to particle velocities in specified groups.
reduce_group
(group_name, mask)Reduce a particle group by applying a boolean mask.
Reload the global metadata from the HDF5 file.
remove_particle_field
(group_name, field_name)Remove a specific field from a particle group.
remove_particle_group
(group_name)Remove a particle group from the dataset.
rename_field
(group_name, old_name, new_name)Rename a field within a particle group.
reorient_particles
(direction_vector, spin[, ...])Reorient particles given a direction vector and spin angle.
rotate_particles
(norm, angle[, groups, fields])Rotate vector fields in specified particle groups around a given axis.
update_field_metadata
(group_name, ...)Update the metadata attributes for a specific field in a particle group.
update_global_metadata
(metadata)Update the global metadata attributes of the dataset.
update_group_metadata
(group_name, metadata)Update the metadata attributes for a specific particle group.
update_particle_ids
([groups, policy])Update (reset) particle IDs for groups that already have an ID field.
Attributes
List of all fields (datasets) available in the dataset, in dot notation.
Global metadata attributes at the root level of the HDF5 file.
The HDF5 file handle for the particle dataset.
Number of particles in each particle group.
Names of all particle groups present in the dataset.
The path to the HDF5 file containing the particle dataset.
Total number of particles across all particle groups.