[yt-svn] commit/yt: MatthewTurk: Allowing the file passed to extract_isocontours to also be a file-like object.
Bitbucket
commits-noreply at bitbucket.org
Thu Nov 29 15:54:29 PST 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/17ae6611e6b0/
changeset: 17ae6611e6b0
branch: yt
user: MatthewTurk
date: 2012-11-30 00:54:21
summary: Allowing the file passed to extract_isocontours to also be a file-like object.
affected #: 1 file
diff -r 2ced9ee17d7c936c47c3b803fb156b29605091f8 -r 17ae6611e6b07714e812d2e2be6b5954927be1fe yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -2777,12 +2777,12 @@
ma = np.max(verts, axis=0)
verts = (verts - mi) / (ma - mi).max()
if filename is not None and self.comm.rank == 0:
- f = open(filename, "w")
+ if hasattr(filename, "write"): f = filename
for v1 in verts:
f.write("v %0.16e %0.16e %0.16e\n" % (v1[0], v1[1], v1[2]))
for i in range(len(verts)/3):
f.write("f %s %s %s\n" % (i*3+1, i*3+2, i*3+3))
- f.close()
+ if not hasattr(filename, "write"): f.close()
if sample_values is not None:
return verts, samples
return verts
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