From 0a3cefcb4ef1ba3e042dd3c47108f4c9660cecb7 Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Thu, 15 Aug 2024 10:43:11 -0500 Subject: [PATCH] bug: tipsy, reading just smoothing length --- yt/frontends/tipsy/io.py | 5 ++++- yt/frontends/tipsy/tests/test_outputs.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/yt/frontends/tipsy/io.py b/yt/frontends/tipsy/io.py index 29809570aa..044932fa58 100644 --- a/yt/frontends/tipsy/io.py +++ b/yt/frontends/tipsy/io.py @@ -58,7 +58,10 @@ def _fill_fields(self, fields, vals, hsml, mask, data_file): if mask is None: size = 0 elif isinstance(mask, slice): - size = vals[fields[0]].size + if fields[0] == "smoothing_length": + size = hsml.size + else: + size = vals[fields[0]].size else: size = mask.sum() rv = {} diff --git a/yt/frontends/tipsy/tests/test_outputs.py b/yt/frontends/tipsy/tests/test_outputs.py index 7b7667b21f..73e8d6201b 100644 --- a/yt/frontends/tipsy/tests/test_outputs.py +++ b/yt/frontends/tipsy/tests/test_outputs.py @@ -112,3 +112,9 @@ def test_tipsy_index(): ds = data_dir_load(tipsy_gal) sl = ds.slice("z", 0.0) assert sl["gas", "density"].shape[0] != 0 + + +@requires_file(tipsy_gal) +def test_tipsy_smoothing_length(): + ds = data_dir_load(tipsy_gal) + _ = ds.all_data()["Gas", "smoothing_length"]