<div dir="ltr">Hi Matt,<div><br></div><div>Thanks! This is:</div><div><br></div><div><div>yt module located at:</div><div>    /home/tasker/yt-new2/src/yt-hg</div><div><br></div><div>The current version of the code is:</div>
<div><br></div><div>---</div><div>81c2f6f5f983</div><div>---</div></div><div><br></div><div><br></div><div style>Elizabeth</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 25 April 2014 17:34, 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 Elizabeth,<br>
<div><div class="h5"><br>
On Fri, Apr 25, 2014 at 3:40 AM, Elizabeth Tasker<br>
<<a href="mailto:tasker@astro1.sci.hokudai.ac.jp">tasker@astro1.sci.hokudai.ac.jp</a>> wrote:<br>
> Hi,<br>
><br>
> I've hit a problem with the latest version of yt and covering grid that is<br>
> linked with the number of ghostzones. My code looked like:<br>
><br>
> for dim in range(3):<br>
><br>
>       left.append(cloud_position[c][dim] - 0.5*width[dim])<br>
>       right.append(cloud_position[c][dim] + 0.5*width[dim])<br>
>       dims.append(int(round((right[dim]-left[dim])/cellsize)))<br>
><br>
>     cgrid = pf.h.covering_grid(level,<br>
>                                left_edge = left,<br>
>                                dims=dims,<br>
>                                num_ghost_zones=2)<br>
><br>
><br>
> but gives me:<br>
><br>
> TypeError                                 Traceback (most recent call last)<br>
> /home/tasker/yt-new2/src/yt-hg/scripts/iyt in <module>()<br>
> ----> 1 execfile("export_hdf5_cube.py")<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/scripts/iyt in <module>()<br>
>      51                                left_edge = left,<br>
>      52                                dims=dims,<br>
> ---> 53                                num_ghost_zones=2)<br>
>      54<br>
>      55<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> __init__(self, level, left_edge, dims, fields, pf, num_ghost_zones,<br>
> use_pbar, **kwargs)<br>
>    3689         self.level = level<br>
>    3690         rdx = self.pf.domain_dimensions*self.pf.refine_by**level<br>
> -> 3691         rdx[np.where(dims - 2 * num_ghost_zones <= 1)] = 1   # issue<br>
> 602<br>
>    3692         self.dds = self.pf.domain_width / rdx.astype("float64")<br>
>    3693         self.ActiveDimensions = np.array(dims, dtype='int32')<br>
><br>
> TypeError: unsupported operand type(s) for -: 'list' and 'int'<br>
><br>
><br>
><br>
><br>
> This happens regardless of whether I use num_ghost_zones or not. If I don't<br>
> have ghost_zones set, the error occurs at line 52, but still points to line<br>
> 3691. Dims and left look fine:<br>
><br>
> In [9]: dims<br>
> Out[9]: [64, 64, 64]<br>
><br>
> In [10]: left<br>
> Out[10]: [20.424700000000001, 11.512700000000001, 15.7158]<br>
><br>
> In [11]: level<br>
> Out[11]: 5<br>
><br>
> In [14]: rdx = pf.domain_dimensions*pf.refine_by**level<br>
> In [15]: rdx<br>
> Out[15]: array([4096, 4096, 4096])<br>
><br>
><br>
> If I set num_ghost_zones = na.array([0,0,0]) then it runs. However, if I<br>
> then try<br>
><br>
>  cgrid["x"]<br>
><br>
> I hit more problems circulating around the same area:<br>
><br>
> ValueError                                Traceback (most recent call last)<br>
> /home/tasker/yt-new2/src/yt-hg/scripts/iyt in <module>()<br>
> ----> 1 cgrid["y"]<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> __getitem__(self, key)<br>
>     316             if key not in self.fields:<br>
>     317                 self.fields.append(key)<br>
> --> 318             self.get_data(key)<br>
>     319         return self.field_data[key]<br>
>     320<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> get_data(self, fields)<br>
>    3733                 try:<br>
>    3734                     #print "Generating", field<br>
> -> 3735                     self._generate_field(field)<br>
>    3736                     continue<br>
>    3737                 except NeedsOriginalGrid, ngt_exception:<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/data_containers.pyc in<br>
> _generate_field(self, field)<br>
>    3764         if self.pf.field_info.has_key(field):<br>
>    3765             # First we check the validator; this might even raise!<br>
> -> 3766             self.pf.field_info[field].check_available(self)<br>
>    3767             self[field] = self.pf.field_info[field](self)<br>
>    3768         else: # Can't find the field, try as it might<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/field_info_container.pyc in<br>
> check_available(self, data)<br>
>     354         """<br>
>     355         for validator in self.validators:<br>
> --> 356             validator(data)<br>
>     357         # If we don't get an exception, we're good to go<br>
>     358         return True<br>
><br>
> /home/tasker/yt-new2/src/yt-hg/yt/data_objects/field_info_container.pyc in<br>
> __call__(self, data)<br>
>     482         if not data._spatial:<br>
>     483             raise NeedsGridType(self.ghost_zones,self.fields)<br>
> --> 484         if self.ghost_zones <= data._num_ghost_zones:<br>
>     485             return True<br>
>     486         raise NeedsGridType(self.ghost_zones,self.fields)<br>
><br>
> ValueError: The truth value of an array with more than one element is<br>
> ambiguous. Use a.any() or a.all()<br>
><br>
><br>
> cgrid["Density"] and the velocities are fine.<br>
><br>
> I'm suspecting this is because the position calculation in the code is not<br>
> expecting an array for the ghost zone number?<br>
><br>
> Oddly, I see from the mailing list is this reminiscent of a problem nyx was<br>
> having.<br>
<br>
</div></div>Yes, and it feels like this exact issue -- where dims are lists, not<br>
arrays -- gets fixed over and over and over again.  :(  Can you report<br>
which changeset you're on, and I'll push a fix?<br>
<br>
-Matt<br>
<br>
><br>
> Elizabeth<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>
><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>