Skip to content

Commit

Permalink
fix #89
Browse files Browse the repository at this point in the history
  • Loading branch information
cbyrohl committed Aug 18, 2023
1 parent 429c44f commit 48e753f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/scida/configfiles/units/gadget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ fields:
SubfindVelDisp: km / s
Velocities: km * a^(1/2) / s
TimeStep:
GroupFirstSub: none
LocalSubhaloID: none
Offsets: "no_units" # "no_units" indicates that no field has units in this group
# only do this for fields that have wrong or no metadata
PartType0:
Expand Down
2 changes: 1 addition & 1 deletion src/scida/customs/arepo/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def add_catalogIDs(self) -> None:
# calculate first subhalo of each halo that a particle belongs to
self.add_groupquantity_to_particles("GroupFirstSub", parttype=key)
pdata["SubhaloID"] = pdata["GroupFirstSub"] + pdata["LocalSubhaloID"]
pdata["SubHaloID"] = da.where(
pdata["SubhaloID"] = da.where(
pdata["SubhaloID"] == index_unbound, index_unbound, pdata["SubhaloID"]
)

Expand Down
9 changes: 9 additions & 0 deletions tests/customs/test_arepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,12 @@ def test_default_recipes(testdatapath):
obj2 = load(testdatapath, units=False)
v2 = obj2.data["PartType0"]["Temperature"][0].compute()
assert np.allclose(v1, v2)


@require_testdata_path("interface", only=["TNG50-4_snapshot"])
def test_allunitsdiscovered(testdatapath, caplog):
load(testdatapath)
caplog.set_level(logging.DEBUG)
assert (
"Cannot determine units from neither unit file nor metadata" not in caplog.text
)

0 comments on commit 48e753f

Please sign in to comment.