[yt-dev] Issue #603: saving a plotcollection object. (yt_analysis/yt)

Anonymous issues-reply at bitbucket.org
Mon Jul 8 06:40:43 PDT 2013


New issue 603: saving a plotcollection object.
https://bitbucket.org/yt_analysis/yt/issue/603/saving-a-plotcollection-object

Anonymous:

pc=PlotCollection(pf,[ 0.5808,0.5398, 0.4504 ])
In [5]: pc.add_thin_projection("particle_density",'z',0.1)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-8ce95d6a0b96> in <module>()
----> 1 pc.add_thin_projection("particle_density",'z',0.1)

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.pyc in add_thin_projection(self, field, axis, thickness, weight_field, center, use_colorbar, figure, axes, fig_size, periodic, field_parameters)
    875         obj = self.pf.hierarchy.proj(axis, field, weight_field,
    876                                      source = region, center=center,
--> 877                                      **field_parameters)
    878         p = self._add_plot(PCProjectionPlot(obj, field,
    879                          use_colorbar=use_colorbar, axes=axes, figure=figure,

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in __init__(self, axis, field, weight_field, max_level, center, pf, source, node_name, field_cuts, preload_style, serialize, style, **kwargs)
   1758         self.preload_style = preload_style
   1759         self._deserialize(node_name)
-> 1760         self._refresh_data()
   1761         if self._okay_to_serialize and self.serialize: self._serialize(node_name=self._node_name)
   1762 

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in _refresh_data(self)
    318         """
    319         self.clear_data()
--> 320         self.get_data()
    321 
    322     def keys(self):

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in get_data(self, fields)
   1859                                  if g.Level == level],
   1860                               self.get_dependencies(fields), self.hierarchy.io)
-> 1861             self._add_level_to_tree(tree, level, fields)
   1862             mylog.debug("End of projecting level level %s, memory usage %0.3e",
   1863                         level, get_memory_usage()/1024.)

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in _add_level_to_tree(self, tree, level, fields)
   1981                               % (level, self._max_level), len(grids_to_project))
   1982             for pi, grid in enumerate(grids_to_project):
-> 1983                 self._add_grid_to_tree(tree, grid, fields, zero_out, dls)
   1984                 pbar.update(pi)
   1985                 grid.clear_data()

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in _add_grid_to_tree(self, tree, grid, fields, zero_out, dls)
   1925             if zero_out: weight_data[grid.child_indices] = 0
   1926             masked_data = [fd.astype('float64') * weight_data
-> 1927                            for fd in self._get_data_from_grid(grid, fields)]
   1928             wdl = 1.0
   1929         else:

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in save_state(self, grid, field, *args, **kwargs)
     93         old_keys = grid.field_data.keys()
     94         grid.field_parameters = self.field_parameters
---> 95         tr = func(self, grid, field, *args, **kwargs)
     96         grid.field_parameters = old_params
     97         grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py in _get_data_from_grid(self, grid, fields)
   2003         else:
   2004             bad_points = 1.0
-> 2005         return [grid[field] * bad_points for field in fields]
   2006 
   2007     def _gen_node_name(self):

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in __getitem__(self, key)
    155         """
    156         if key not in self.field_data:
--> 157             self.get_data(key)
    158         return self.field_data[key]
    159 

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in get_data(self, field, convert)
    198                     else: raise
    199             else:
--> 200                 self._generate_field(field)
    201         return self.field_data[field]
    202 

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in _generate_field(self, field)
    143                 self[field] = temp_array[sl]
    144             else:
--> 145                 self[field] = self.pf.field_info[field](self)
    146         else: # Can't find the field, try as it might
    147             raise exceptions.KeyError(field)

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py in __call__(self, data)
    393         ii = self.check_available(data)
    394         original_fields = data.keys() # Copy
--> 395         dd = self._function(self, data)
    396         dd *= self._convert_function(data)
    397         for field_name in data.keys():

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/universal_fields.py in _pdensity(field, data)
    982                  blank, np.array(data.LeftEdge).astype(np.float64),
    983                  np.array(data.ActiveDimensions).astype(np.int32),
--> 984                  np.float64(data['dx']))
    985     return blank
    986 add_field("particle_density", function=_pdensity,

/home/safarzadeh/yt-x86_64/src/yt-hg/yt/utilities/lib/CICDeposit.so in yt.utilities.lib.CICDeposit.CICDeposit_3 (yt/utilities/lib/CICDeposit.c:1485)()

ValueError: Buffer dtype mismatch, expected 'float64_t' but got 'float'





More information about the yt-dev mailing list