swiftsimio.reader module
Main objects for reading SWIFT datasets.
These include:
SWIFTUnits, which is a unit system that can be queried for units (and converts arrays to relevant unyt arrays when read from the HDF5 file)
SWIFTMetadata, which contains all of the metadata from the file
__SWIFTGroupDataset, which contains particle information but should never be directly accessed. Use
_generate_datasetsto create one of these. The reasoning here is that properties can only be added to the class afterwards, and not directly in an _instance_ of the class.SWIFTDataset, a container class for all of the above.
- class swiftsimio.reader.SWIFTDataset(filename: Path, mask: SWIFTMask | None = None, handle: File | None = None)[source]
Bases:
HandleProviderA collection object for units, metadata and data objects.
It contains:
a
SWIFTUnits,a
SWIFTMetadata,several
SWIFTGroupDataset
This object, in essence, completely represents a SWIFT snapshot. You can access the different particles as follows:
SWIFTDataset.gas.particle_ids
SWIFTDataset.dark_matter.masses
SWIFTDataset.gas.smoothing_lengths
These arrays all have units that are determined by the unit system in the file.
The unit system is available as SWIFTDataset.units and the metadata as SWIFTDataset.metadata.
- Parameters:
- filename: Path
- get_units() None[source]
Load the units from the SWIFT snapshot.
Ordinarily this happens automatically, but you can call this function again if you mess things up.