[yt-dev] Issue #601: Data selection breaks when passed a list of fields. (yt_analysis/yt)
Nathan Goldbaum
issues-reply at bitbucket.org
Tue Jul 2 15:05:37 PDT 2013
New issue 601: Data selection breaks when passed a list of fields.
https://bitbucket.org/yt_analysis/yt/issue/601/data-selection-breaks-when-passed-a-list
Nathan Goldbaum:
The following example script exposes the issue:
```
#!python
from yt.mods import *
pf = load('IsolatedGalaxy/galaxy0030/galaxy0030')
slc = SlicePlot(pf, 0, ['Density', 'TotalMassMsun'])
slc.save()
```
```
#!python traceback
$ python test.py
yt : [INFO ] 2013-07-02 15:03:11,543 Parameters: current_time = 0.00600002000283
yt : [INFO ] 2013-07-02 15:03:11,543 Parameters: domain_dimensions = [32 32 32]
yt : [INFO ] 2013-07-02 15:03:11,545 Parameters: domain_left_edge = [ 0. 0. 0.]
yt : [INFO ] 2013-07-02 15:03:11,546 Parameters: domain_right_edge = [ 1. 1. 1.]
yt : [INFO ] 2013-07-02 15:03:11,546 Parameters: cosmological_simulation = 0.0
Parsing Hierarchy100% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 00:00:00
yt : [INFO ] 2013-07-02 15:03:11,572 Gathering a field list (this may take a moment.)
yt : [INFO ] 2013-07-02 15:03:11,591 Adding unknown field SFR_Density to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field Forming_Stellar_Mass_Density to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field Galaxy1Colour to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field kphHeI to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field MBHColour to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field Phi_pField to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field Galaxy2Colour to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field Average_creation_time to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field gammaHI to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field kphHI to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field kphHeII to list of fields
yt : [INFO ] 2013-07-02 15:03:11,592 Adding unknown field Star_Particle_Density to list of fields
yt : [INFO ] 2013-07-02 15:03:11,593 Adding unknown field PhiField to list of fields
Traceback (most recent call last):
File "test.py", line 5, in <module>
slc = SlicePlot(pf, 0, ['Density', 'TotalMassMsun'])
File "/Users/goldbaum/Documents/yt-3.0/yt/visualization/plot_window.py", line 1259, in __init__
slc.get_data(fields)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 513, in get_data
self._generate_fields(fields_to_generate)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 529, in _generate_fields
self.field_data[field] = self._generate_field(field)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 226, in _generate_field
tr = self._generate_fluid_field(field)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 243, in _generate_fluid_field
rv = self._generate_spatial_fluid(field, ngt_exception.ghost_zones)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 253, in _generate_spatial_fluid
for i,chunk in enumerate(self.chunks(field, "spatial", ngz = 0)):
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 449, in chunks
self.get_data(fields)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 513, in get_data
self._generate_fields(fields_to_generate)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 529, in _generate_fields
self.field_data[field] = self._generate_field(field)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 226, in _generate_field
tr = self._generate_fluid_field(field)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 245, in _generate_fluid_field
rv = finfo(gen_obj)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/field_info_container.py", line 491, in __call__
dd = self._function(self, data)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/universal_fields.py", line 1009, in _pdensity
pmass = data[('deposit','all_mass')]
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/grid_patch.py", line 94, in __getitem__
tr = super(AMRGridPatch, self).__getitem__(key)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 200, in __getitem__
self.get_data(f)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 513, in get_data
self._generate_fields(fields_to_generate)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 529, in _generate_fields
self.field_data[field] = self._generate_field(field)
File "/Users/goldbaum/Documents/yt-3.0/yt/data_objects/data_containers.py", line 228, in _generate_field
raise YTCouldNotGenerateField(field, self.pf)
yt.utilities.exceptions.YTCouldNotGenerateField: Could field '('all', 'particle_mass')' in galaxy0030 could not be generated.
```
Note that while this script creates a plot, this has nothing to do with the plotting code. Instead, the error happens when I call get_data on the slice object SlicePlot uses as the data source.
Responsible: MatthewTurk
More information about the yt-dev
mailing list