From 8f4ad01dee9b0bce6f59178742aa403b1bf9ce04 Mon Sep 17 00:00:00 2001 From: Cameron Hummels Date: Thu, 19 Dec 2024 15:19:24 -0800 Subject: [PATCH 1/2] Properly referencing sampling type of weight field --- yt/data_objects/profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt/data_objects/profiles.py b/yt/data_objects/profiles.py index 0b1b790785d..15a266e96d3 100644 --- a/yt/data_objects/profiles.py +++ b/yt/data_objects/profiles.py @@ -1314,7 +1314,7 @@ def create_profile( for f in bin_fields + fields ] if wf is not None: - is_local.append(wf.sampling_type == "local") + is_local.append(data_source.ds.field_info[wf].sampling_type == "local") is_local_or_pfield = [ pf or lf for (pf, lf) in zip(is_pfield, is_local, strict=True) ] From 4e49b40efab7dc794615d0c9f1e709990bda8526 Mon Sep 17 00:00:00 2001 From: Cameron Hummels Date: Thu, 19 Dec 2024 15:32:08 -0800 Subject: [PATCH 2/2] Adding profile test for SPH with weight_field --- yt/data_objects/tests/test_profiles.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yt/data_objects/tests/test_profiles.py b/yt/data_objects/tests/test_profiles.py index b68f2fb55e1..6a8245c34de 100644 --- a/yt/data_objects/tests/test_profiles.py +++ b/yt/data_objects/tests/test_profiles.py @@ -534,6 +534,12 @@ def test_profile_sph_data(): [("gas", "kinetic_energy_density")], weight_field=None, ) + yt.create_profile( + ds.all_data(), + [("gas", "density"), ("gas", "temperature")], + [("gas", "kinetic_energy_density")], + weight_field=("gas", "density"), + ) def test_profile_override_limits():