Skip to content

Commit

Permalink
Check in SWIFTMask if we are trying to use partial snap
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Oct 6, 2023
1 parent 1397600 commit 43a046a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions swiftsimio/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 43a046a

Please sign in to comment.