You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assuming we successfully run the example code for the particle_trajectories module (e.g. using the workaround mentioned in #4765, ie ("all","particle_position_x") --> ("io","particle_position_x")), getting a trajectory by index fails due to mixing strs and tuples in a call to sorted(self.field_data.keys())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/.conda/envs/test_yt/lib/python3.11/site-packages/yt/data_objects/particle_trajectories.py", line 340, in trajectory_from_index
fields = sorted(self.field_data.keys())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'tuple' and 'str'
Expected outcome
A dictionary with particle trajectory information. Something like
Additional Comments
I'm guessing this is occurring because the ParticleTrajectories constructor is adding the default fields particle_position_x/y/z, particle_index, and particle_time to the field_data parameter instead of tupleizing them (as e.g. ('all','particle_index') or (ptype,'particle_index') maybe?).
The text was updated successfully, but these errors were encountered:
I'm not positive, but I don't think this is related to #4590 (mostly because I originally ran into this problem with GIZMO data). I suspect it's an artifact from the 4.0 transition?
I think I have a possible fix actually, I'll post a pr in a moment.
Bug report
Bug summary
Assuming we successfully run the example code for the particle_trajectories module (e.g. using the workaround mentioned in #4765, ie
("all","particle_position_x")
-->("io","particle_position_x")
), getting a trajectory by index fails due to mixingstr
s andtuple
s in a call tosorted(self.field_data.keys())
Code for reproduction
Actual outcome
Expected outcome
A dictionary with particle trajectory information. Something like
Version Information
yt is installed through the conda-forge channel.
Additional Comments
I'm guessing this is occurring because the ParticleTrajectories constructor is adding the default fields
particle_position_x/y/z
,particle_index
, andparticle_time
to thefield_data
parameter instead of tupleizing them (as e.g.('all','particle_index')
or(ptype,'particle_index')
maybe?).The text was updated successfully, but these errors were encountered: