[yt-dev] Issue #1272: Error when using load_octree (yt_analysis/yt)

Anonymous issues-reply at bitbucket.org
Sun Sep 4 14:23:56 PDT 2016


New issue 1272: Error when using load_octree
https://bitbucket.org/yt_analysis/yt/issues/1272/error-when-using-load_octree

Anonymous:

The following code:


```
#!python

import numpy as np

from yt.mods import load_octree, ProjectionPlot

octree_mask = np.array([8,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0], dtype=np.uint8)

quantities = {}
quantities[('gas', 'density')] = np.ones((22,1), dtype=float)

bbox = np.array([[-10., 10.], [-10., 10.], [-10., 10.]])

spf = load_octree(octree_mask=octree_mask,
                  data=quantities,
                  bbox=bbox,
                  over_refine_factor=0,
                  partial_coverage=0)
 
p = ProjectionPlot(spf, 'x', ['density'], center='c', origin='native')
```

produces the following error:

```
yt : [INFO     ] 2016-09-04 22:19:26,815 Parameters: current_time              = 0.0
yt : [INFO     ] 2016-09-04 22:19:26,815 Parameters: domain_dimensions         = [1 1 1]
yt : [INFO     ] 2016-09-04 22:19:26,816 Parameters: domain_left_edge          = [-10. -10. -10.]
yt : [INFO     ] 2016-09-04 22:19:26,817 Parameters: domain_right_edge         = [ 10.  10.  10.]
yt : [INFO     ] 2016-09-04 22:19:26,817 Parameters: cosmological_simulation   = 0.0
Traceback (most recent call last):
  File "debug.py", line 18, in <module>
    p = ProjectionPlot(spf, 'x', ['density'], center='c', origin='native')
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/visualization/plot_window.py", line 1433, in __init__
    max_level=max_level)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/data_objects/construction_data_containers.py", line 262, in __init__
    self.get_data(field)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/data_objects/construction_data_containers.py", line 336, in get_data
    self._handle_chunk(chunk, fields, tree)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/data_objects/construction_data_containers.py", line 436, in _handle_chunk
    d = chunk[field] * dl
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/data_objects/data_containers.py", line 272, in __getitem__
    self.get_data(f)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/data_objects/data_containers.py", line 1178, in get_data
    fluids, self, self._current_chunk)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/geometry/geometry_handler.py", line 245, in _read_fluid_fields
    chunk_size)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/frontends/stream/io.py", line 252, in _read_fluid_selection
    subset.fill(field_vals, rv, selector, ind)
  File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/yt/frontends/stream/data_structures.py", line 1402, in fill
    selector, self.domain_id, cell_count)
  File "yt/geometry/oct_container.pyx", line 775, in yt.geometry.oct_container.OctreeContainer.file_index_octs (yt/geometry/oct_container.c:13230)
ValueError: Buffer dtype mismatch, expected 'uint8_t' but got 'long'
```

I'm using yt 3.3.1 from conda-forge and Python 3.5. This works correctly with yt 3.2.3 from conda-forge though, so I think it must be a bug in the 3.3 series?




More information about the yt-dev mailing list