Hi Christian,

If I am following Slack right, I think this got resolved -- or is there more we should do to help out?

On Tue, Jul 26, 2022 at 7:55 AM Christian van der Merwe via yt-users <yt-users@python.org> wrote:
Hi all,

I am very new to YT and I have been trying to create a line plot for my GADGET-4 simulation output, but I keep running into a problem.

I try to do a similar plot as that found here: https://yt-project.org/doc/cookbook/simple_plots.html#simple-1d-line-plotting. I want to be able to 'draw' an arbitrary line and see how a quantity such as density changes along that line. My script and an example snapshot is linked below with the error I am getting following after.

The code: http://paste.yt-project.org/show/392/
The snapshot and code: http://use.yt/upload/6dd0e0b8
YT version: 4.0.4

I keep getting this traceback error:

" Traceback (most recent call last):

  File ~/PATH/yt_analysis.py:85 in <module>
    plot = yt.LinePlot(ds, "Density", (0.0, 0.0, 0.0), (0.0, 1.0, 0.0), 1000)

  File ~/.local/lib/python3.9/site-packages/yt/visualization/line_plot.py:174 in __init__
    self._setup_plots()

  File ~/.local/lib/python3.9/site-packages/yt/visualization/line_plot.py:308 in _setup_plots
    x, y = self.ds.coordinates.pixelize_line(

  File ~/.local/lib/python3.9/site-packages/yt/geometry/coordinates/cartesian_coordinates.py:284 in pixelize_line
    arc_length, plot_values = _sample_ray(ray, npoints, field)

  File ~/.local/lib/python3.9/site-packages/yt/geometry/coordinates/cartesian_coordinates.py:47 in _sample_ray
    ray_coordinates = uvstack([ray[("index", d)] for d in "xyz"]).T

  File ~/.local/lib/python3.9/site-packages/yt/geometry/coordinates/cartesian_coordinates.py:47 in <listcomp>
    ray_coordinates = uvstack([ray[("index", d)] for d in "xyz"]).T

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/data_containers.py:258 in __getitem__
    self.get_data(f)

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/selection_objects/data_selection_objects.py:211 in get_data
    self._generate_fields(fields_to_generate)

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/selection_objects/data_selection_objects.py:232 in _generate_fields
    fd = self._generate_field(field)

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/data_containers.py:299 in _generate_field
    tr = self._generate_fluid_field(field)

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/data_containers.py:318 in _generate_fluid_field
    rv = finfo(gen_obj)

  File ~/.local/lib/python3.9/site-packages/yt/fields/derived_field.py:294 in __call__
    dd = self._function(self, data)

  File ~/.local/lib/python3.9/site-packages/yt/geometry/coordinates/coordinate_handler.py:24 in _coords
    rv = data.ds.arr(data.fcoords[..., axi].copy(), units)

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/selection_objects/data_selection_objects.py:418 in fcoords
    return self._current_chunk.fcoords

  File ~/.local/lib/python3.9/site-packages/yt/geometry/geometry_handler.py:255 in cached_func
    tr = self._accumulate_values(n[1:])

  File ~/.local/lib/python3.9/site-packages/yt/geometry/geometry_handler.py:292 in _accumulate_values
    arrs.append(f(self.dobj))

  File ~/.local/lib/python3.9/site-packages/yt/data_objects/index_subobjects/particle_container.py:17 in _func_non_indexed
    raise YTNonIndexedDataContainer(self)

YTNonIndexedDataContainer: The data container (<class 'yt.data_objects.index_subobjects.particle_container.ParticleContainer'>) is an unindexed type.  Operations such as ires, icoords, fcoords and fwidth will not work on it."

Help with this would be highly appreciated.

Kind regards,
Christian
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org
https://mail.python.org/mailman3/lists/yt-users.python.org/
Member address: matthewturk@gmail.com