From 43a046a1ee472a5e60ba277bb37e0f71dd4a74b5 Mon Sep 17 00:00:00 2001 From: Josh Borrow Date: Fri, 6 Oct 2023 11:26:27 -0400 Subject: [PATCH] Check in SWIFTMask if we are trying to use partial snap --- swiftsimio/masks.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/swiftsimio/masks.py b/swiftsimio/masks.py index f988ee1b..bc7ad2fa 100644 --- a/swiftsimio/masks.py +++ b/swiftsimio/masks.py @@ -10,6 +10,8 @@ from swiftsimio import metadata, SWIFTMetadata, SWIFTUnits +from swiftsimio.objects import InvalidSnapshot + from swiftsimio.accelerated import ranges_from_array from typing import Dict @@ -46,6 +48,12 @@ def __init__(self, metadata: SWIFTMetadata, spatial_only=True): self.units = metadata.units self.spatial_only = spatial_only + if self.metadata.partial_snapshot: + raise InvalidSnapshot( + "You cannot use masks on partial snapshots. Please use the virtual " + "file generated by SWIFT (use snapshot.hdf5, not snapshot.0.hdf5)." + ) + self._unpack_cell_metadata() if not spatial_only: