[yt-svn] commit/yt-doc: ngoldbaum: Adding a missing analysis script that seems to have gotten lost in the shuffle.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sun Nov 3 01:43:53 PDT 2013


1 new commit in yt-doc:

https://bitbucket.org/yt_analysis/yt-doc/commits/aa482e488174/
Changeset:   aa482e488174
User:        ngoldbaum
Date:        2013-11-03 09:43:46
Summary:     Adding a missing analysis script that seems to have gotten lost in the shuffle.
Affected #:  1 file

diff -r 2f36ada5fd6d606515244c61f13a80edaa9a3e6e -r aa482e4881748677e642ab64369bc601b2ad442e source/analyzing/ionization_cube.py
--- /dev/null
+++ b/source/analyzing/ionization_cube.py
@@ -0,0 +1,37 @@
+from yt.mods import *
+from yt.utilities.parallel_tools.parallel_analysis_interface \
+    import communication_system
+import h5py, glob, time
+
+ at derived_field(name = "IonizedHydrogen",
+               units = r"\frac{\rho_{HII}}{rho_H}")
+def IonizedHydrogen(field, data):
+    return data["HII_Density"]/(data["HI_Density"]+data["HII_Density"])
+
+ts = TimeSeriesData.from_filenames("SED800/DD*/*.hierarchy", parallel = 8)
+
+ionized_z = np.zeros(ts[0].domain_dimensions, dtype="float32")
+
+t1 = time.time()
+for pf in ts.piter():
+    z = pf.current_redshift
+    for g in parallel_objects(pf.h.grids, njobs = 16):
+        i1, j1, k1 = g.get_global_startindex() # Index into our domain
+        i2, j2, k2 = g.get_global_startindex() + g.ActiveDimensions
+        # Look for the newly ionized gas
+        newly_ion = ((g["IonizedHydrogen"] > 0.999)
+                   & (ionized_z[i1:i2,j1:j2,k1:k2] < z))
+        ionized_z[i1:i2,j1:j2,k1:k2][newly_ion] = z
+        g.clear_data()
+
+print "Iteration completed  %0.3e" % (time.time()-t1)
+comm = communication_system.communicators[-1]
+for i in range(ionized_z.shape[0]):
+    ionized_z[i,:,:] = comm.mpi_allreduce(ionized_z[i,:,:], op="max")
+    print "Slab % 3i has minimum z of %0.3e" % (i, ionized_z[i,:,:].max())
+t2 = time.time()
+print "Completed.  %0.3e" % (t2-t1)
+
+if comm.rank == 0:
+    f = h5py.File("IonizationCube.h5", "w")
+    f.create_dataset("/z", data=ionized_z)

Repository URL: https://bitbucket.org/yt_analysis/yt-doc/

--

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