[yt-dev] Issue #835: Field detection issue for Tipsy datasets (yt_analysis/yt)

Nathan Goldbaum issues-reply at bitbucket.org
Wed Apr 23 14:21:43 PDT 2014


New issue 835: Field detection issue for Tipsy datasets
https://bitbucket.org/yt_analysis/yt/issue/835/field-detection-issue-for-tipsy-datasets

Nathan Goldbaum:

The following script:


```
#!python

from yt.mods import *
ds = load('TipsyGalaxy/galaxy.00300', n_ref=8)
ds.derived_field_list
dd = ds.all_data()
xcoord = dd['Gas','Coordinates'][:,0].v
ycoord = dd['Gas','Coordinates'][:,1].v
slc = SlicePlot(ds, 'z', ('gas','density'), width=(40, 'kpc'), center='m')
slc.save()
```

Produces the following traceback:


```
#!python traceback

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    slc = SlicePlot(ds, 'z', ('gas','density'), width=(40, 'kpc'), center='m')
  File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_window.py", line 1749, in SlicePlot
    return AxisAlignedSlicePlot(pf, normal, fields, *args, **kwargs)
  File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_window.py", line 972, in __init__
    (bounds, center) = get_window_parameters(axis, center, width, pf)
  File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_window.py", line 166, in get_window_parameters
    center = get_sanitized_center(center, pf)
  File "/Users/goldbaum/Documents/yt-hg/yt/visualization/plot_window.py", line 146, in get_sanitized_center
    v, center = pf.h.find_max("density")
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/static_output.py", line 533, in find_max
    source.quantities["MaxLocation"](field)
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 527, in __call__
    rv = super(MaxLocation, self).__call__(field)
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 59, in __call__
    sto.result = self.process_chunk(ds, *args, **kwargs)
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 538, in process_chunk
    if data[field].size > 0:
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/data_containers.py", line 205, in __getitem__
    f = self._determine_fields([key])[0]
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/data_containers.py", line 453, in _determine_fields
    finfo = self.pf._get_field_info(ftype, fname)
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/static_output.py", line 493, in _get_field_info
    raise YTFieldNotFound((ftype, fname), self)
yt.utilities.exceptions.YTFieldNotFound: Could not find field '('all', 'density')' in galaxy.00300.

```

When I remove the call to `ds.derived_field_list` I get a different failure:


```
#!python traceback

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    xcoord = dd['Gas','Coordinates'][:,0].v
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/data_containers.py", line 212, in __getitem__
    self.get_data(f)
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/data_containers.py", line 556, in get_data
    self.index._identify_base_chunk(self)
  File "/Users/goldbaum/Documents/yt-hg/yt/geometry/particle_geometry_handler.py", line 140, in _identify_base_chunk
    self.regions.identify_data_files(dobj.selector)]
  File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/data_containers.py", line 512, in selector
    self._selector = sclass(self)
  File "selection_routines.pyx", line 626, in yt.geometry.selection_routines.RegionSelector.__init__ (yt/geometry/selection_routines.c:9845)
  File "/Users/goldbaum/Documents/yt-hg/yt/units/yt_array.py", line 753, in __getitem__
    ret = super(YTArray, self).__getitem__(item)
IndexError: 0-d arrays can't be indexed

```

Finally, when I remove the lines that create and access data inside the `all_data` object, the script runs successfully and the plot is saved to disk.

This uses the TipsyGalaxy dataset which will be uploaded to yt-project.org/data shortly.





More information about the yt-dev mailing list