Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load fof catalogues refactor #195

Merged
merged 7 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,27 @@ packages = [
"swiftsimio.metadata.particle",
"swiftsimio.metadata.unit",
"swiftsimio.metadata.writer",
"swiftsimio.metadata.soap",
"swiftsimio.visualisation",
"swiftsimio.visualisation.projection_backends",
"swiftsimio.visualisation.slice_backends",
"swiftsimio.visualisation.tools",
"swiftsimio.visualisation.smoothing_length",
"swiftsimio.metadata.soap"
]

[project]
name = "swiftsimio"
version="8.0.1"
version="9.0.0"
authors = [
{ name="Josh Borrow", email="[email protected]" },
]
description="SWIFTsim (swift.dur.ac.uk) i/o routines for python."
description="SWIFTsim (swiftsim.com) i/o routines for python."
readme = "README.md"
requires-python = ">3.8.0"
requires-python = ">3.10.0"
classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Operating System :: OS Independent",
]
Expand Down
2 changes: 1 addition & 1 deletion swiftsimio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def mask(filename, spatial_only=True) -> SWIFTMask:
"""

units = SWIFTUnits(filename)
metadata = SWIFTMetadata(filename, units)
metadata = metadata_discriminator(filename, units)

return SWIFTMask(metadata=metadata, spatial_only=spatial_only)

Expand Down
15 changes: 8 additions & 7 deletions swiftsimio/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ def __init__(self, metadata: SWIFTMetadata, spatial_only=True):
self.units = metadata.units
self.spatial_only = spatial_only

if self.metadata.filetype == "FOF":
# No virtual snapshots or cells metadata for fof currently
raise NotImplementedError("Masking not supported for FOF filetype")
if not self.metadata.masking_valid:
raise NotImplementedError(
f"Masking not supported for {self.metadata.output_type} filetype"
)

if self.metadata.partial_snapshot:
raise InvalidSnapshot(
Expand Down Expand Up @@ -111,12 +112,12 @@ def _unpack_cell_metadata(self):
for group, group_name in zip(
self.metadata.present_groups, self.metadata.present_group_names
):
if self.metadata.filetype == "SOAP":
counts = count_handle["Subhalos"][:]
offsets = offset_handle["Subhalos"][:]
elif self.metadata.filetype == "snapshot":
if self.metadata.shared_cell_counts is None:
counts = count_handle[group][:]
offsets = offset_handle[group][:]
else:
counts = count_handle[self.metadata.shared_cell_counts][:]
offsets = offset_handle[self.metadata.shared_cell_counts][:]

# When using MPI, we cannot assume that these are sorted.
if sort is None:
Expand Down
2 changes: 2 additions & 0 deletions swiftsimio/metadata/metadata/metadata_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
header_unpack_arrays = {
"BoxSize": "boxsize",
"NumPart_ThisFile": "num_part",
"NumGroup_ThisFile": "num_group",
"NumSubhalos_ThisFile": "num_subhalo",
"CanHaveTypes": "has_type",
"NumFilesPerSnapshot": "num_files_per_snapshot",
"OutputType": "output_type",
Expand Down
Loading
Loading