Index error while using covering_grid
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") 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
Hi Haifeng,
On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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
Hi Haifeng,
On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Best, Haifeng _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Sorry, forgot the output:
level # grids # cells # cells^3
----------------------------------------------
0 1 262144 64
1 1 24576 30
2 1 38720 34
3 1 98304 47
4 1 147456 53
5 1 327680 69
6 1 269120 65
7 1 403200 74
8 1 645504 87
----------------------------------------------
9 2216704
t = 1.06267789e-01 = 1.14972625e+12 s = 3.64326264e+04 years
Smallest Cell:
Width: 9.890e-12 Mpc
Width: 9.890e-06 pc
Width: 2.040e+00 AU
Width: 3.052e+13 cm
2015-01-17 15:16 GMT-05:00 Yang Haifeng
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
: Hi Haifeng,
On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Best, Haifeng
-- Best, Haifeng _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
On Sat, Jan 17, 2015 at 12:16 PM, Yang Haifeng
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
: Hi Haifeng,
On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng
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])
Ah, I see what's wrong now. This should be left_edge=[0.4375, 0.4375, 0.4375] (or some other 3-tuple).
I've gone ahead and added some basic input handling code for the covering_grid constructor, so future users will get a less confusing error message: https://bitbucket.org/yt_analysis/yt/pull-request/1414/add-some-input-saniti...
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Best, Haifeng
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Thanks!
2015-01-17 15:47 GMT-05:00 Nathan Goldbaum
On Sat, Jan 17, 2015 at 12:16 PM, Yang Haifeng
wrote: 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
: Hi Haifeng,
On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng
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])
Ah, I see what's wrong now. This should be left_edge=[0.4375, 0.4375, 0.4375] (or some other 3-tuple).
I've gone ahead and added some basic input handling code for the covering_grid constructor, so future users will get a less confusing error message:
https://bitbucket.org/yt_analysis/yt/pull-request/1414/add-some-input-saniti...
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Best, Haifeng
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Best, Haifeng _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Nathan Goldbaum
-
Yang Haifeng
-
Yang Haifeng