Nathan Goldbaum avatar Nathan Goldbaum committed 5f6cac5

Adding some documentation for the new piter() functinality in TimeSeries.

Comments (0)

Files changed (1)

source/advanced/parallel_computation.rst

    all_files = glob.glob("DD*/output_*")
    all_files.sort()
    ts = TimeSeries.from_filenames(all_files, Parallel = True)
-   sphere = ts.sphere("max", (1.0, "pc))
+   sphere = ts.sphere("max", (1.0, "pc"))
    L_vecs = sphere.quantities["AngularMomentumVector"]()
 
 Note that this script can be run in serial or parallel with an arbitrary number
 processor.  By default, Parallel is set to ``True``, so you do not have to
 explicitly set ``Parallel = True`` as in the above example. 
 
+One could get the same effect by iterating over the individual parameter files
+in the TimeSeries object:
+
+.. code-block:: python
+
+   from yt.mods import *
+   all_files = glob.glob("DD*/output_*")
+   all_files.sort()
+   ts = TimeSeries.from_filenames(all_files, Parallel = True)
+   my_storage = {}
+   for sto,pf in ts.piter(storage=my_storage):
+	sphere = pf.h.sphere("max", (1.0, "pc"))
+	L_vec = sphere.quantities["AngularMomentumVector"]()
+	sto.result_id = pf.parameter_filename
+	sto.result = L_vec
+
+   L_vecs = []
+   for fn, L_vec in sorted(my_storage.items()):
+	L_vecs.append(L_vec)
+
+
 You can also request a fixed number of processors to calculate each
 angular momenum vector.  For example, this script will calculate each angular
 momentum vector using a workgroup of four processors.
 operation on each simulation output.  Some care and possibly trial and error
 might be necessary to estimate the correct settings for your Simulation
 outputs.
-   
 
 Parallel Performance, Resources, and Tuning
 -------------------------------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.