Skip to content

PhasePlot fails when a weight_field is set for a particle-based dataset #5089

@chummels

Description

@chummels

Bug report

Bug summary

PhasePlot fails when a weight_field is set for a particle-based dataset. Note, this does not affect grid-based datasets.

Code for reproduction

import yt
ds = yt.load_sample("FIRE_M12i_ref11")
my_sphere = ds.sphere("c", (50, "kpc"))
plot = yt.PhasePlot(my_sphere, ("gas", "density"), ("gas", "temperature"), [("gas", "H_p0_fraction")], weight_field=('gas', 'density'))
plot.save()

Actual outcome

Traceback (most recent call last):
  File "/Users/chummels/scratch/test_weight_field.py", line 4, in <module>
    plot = yt.PhasePlot(my_sphere, ("gas", "density"), ("gas", "temperature"), [("gas", "H_p0_fraction")], weight_field=('gas', 'density'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chummels/src/yt/yt/visualization/profile_plotter.py", line 953, in __init__
    profile = create_profile(
              ^^^^^^^^^^^^^^^
  File "/Users/chummels/src/yt/yt/data_objects/profiles.py", line 1317, in create_profile
    is_local.append(wf.sampling_type == "local")
                    ^^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'sampling_type'```

**Expected outcome**

The PhasePlot completing successfully and making a PhasePlot output file.

**Version Information**
yt dev tip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions