[yt-users] Index error while using covering_grid

Yang Haifeng hfyangpku at gmail.com
Sat Jan 17 12:16:01 PST 2015


Hi Nathan,

Here is the output of ds.print_stats(). I think it hasn't run off the edge
yet. The refine ratio is 2 and top grid is 64*3. ad_c["Density"] will not
produce any error.

2015-01-17 12:48 GMT-05:00 Nathan Goldbaum <nathan12343 at gmail.com>:

> Hi Haifeng,
>
> On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng <hy4px at virginia.edu> wrote:
>
>> Dear yt users,
>>
>> I am trying to make covering_grid from an enzo simulation. The code is
>> very simple: (somewhat sloppy since it's running with ipython. )
>>
>> ds=yt.load("data0201")
>>
>
> What is the output of "ds.print_stats()" for this dataset?  I'm wondering
> if your covering grid is running off the edge of the simulation domain.
>
>
>> ad_c=ds.covering_grid(level=3, left_edge=0.4375, dims=[64,64,64])
>> ad_c["x"]
>>
>> where the ad_c["x"] will give an Index Error on my desktop. However, the
>> same piece of code runs great in a different machine. The version of yt are
>> the same in both machines, which is 3.0.2. Both of them installed yt
>> through anaconda. The error message I got was following. Thanks for your
>> help!
>>
>>
>> ---------------------------------------------------------------------------
>> IndexError                                Traceback (most recent call
>> last)
>> <ipython-input-6-ff78a8bccc54> in <module>()
>> ----> 1 ad_c["x"]
>>
>> /home/fxyang/software/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc
>> in __getitem__(self, key)
>>     243             if f in self._container_fields:
>>     244                 self.field_data[f] = \
>> --> 245                     self.ds.arr(self._generate_container_field(f))
>>     246                 return self.field_data[f]
>>     247             else:
>>
>> /home/fxyang/software/anaconda/lib/python2.7/site-packages/yt/data_objects/construction_data_containers.pyc
>> in _generate_container_field(self, field)
>>     587             np.multiply(rv, self.dds[2], rv)
>>     588         elif field == ("index", "x"):
>> --> 589             x = np.mgrid[self.left_edge[0] + 0.5*self.dds[0]:
>>     590                          self.right_edge[0] - 0.5*self.dds[0]:
>>     591                          self.ActiveDimensions[0] * 1j]
>>
>> /home/fxyang/software/anaconda/lib/python2.7/site-packages/yt/units/yt_array.pyc
>> in __getitem__(self, item)
>>     981
>>     982     def __getitem__(self, item):
>> --> 983         ret = super(YTArray, self).__getitem__(item)
>>     984         if ret.shape == ():
>>     985             return YTQuantity(ret, self.units)
>>
>> IndexError: too many indices for array
>>
>>
>> --
>> Best,
>> Haifeng
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Best,
Haifeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150117/9589249b/attachment.htm>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list