<br><br><div class="gmail_quote">On Tue, Oct 9, 2012 at 3:24 AM, <span dir="ltr"><<a href="mailto:yt-users-request@lists.spacepope.org" target="_blank">yt-users-request@lists.spacepope.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Send yt-users mailing list submissions to<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<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>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:yt-users-request@lists.spacepope.org">yt-users-request@lists.spacepope.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:yt-users-owner@lists.spacepope.org">yt-users-owner@lists.spacepope.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of yt-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Error when open hdf5 file in yt (Chao Shi)<br>
2. Re: Error when open hdf5 file in yt (Geoffrey So)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 8 Oct 2012 23:23:14 -0400<br>
From: Chao Shi <<a href="mailto:shichao116@gmail.com">shichao116@gmail.com</a>><br>
To: <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
Subject: [yt-users] Error when open hdf5 file in yt<br>
Message-ID:<br>
<<a href="mailto:CA%2BP3%2Bn_qhLFa-dwUcOYt%2BWWp_RcqAvjZj_BCYhAJP3HDpZUZYA@mail.gmail.com">CA+P3+n_qhLFa-dwUcOYt+WWp_RcqAvjZj_BCYhAJP3HDpZUZYA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi all,<br>
<br>
I'm trying to modify the particle_type of some particles in a hdf5 data<br>
file extract0062.cpu0000 in yt, typing the following command:<br>
<br>
for g in pf.h.grids:<br>
lbhs =<br>
np.logical_and(np.logical_and(g['particle_type']==1,g['particle_index']>=256**3),g['ParticleMassMsun']>1)<br>
# These two lines are to pick out<br>
bhs = np.where(lbhs)[0]<br>
<br>
# particles that I wanted to modify<br>
if(np.any(g['particle_type'])):<br>
g['particle_type'][bhs]=9<br>
f=h5py.File(g.filename)<br>
ff = f['/Grid%08i'%<a href="http://g.id" target="_blank">g.id</a>]['particle_type']<br>
ff.write_direct(g['particle_type'])<br>
f.close()<br>
<br>
It spited out following error information:<br>
<br>
ReadingError Traceback (most recent call last)<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/mods.pyc in <module>()<br>
1 for g in pf.h.grids:<br>
----> 2 lbhs =<br>
np.logical_and(np.logical_and(g['particle_type']==1,g['particle_index']>=256**3),g['ParticleMassMsun']>1)<br>
3 bhs = np.where(lbhs)[0]<br>
4 if(np.any(g['particle_type'])):<br>
5 g['particle_type'][bhs]=9<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
__getitem__(self, key)<br>
155 """<br>
156 if not self.field_data.has_key(key):<br>
--> 157 self.get_data(key)<br>
158 return self.field_data[key]<br>
159<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
get_data(self, field, convert)<br>
188 return self.field_data[field]<br>
189 try:<br>
--> 190 temp = self.hierarchy.io.pop(self, field)<br>
191 self[field] = na.multiply(temp, conv_factor,<br>
temp)<br>
192 except self.hierarchy.io._read_exception, exc:<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/utilities/io_handler.pyc in pop(self,<br>
grid, field)<br>
59 else:<br>
60 # We only read the one set and do not store it if it<br>
isn't pre-loaded<br>
---> 61 return self._read_data_set(grid, field)<br>
62<br>
63 def peek(self, grid, field):<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/frontends/enzo/io.pyc in<br>
_read_data_set(self, grid, field)<br>
183 def _read_data_set(self, grid, field):<br>
184 return self.modify(hdf5_light_reader.ReadData(grid.filename,<br>
--> 185 "/Grid%08i/%s" % (<a href="http://grid.id" target="_blank">grid.id</a>, field)))<br>
186<br>
187 def _read_data_slice(self, grid, field, axis, coord):<br>
<br>
ReadingError: ReadHDF5DataSet: Unable to open<br>
/home/cshi31/research/SG256-RP/extract0062<br>
<br>
<br>
So I tried to look where the loop stopped, typed g in the command:<br>
<br>
In [37]: g<br>
Out[37]: EnzoGrid_0056<br>
<br>
so it stopped at the 56th grid in that file. I tried to see what particles<br>
is contained in this grid, typing g['particle_type'],<br>
it turned out this is what caused the problem:<br>
<br>
<br>
In [31]: g['particle_type']<br>
---------------------------------------------------------------------------<br>
ReadingError Traceback (most recent call last)<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/mods.pyc in <module>()<br>
----> 1 g['particle_type']<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
__getitem__(self, key)<br>
155 """<br>
156 if not self.field_data.has_key(key):<br>
--> 157 self.get_data(key)<br>
158 return self.field_data[key]<br>
159<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
get_data(self, field, convert)<br>
188 return self.field_data[field]<br>
189 try:<br>
--> 190 temp = self.hierarchy.io.pop(self, field)<br>
191 self[field] = na.multiply(temp, conv_factor,<br>
temp)<br>
192 except self.hierarchy.io._read_exception, exc:<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/utilities/io_handler.pyc in pop(self,<br>
grid, field)<br>
59 else:<br>
60 # We only read the one set and do not store it if it<br>
isn't pre-loaded<br>
---> 61 return self._read_data_set(grid, field)<br>
62<br>
63 def peek(self, grid, field):<br>
<br>
/home/cshi31/yt-x86_64/src/yt-hg/yt/frontends/enzo/io.pyc in<br>
_read_data_set(self, grid, field)<br>
183 def _read_data_set(self, grid, field):<br>
184 return self.modify(hdf5_light_reader.ReadData(grid.filename,<br>
--> 185 "/Grid%08i/%s" % (<a href="http://grid.id" target="_blank">grid.id</a>, field)))<br>
186<br>
187 def _read_data_slice(self, grid, field, axis, coord):<br>
<br>
ReadingError: ReadHDF5DataSet: Unable to open<br>
/home/cshi31/research/SG256-RP/extract0062.cpu0000<br>
<br>
Can anyone help me on this? Thanks very much.<br>
<br>
Chao<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121008/3a35a77d/attachment-0001.htm" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121008/3a35a77d/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 9 Oct 2012 00:19:02 -0700<br>
From: Geoffrey So <<a href="mailto:gsiisg@gmail.com">gsiisg@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
<<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] Error when open hdf5 file in yt<br>
Message-ID:<br>
<CAM-dO+Cao3ftggx9J6tZkyiAsQ=<a href="mailto:6g5y1nZNh3CvTdkApAOhjjg@mail.gmail.com">6g5y1nZNh3CvTdkApAOhjjg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Is this an Enzo sim? It is conceivable to have no particles in that grid.<br>
I've seen others encounter some grids where the hdf5 file is missing<br>
Dark_Matter_Density field because there were no DM particles in that<br>
particular grid.<br>
<br>
You can confirm if the particle_type or Dark_Matter_Density field is<br>
missing by typing<br>
>h5ls extract0062.cpu####/Grid######## where the #'s correspond to the file<br>
number which has the EnzoGrid_0056<br>
From<br>
G.S.<br>
On Mon, Oct 8, 2012 at 8:23 PM, Chao Shi <<a href="mailto:shichao116@gmail.com">shichao116@gmail.com</a>> wrote:<br></blockquote><div><br></div><div>Hi G.S., thanks for the reply. There's no Dark_Matter_Density field in this grid as</div>
<div>well as all others. But also, there're two elements in the particle attributes in </div><div>EnzoGrid_0056 when I used h5ls to inspect. It's wired why yt can't load it. And I</div><div>have encountered grid that has no particles in it, in which case yt just returned </div>
<div>an empty array but didn't give any error.</div><div><br></div><div>Thanks,</div><div><br></div><div>Chao</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> Hi all,<br>
><br>
> I'm trying to modify the particle_type of some particles in a hdf5 data<br>
> file extract0062.cpu0000 in yt, typing the following command:<br>
><br>
> for g in pf.h.grids:<br>
> lbhs =<br>
> np.logical_and(np.logical_and(g['particle_type']==1,g['particle_index']>=256**3),g['ParticleMassMsun']>1)<br>
> # These two lines are to pick out<br>
> bhs = np.where(lbhs)[0]<br>
><br>
> # particles that I wanted to modify<br>
> if(np.any(g['particle_type'])):<br>
> g['particle_type'][bhs]=9<br>
> f=h5py.File(g.filename)<br>
> ff = f['/Grid%08i'%<a href="http://g.id" target="_blank">g.id</a>]['particle_type']<br>
> ff.write_direct(g['particle_type'])<br>
> f.close()<br>
><br>
> It spited out following error information:<br>
><br>
> ReadingError Traceback (most recent call last)<br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/mods.pyc in <module>()<br>
> 1 for g in pf.h.grids:<br>
> ----> 2 lbhs =<br>
> np.logical_and(np.logical_and(g['particle_type']==1,g['particle_index']>=256**3),g['ParticleMassMsun']>1)<br>
> 3 bhs = np.where(lbhs)[0]<br>
> 4 if(np.any(g['particle_type'])):<br>
> 5 g['particle_type'][bhs]=9<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> __getitem__(self, key)<br>
> 155 """<br>
> 156 if not self.field_data.has_key(key):<br>
> --> 157 self.get_data(key)<br>
> 158 return self.field_data[key]<br>
> 159<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> get_data(self, field, convert)<br>
> 188 return self.field_data[field]<br>
> 189 try:<br>
> --> 190 temp = self.hierarchy.io.pop(self, field)<br>
> 191 self[field] = na.multiply(temp, conv_factor,<br>
> temp)<br>
> 192 except self.hierarchy.io._read_exception, exc:<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/utilities/io_handler.pyc in pop(self,<br>
> grid, field)<br>
> 59 else:<br>
> 60 # We only read the one set and do not store it if it<br>
> isn't pre-loaded<br>
> ---> 61 return self._read_data_set(grid, field)<br>
> 62<br>
> 63 def peek(self, grid, field):<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/frontends/enzo/io.pyc in<br>
> _read_data_set(self, grid, field)<br>
> 183 def _read_data_set(self, grid, field):<br>
> 184 return<br>
> self.modify(hdf5_light_reader.ReadData(grid.filename,<br>
> --> 185 "/Grid%08i/%s" % (<a href="http://grid.id" target="_blank">grid.id</a>, field)))<br>
> 186<br>
> 187 def _read_data_slice(self, grid, field, axis, coord):<br>
><br>
> ReadingError: ReadHDF5DataSet: Unable to open<br>
> /home/cshi31/research/SG256-RP/extract0062<br>
><br>
><br>
> So I tried to look where the loop stopped, typed g in the command:<br>
><br>
> In [37]: g<br>
> Out[37]: EnzoGrid_0056<br>
><br>
> so it stopped at the 56th grid in that file. I tried to see what particles<br>
> is contained in this grid, typing g['particle_type'],<br>
> it turned out this is what caused the problem:<br>
><br>
><br>
> In [31]: g['particle_type']<br>
> ---------------------------------------------------------------------------<br>
> ReadingError Traceback (most recent call last)<br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/mods.pyc in <module>()<br>
> ----> 1 g['particle_type']<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> __getitem__(self, key)<br>
> 155 """<br>
> 156 if not self.field_data.has_key(key):<br>
> --> 157 self.get_data(key)<br>
> 158 return self.field_data[key]<br>
> 159<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in<br>
> get_data(self, field, convert)<br>
> 188 return self.field_data[field]<br>
> 189 try:<br>
> --> 190 temp = self.hierarchy.io.pop(self, field)<br>
> 191 self[field] = na.multiply(temp, conv_factor,<br>
> temp)<br>
> 192 except self.hierarchy.io._read_exception, exc:<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/utilities/io_handler.pyc in pop(self,<br>
> grid, field)<br>
> 59 else:<br>
> 60 # We only read the one set and do not store it if it<br>
> isn't pre-loaded<br>
> ---> 61 return self._read_data_set(grid, field)<br>
> 62<br>
> 63 def peek(self, grid, field):<br>
><br>
> /home/cshi31/yt-x86_64/src/yt-hg/yt/frontends/enzo/io.pyc in<br>
> _read_data_set(self, grid, field)<br>
> 183 def _read_data_set(self, grid, field):<br>
> 184 return<br>
> self.modify(hdf5_light_reader.ReadData(grid.filename,<br>
> --> 185 "/Grid%08i/%s" % (<a href="http://grid.id" target="_blank">grid.id</a>, field)))<br>
> 186<br>
> 187 def _read_data_slice(self, grid, field, axis, coord):<br>
><br>
> ReadingError: ReadHDF5DataSet: Unable to open<br>
> /home/cshi31/research/SG256-RP/extract0062.cpu0000<br>
><br>
> Can anyone help me on this? Thanks very much.<br>
><br>
> Chao<br>
><br>
><br>
><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>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121009/fcea5970/attachment.htm" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121009/fcea5970/attachment.htm</a>><br>
<br>
------------------------------<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>
End of yt-users Digest, Vol 56, Issue 12<br>
****************************************<br>
</blockquote></div><br>