Skip to content

Commit

Permalink
address #59 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbyrohl authored Aug 3, 2023
1 parent 70f9c8c commit 0550497
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/scida/customs/arepo/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 0550497

Please sign in to comment.