swiftsimio package

swiftsimio.validate_file(filename)[source]

Checks that the provided file is a SWIFT dataset.

Parameters:

filename (str) – name of file we want to check is a dataset

Returns:

if filename is a SWIFT dataset return True, otherwise raise exception

Return type:

bool

Raises:

KeyError – Crash if the file is not a SWIFT data file

swiftsimio.mask(filename, spatial_only=True) SWIFTMask[source]

Sets up a masking object for you to use with the correct units and metadata available.

Parameters:
  • filename (str) – SWIFT data file to read from

  • spatial_only (bool, optional) – Flag for only spatial masking, this is much faster but will not allow you to use masking on other variables (e.g. density). Defaults to True.

Returns:

empty mask object set up with the correct units and metadata

Return type:

SWIFTMask

Notes

If you are only planning on using this as a spatial mask, ensure that spatial_only remains true. If you require the use of the constrain_mask function, then you will need to use the (considerably more expensive, ~bytes per particle instead of ~bytes per cell spatial_only=False version).

swiftsimio.load(filename, mask=None) SWIFTDataset[source]

Loads the SWIFT dataset at filename.

Parameters:
  • filename (str) – SWIFT snapshot file to read

  • mask (SWIFTMask, optional) – mask to apply when reading dataset

swiftsimio.load_statistics(filename) SWIFTStatisticsFile[source]

Loads a SWIFT statistics file (SFR.txt, energy.txt).

Parameters:

filename (str) – SWIFT statistics file path

Subpackages

Submodules