Skip to content

Commit b4d2bf4

Browse files
committed
Merge branch 'master' into support_new_soap_output
2 parents a5c654f + c382416 commit b4d2bf4

4 files changed

Lines changed: 28 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ requires = ["setuptools>=61.0"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.setuptools]
6-
packages = ["velociraptor"]
6+
packages = ["velociraptor", "velociraptor.catalogue", "velociraptor.fitting_formulae", "velociraptor.observations", "velociraptor.autoplotter", "velociraptor.particles", "velociraptor.swift", "velociraptor.tools"]
77

88
[project]
99
name = "velociraptor-python"
10-
version="0.16.1"
10+
version="0.18.0"
1111
authors = [
1212
{ name="Josh Borrow", email="josh@joshborrow.com" },
1313
{ name="Kyle Oman", email="kyle.a.oman@durham.ac.uk" },
1414
]
1515
description="Velociraptor catalogue reading routines."
1616
readme = "README.md"
17-
requires-python = ">3.6.0"
17+
requires-python = ">3.10.0"
1818
classifiers = [
1919
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
2020
"Operating System :: OS Independent",
@@ -33,4 +33,4 @@ dependencies = [
3333

3434
[project.scripts]
3535
velociraptor-plot = "velociraptor.velociraptor_plot:velociraptor_plot"
36-
velociraptor-compute-box-size-correction = "velociraptor.velociraptor_compute_box_size_correction:velociraptor_compute_box_size_correction"
36+
velociraptor-compute-box-size-correction = "velociraptor.velociraptor_compute_box_size_correction:velociraptor_compute_box_size_correction"

velociraptor/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.17.0"
1+
__version__ = "0.18.0"

velociraptor/catalogue/velociraptor_catalogue.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,27 @@ def getter(self):
117117
with h5py.File(filename, "r") as handle:
118118
try:
119119
mask = getattr(self, "mask")
120-
setattr(
121-
self, f"_{name}", unyt.unyt_array(handle[field][mask], unit)
122-
)
120+
if (
121+
np.ndim(mask) != 0
122+
and np.issubdtype(np.array(mask).dtype, np.integer)
123+
and not np.all(mask[:-1] < mask[1:])
124+
):
125+
# We have a mask picking out items by index, and it's
126+
# not sorted. hdf5 demands that it be sorted.
127+
# We sort, read and then reverse the sort.
128+
sort_mask = np.argsort(mask)
129+
unsort_mask = np.argsort(sort_mask)
130+
setattr(
131+
self,
132+
f"_{name}",
133+
unyt.unyt_array(
134+
handle[field][mask[sort_mask]][unsort_mask], unit
135+
),
136+
)
137+
else:
138+
setattr(
139+
self, f"_{name}", unyt.unyt_array(handle[field][mask], unit)
140+
)
123141
getattr(self, f"_{name}").name = full_name
124142
getattr(self, f"_{name}").file = filename
125143
except KeyError:

velociraptor/swift/swift.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
datasets in a computationally efficient way.
66
"""
77

8-
98
import swiftsimio
109
import numpy as np
1110

@@ -98,7 +97,7 @@ def generate_bound_mask(
9897

9998
particle_name_masks = {}
10099

101-
for particle_name in data.metadata.present_particle_names:
100+
for particle_name in data.metadata.present_group_names:
102101
# This will change if we ever take advantage of the
103102
# parttypes available through velociraptor.
104103
particle_name_masks[particle_name] = np.in1d(
@@ -107,7 +106,7 @@ def generate_bound_mask(
107106

108107
# Finally we generate a named tuple with the correct fields and
109108
# fill it with the contents of our dictionary
110-
MaskTuple = namedtuple("MaskCollection", data.metadata.present_particle_names)
109+
MaskTuple = namedtuple("MaskCollection", data.metadata.present_group_names)
111110
mask = MaskTuple(**particle_name_masks)
112111

113112
return mask

0 commit comments

Comments
 (0)