Hi Paco,

What is the command you use to load the octree, specifically?  i.e., what you feed in to load_octree ?

On Mon, Sep 28, 2020 at 2:56 PM Paco Holguin <opaco450@gmail.com> wrote:
I tried following the link: https://yt-project.org/doc/reference/api/yt.frontends.stream.data_structures.html#yt.frontends.stream.data_structures.load_octree

The "ds" object is created successfully, and fields such as 'y' seem to output correctly. However, when I try to access "gas","density" I get the following error, which occurs even if I create some random particle data and include it in the list of "quantities"



Traceback (most recent call last):

  File "load_tree.py", line 83, in <module>

    ad['gas','density']

  File "/home/opaco/yt_dir/yt-conda/lib/python3.7/site-packages/yt/data_objects/data_containers.py", line 282, in __getitem__

    self.get_data(f)

  File "/home/opaco/yt_dir/yt-conda/lib/python3.7/site-packages/yt/data_objects/data_containers.py", line 1331, in get_data

    particles, self, self._current_chunk)

  File "/home/opaco/yt_dir/yt-conda/lib/python3.7/site-packages/yt/geometry/geometry_handler.py", line 227, in _read_particle_fields

    fields_to_read)

  File "/home/opaco/yt_dir/yt-conda/lib/python3.7/site-packages/yt/utilities/io_handler.py", line 199, in _read_particle_selection

    psize = self._count_particles_chunks(chunks, ptf, selector)

  File "/home/opaco/yt_dir/yt-conda/lib/python3.7/site-packages/yt/utilities/io_handler.py", line 170, in _count_particles_chunks

    for ptype, (x, y, z) in self._read_particle_coords(chunks, ptf):

AttributeError: 'IOHandlerStreamOctree' object has no attribute '_read_particle_coords'





I tried looking at "data_containers.py" but I wasn't able to figure out where to look from there. I'm wondering if I could remove the particle part of this line, or something similar.

        # The _read method will figure out which fields it needs to get from

        # disk, and return a dict of those fields along with the fields that

        # need to be generated.

        read_fluids, gen_fluids = self.index._read_fluid_fields(

                                        fluids, self, self._current_chunk)

        for f, v in read_fluids.items():

            self.field_data[f] = self.ds.arr(v, input_units = finfos[f].units)

            self.field_data[f].convert_to_units(finfos[f].output_units)


        read_particles, gen_particles = self.index._read_particle_fields(

                                        particles, self, self._current_chunk)




I would appreciate any insight into what is going on.

Thanks!


On Sun, Sep 27, 2020 at 8:10 PM Paco Holguin <opaco450@gmail.com> wrote:
Thanks for the link. I'll take a look at how the data is structured and try the "load_octree" function. The data is in hdf5 format.

On Sun, Sep 27, 2020 at 5:49 AM Corentin CADIOU <contact@cphyc.me> wrote:

Dear Paco,

You may be able to achieve what you want using `yt.load_octree` (see https://yt-project.org/doc/reference/api/yt.frontends.stream.data_structures.html#yt.frontends.stream.data_structures.load_octree), though I never tried it myself.

The function expects the octs to be fed in a depth-first manner (see https://en.wikipedia.org/wiki/Depth-first_search).

Out of curiosity, what format has the data you are trying to load?

Cheers,
Corentin

On 26/09/2020 21:14, Paco Holguin wrote:
Hello,

I've looked at the documentation and it seems that octree datasets are loadable for a few specific codes, but not in general. I have an octree that represents galaxy simulation data, but it's produced as an output of an analysis script. It would be nice to take advantage of yt's capabilities to do analysis.

Is there a simple way to load an generic octree or would I have to write a front-end myself (as described in the documentation and by looking at ART, for example)?

Thanks!


Paco Holguin

_______________________________________________
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: contact@cphyc.me
_______________________________________________
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