<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I installed YT all over again,</span><div style="font-family:arial,sans-serif;font-size:13px">now the plots that I get are a bit weird. it sounds like it is putting cubes around haloes:</div>
<div style="font-family:arial,sans-serif;font-size:13px">from this command:</div><div class="im" style="font-family:arial,sans-serif;font-size:13px">p = ProjectionPlot(pf, "x", "particle_density",[ 0.5808,0.5398, 0.4504 ],(4.0,'mpc'))</div>
<div class="im" style="font-family:arial,sans-serif;font-size:13px">the image is here:</div><div class="im" style="font-family:arial,sans-serif;font-size:13px"><a href="http://i.imgur.com/z4QA2uz.png">http://i.imgur.com/z4QA2uz.png</a><br>
</div><div class="im" style="font-family:arial,sans-serif;font-size:13px"><br></div><div class="im" style="font-family:arial,sans-serif;font-size:13px">-Mohammad</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Jul 10, 2013 at 3:58 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Mohammad,<br>
<br>
Sorry you're having trouble. In my version of cde0a641f1bf , the line<br>
numebrs don't match up with yours. In particular, my _pdensity<br>
function starts on line 1010, and looks like this:<br>
<br>
def _pdensity(field, data):<br>
blank = np.zeros(data.ActiveDimensions, dtype='float64')<br>
if data["particle_position_x"].size == 0: return blank<br>
CICDeposit_3(data["particle_position_x"].astype(np.float64),<br>
data["particle_position_y"].astype(np.float64),<br>
data["particle_position_z"].astype(np.float64),<br>
data["ParticleMass"],<br>
data["particle_position_x"].size,<br>
blank, np.array(data.LeftEdge).astype(np.float64),<br>
np.array(data.ActiveDimensions).astype(np.int32),<br>
np.float64(data['dx']))<br>
np.divide(blank, data["CellVolume"], blank)<br>
return blank<br>
add_field("particle_density", function=_pdensity,<br>
validators=[ValidateGridType()],<br>
display_name=r"\mathrm{Particle}\/\mathrm{Density}")<br>
<br>
The only buffer there that's not cast to float64 is<br>
data["ParticleMass"]. I don't know why your line numbers and mine do<br>
not match up, since you don't have a + in your source file, however if<br>
your function matches mine please try adding the appropriate<br>
.astype(np.float64). In 3.0 we have abstracted some of this out to<br>
use a deposit function that handles types better.<br>
<br>
-Matt<br>
<div><div class="h5"><br>
On Wed, Jul 10, 2013 at 3:38 PM, mohammad safarzadeh<br>
<<a href="mailto:mtsafarzadeh@gmail.com">mtsafarzadeh@gmail.com</a>> wrote:<br>
> Hi,<br>
> I get this error when trying to do a projection plot:<br>
> ----> 9 p = ProjectionPlot(pf, "x", "particle_density",[ 0.5808,0.5398,<br>
> 0.4504 ],(4.0,'mpc'))<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/visualization/plot_window.pyc in<br>
> __init__(self, pf, axis, fields, center, width, axes_unit, weight_field,<br>
> max_level, origin, fontsize, field_parameters, data_source)<br>
> 1347 if field_parameters is None: field_parameters = {}<br>
> 1348 proj = pf.h.proj(axis, fields, weight_field=weight_field,<br>
> max_level=max_level,<br>
> -> 1349 center=center, source=data_source,<br>
> **field_parameters)<br>
> 1350 PWViewerMPL.__init__(self, proj, bounds, origin=origin,<br>
> fontsize=fontsize)<br>
> 1351 self.set_axes_unit(axes_unit)<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> __init__(self, axis, field, weight_field, max_level, center, pf, source,<br>
> node_name, field_cuts, preload_style, serialize, style, **kwargs)<br>
> 1758 self.preload_style = preload_style<br>
> 1759 self._deserialize(node_name)<br>
> -> 1760 self._refresh_data()<br>
> 1761 if self._okay_to_serialize and self.serialize:<br>
> self._serialize(node_name=self._node_name)<br>
> 1762<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> _refresh_data(self)<br>
> 318 """<br>
> 319 self.clear_data()<br>
> --> 320 self.get_data()<br>
> 321<br>
> 322 def keys(self):<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> get_data(self, fields)<br>
> 1859 if g.Level == level],<br>
> 1860 self.get_dependencies(fields),<br>
> <a href="http://self.hierarchy.io" target="_blank">self.hierarchy.io</a>)<br>
> -> 1861 self._add_level_to_tree(tree, level, fields)<br>
> 1862 mylog.debug("End of projecting level level %s, memory<br>
> usage %0.3e",<br>
> 1863 level, get_memory_usage()/1024.)<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> _add_level_to_tree(self, tree, level, fields)<br>
> 1981 % (level, self._max_level),<br>
> len(grids_to_project))<br>
> 1982 for pi, grid in enumerate(grids_to_project):<br>
> -> 1983 self._add_grid_to_tree(tree, grid, fields, zero_out,<br>
> dls)<br>
> 1984 pbar.update(pi)<br>
> 1985 grid.clear_data()<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> _add_grid_to_tree(self, tree, grid, fields, zero_out, dls)<br>
> 1925 if zero_out: weight_data[grid.child_indices] = 0<br>
> 1926 masked_data = [fd.astype('float64') * weight_data<br>
> -> 1927 for fd in self._get_data_from_grid(grid,<br>
> fields)]<br>
> 1928 wdl = 1.0<br>
> 1929 else:<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> save_state(self, grid, field, *args, **kwargs)<br>
> 93 old_keys = grid.field_data.keys()<br>
> 94 grid.field_parameters = self.field_parameters<br>
> ---> 95 tr = func(self, grid, field, *args, **kwargs)<br>
> 96 grid.field_parameters = old_params<br>
> 97 grid.field_data = YTFieldData( [(k, grid.field_data[k]) for<br>
> k in old_keys] )<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> _get_data_from_grid(self, grid, fields)<br>
> 2003 else:<br>
> 2004 bad_points = 1.0<br>
> -> 2005 return [grid[field] * bad_points for field in fields]<br>
> 2006<br>
> 2007 def _gen_node_name(self):<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> __getitem__(self, key)<br>
> 155 """<br>
> 156 if key not in self.field_data:<br>
> --> 157 self.get_data(key)<br>
> 158 return self.field_data[key]<br>
> 159<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> get_data(self, field, convert)<br>
> 198 else: raise<br>
> 199 else:<br>
> --> 200 self._generate_field(field)<br>
> 201 return self.field_data[field]<br>
> 202<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> _generate_field(self, field)<br>
> 143 self[field] = temp_array[sl]<br>
> 144 else:<br>
> --> 145 self[field] = self.pf.field_info[field](self)<br>
> 146 else: # Can't find the field, try as it might<br>
> 147 raise exceptions.KeyError(field)<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.pyc<br>
> in __call__(self, data)<br>
> 393 ii = self.check_available(data)<br>
> 394 original_fields = data.keys() # Copy<br>
> --> 395 dd = self._function(self, data)<br>
> 396 dd *= self._convert_function(data)<br>
> 397 for field_name in data.keys():<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/data_objects/universal_fields.pyc in<br>
> _pdensity(field, data)<br>
> 982 blank, np.array(data.LeftEdge).astype(np.float64),<br>
> 983 np.array(data.ActiveDimensions).astype(np.int32),<br>
> --> 984 np.float64(data['dx']))<br>
> 985 return blank<br>
> 986 add_field("particle_density", function=_pdensity,<br>
><br>
> /home/safarzadeh/yt-x86_64/src/yt-hg/yt/utilities/lib/CICDeposit.so in<br>
> yt.utilities.lib.CICDeposit.CICDeposit_3<br>
> (yt/utilities/lib/CICDeposit.c:1485)()<br>
><br>
> ValueError: Buffer dtype mismatch, expected 'float64_t' but got 'float'<br>
><br>
> are there alternative ways around it?<br>
><br>
> (yt-x86_64)[safarzadeh@hecate yt-x86_64]$ yt instinfo<br>
><br>
> yt module located at:<br>
> /home/safarzadeh/yt-x86_64/src/yt-hg<br>
> The supplemental repositories are located at:<br>
> /home/safarzadeh/yt-x86_64/src/yt-supplemental<br>
><br>
> The current version of the code is:<br>
><br>
> ---<br>
> cde0a641f1bf<br>
> ---<br>
><br>
> This installation CAN be automatically updated.<br>
> Could not determine when yt stack was last updated.<br>
><br>
><br>
><br>
> Regards,<br>
> Mohammad<br>
><br>
</div></div>> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br></div>