diff --git a/src/scida/customs/arepo/dataset.py b/src/scida/customs/arepo/dataset.py index 7ba4beb2..77946e9e 100644 --- a/src/scida/customs/arepo/dataset.py +++ b/src/scida/customs/arepo/dataset.py @@ -52,6 +52,10 @@ def prepare(self, *args, **kwargs) -> None: pnum = int(splt[1]) offset = offsets[pnum] length = lengths[pnum] + if hasattr(offset, "magnitude"): # hack for issue 59 + offset = offset.magnitude + if hasattr(length, "magnitude"): + length = length.magnitude for k, v in self.data_backup[p].items(): self.data[p][k] = v[offset : offset + length] snap.data = self.data diff --git a/tests/test_issues.py b/tests/test_issues.py new file mode 100644 index 00000000..fa7f186d --- /dev/null +++ b/tests/test_issues.py @@ -0,0 +1,14 @@ +# tests for gh issues. to be cleaned up and moved to the right place eventually +from scida import load +from tests.testdata_properties import require_testdata_path + + +@require_testdata_path("interface", only=["TNG50-4_snapshot"]) +def test_issue_59(testdatapath): + # current testing of interface did not include units=True yet. + obj = load(testdatapath, units=False) + _ = obj.return_data(haloID=42) + # for units=True, this would be a pint.Quantity, so we need to check for that + # in the Selector + obj = load(testdatapath, units=True) + _ = obj.return_data(haloID=42)