[Yt-svn] commit/yt: sskory: Putting a band-aid on an apparent h5py bug.
Bitbucket
commits-noreply at bitbucket.org
Mon Apr 11 16:46:12 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/f838e8799489/
changeset: r4098:f838e8799489
branch: yt
user: sskory
date: 2011-04-12 01:45:53
summary: Putting a band-aid on an apparent h5py bug.
affected #: 1 file (212 bytes)
--- a/yt/analysis_modules/halo_finding/halo_objects.py Fri Apr 08 15:08:16 2011 -0600
+++ b/yt/analysis_modules/halo_finding/halo_objects.py Mon Apr 11 17:45:53 2011 -0600
@@ -856,7 +856,7 @@
# First get the list of fields from the first file. Not all fields
# are saved all the time (e.g. creation_time, particle_type).
mylog.info("Getting field %s from hdf5 halo particle files." % field)
- f = h5py.File(fnames[0])
+ f = h5py.File(fnames[0], 'r')
fields = f["Halo%08d" % halo].keys()
# If we dont have this field, we can give up right now.
if field not in fields: return None
@@ -866,14 +866,19 @@
else:
field_data = na.empty(size, dtype='float64')
f.close()
+ # Apparently, there's a bug in h5py that was keeping the file pointer
+ # f closed, even though it's re-opened below. This del seems to fix
+ # that.
+ del f
offset = 0
for fname in fnames:
- f = h5py.File(fname)
+ f = h5py.File(fname, 'r')
this = f["Halo%08d" % halo][field][:]
s = this.size
field_data[offset:offset+s] = this
offset += s
f.close()
+ del f
return field_data
def center_of_mass(self):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list