[yt-svn] commit/yt-doc: sskory: Updating the Rockstar documentation.

Bitbucket commits-noreply at bitbucket.org
Mon Nov 26 10:05:18 PST 2012


1 new commit in yt-doc:


https://bitbucket.org/yt_analysis/yt-doc/changeset/249744befbb7/
changeset:   249744befbb7
user:        sskory
date:        2012-11-26 18:48:04
summary:     Updating the Rockstar documentation.
affected #:  1 file

diff -r ed2b2d6772c06e67fb40d7de0cd23d821136b240 -r 249744befbb764db4362ca494142637238223504 source/analysis_modules/running_halofinder.rst
--- a/source/analysis_modules/running_halofinder.rst
+++ b/source/analysis_modules/running_halofinder.rst
@@ -11,7 +11,10 @@
 Parallel HOP (` Skory et al. (2010) <http://adsabs.harvard.edu/abs/2010ApJS..191...43S>`_)
 is a true parallelization of the HOP method can analyze massive datasets on
 hundreds of processors.
-Finally Rockstar is a 6D-phase space halo finder developed by Peter Behroozi that excels in finding subhalos and substrcture, but does not allow multiple particle masses.
+Finally Rockstar (` Behroozi et a. (2011) <http://adsabs.harvard.edu/abs/2011arXiv1110.4372B>`_)
+is a 6D-phase space halo finder developed by Peter Behroozi
+that excels in finding subhalos and substrcture,
+but does not allow multiple particle masses.
 
 HOP
 ---
@@ -454,6 +457,7 @@
 =====================
 .. sectionauthor:: Matthew Turk <matthewturk at gmail.com>
 .. sectionauthor:: Christopher Erick Moody<cemoody at ucsc.edu>
+.. sectionauthor:: Stephen Skory <s at skory.us>
 
 Rockstar uses an adaptive hierarchical refinement of friends-of-friends 
 groups in six phase-space dimensions and one time dimension, which 
@@ -481,20 +485,18 @@
 
 .. code-block:: python
 
-  from mpi4py import MPI
   from yt.mods import *
   from yt.analysis_modules.halo_finding.rockstar.api import RockstarHaloFinder
 
   #find all of our simulation files
   files = glob.glob("Enzo_64/DD*/\*hierarchy")
   #hopefully the file name order is chronological
-  files.sort() 
-  ts = TimeSeriesData.from_filenames(files[:4])
-  #this is the particle mass in Msun
+  files.sort()
+  ts = TimeSeriesData.from_filenames(files[:])
+  # Need to supply the DM particle mass in Msun.
   pm = 7.81769027e+11
   rh = RockstarHaloFinder(ts, particle_mass=pm)
   rh.run()
-  print 'script finished'
 
 The script above configures the Halo finder, launches a server process which 
 disseminates run information and coordinates writer-reader processes. 
@@ -503,17 +505,24 @@
 content.
 
 The RockstarHaloFinder class has these options:
-  * ``particle_mass``, the fixed mass of the particles. 
-                       Cannot vary between particles.
+  * ``particle_mass``, the fixed mass of the particles.
+    Cannot vary between particles.
   * ``dm_type``, the index of the dark matter particle. Default is 1. 
-  * ``outbase``, the Rockstar output data directory. 
-                 Default is str(pf)+'_rockstar'
+  * ``outbase``, This is where the out*list files that Rockstar makes should be
+            placed. Default is 'rockstar_halos'.
   * ``num_readers``, the number of reader tasks (which are idle most of the 
                  time.) Default is 1.
   * ``num_writers``, the number of writer tasks (which are fed particles and
                 do most of the analysis). Default is MPI_TASKS-num_readers-1. 
                 If left undefined, the above options are automatically 
-                configured from the number of available MPI tasks. 
+                configured from the number of available MPI tasks.
+  * ``force_res``, the resolution that Rockstar uses for various calculations
+    and smoothing lengths. This is in units of Mpc/h.
+    If no value is provided, this parameter is automatically set to
+    the width of the smallest grid element in the simulation from the
+    last data snapshot (i.e. the one where time has evolved the
+    longest) in the time series:
+    ``pf_last.h.get_smallest_dx() * pf_last['mpch']``.
 
 Output Analysis
 ---------------
@@ -522,38 +531,109 @@
 out*list) and binary (halo*bin) files inside the ``outbase`` directory. 
 We use the halo list classes to recover the information. 
 
+Inside the ``outbase`` directory there is a text file named ``pfs.txt``
+that records the connection between pf names and the Rockstar file names.
+
 The halo list can be automatically generated from the RockstarHaloFinder 
 object by calling ``RockstarHaloFinder.halo_list()``. Alternatively, the halo
 lists can be built from the RockstarHaloList class directly 
-``RockstarHaloList(pf,''outbase/out_0.list')``.
+``LoadRockstarHalos(pf,''outbase/out_0.list')``.
 
 .. code-block:: python
     
     rh = RockstarHaloFinder(pf)
     #First method of creating the halo lists:
     halo_list = rh.halo_list()    
-    #Alternate method of creatin halo_list:
-    halo_list = RockstarHaloList(pf,str(pf)+'_rockstar/out_0.list')
-    most_massive_com = None
-    most_massive_mass = 0
-    for h in halo_list:
-        if h.Mvir > massive_mass:
-            most_massive_mass = h.Mvir
-            most_massive_com = h.CoM
+    #Alternate method of creating halo_list:
+    halo_list = LoadRockstarHalos(pf, 'rockstar_halos/out_0.list')
+
+The above ``halo_list`` is very similar to any other list of halos loaded off
+disk.
+It is possible to access particle data and use the halos in a manner like any
+other halo object, and the particle data is only loaded on demand.
+Additionally, each halo object has additional information attached that is
+pulled directly from the Rockstar output:
+
+.. code-block:: python
+
+    >>> halo_list[0].supp
+    Out[3]: 
+    {'J': array([ -6.15271728e+15,  -1.36593609e+17,  -7.80776865e+16], dtype=float32),
+     'bulkvel': array([-132.05046082,   11.53190422,   42.16183472], dtype=float32),
+     'child_r': 2.6411054,
+     'corevel': array([-132.05046082,   11.53190422,   42.16183472], dtype=float32),
+     'desc': 0,
+     'energy': -8.106986e+21,
+     'flags': 1,
+     'id': 166,
+     'm': 1.5341227e+15,
+     'mgrav': 1.5341227e+15,
+     'min_bulkvel_err': 1821.8152,
+     'min_pos_err': 0.00049575343,
+     'min_vel_err': 1821.8152,
+     'n_core': 1958,
+     'num_child_particles': 2764,
+     'num_p': 2409,
+     'p_start': 6540,
+     'pos': array([   0.20197368,    0.54656458,    0.11256824, -104.33285522,
+             29.02485085,   43.5154953 ], dtype=float32),
+     'r': 0.018403014,
+     'rs': 0.0026318002,
+     'rvmax': 1133.2,
+     'spin': 0.035755754,
+     'vmax': 1877.125,
+     'vrms': 1886.2648}
 
 Installation
 ------------
 
 The Rockstar is slightly patched and modified to run as a library inside of 
-yt. The repository for this project is located here 
-<https://bitbucket.org/MatthewTurk/rockstar>. The yt installation allows the 
-option to install and configure Rockstar appropriately, see :ref:`installing-yt`. 
+yt. By default it will be built with yt using the ``install_script.sh``.
+If it wasn't installed, please make sure that the installation setting
+``INST_ROCKSTAR=1`` is defined in the ``install_script.sh`` and re-run
+the installation script.
 
-If installed separately follow these steps:
-  * ``make lib``, inside the Rockstar directory to create librockstar.so. You
-    must set the ROCKSTAR_DIR and LD_LIBRARY_PATH so that yt knows where 
-    librockstar.so is.
-  * Run ``python setup.py build_ext -i``, to rebuild the yt source including
-    the Cython references to Rockstar
+Rockstar Inline with Enzo
+-------------------------
 
+It is possible to run Rockstar inline with Enzo. Setting up
+Enzo with inline yt is covered
+`here <http://enzo-project.org/doc/user_guide/EmbeddedPython.html>`_.
+It is not necessary to run Enzo with load balancing off to use Rockstar.
+Here is an example ``user_script.py``:
 
+.. code-block:: python
+
+    from yt.mods import *
+    from yt.analysis_modules.halo_finding.api import *
+    from yt.config import ytcfg
+    from yt.analysis_modules.halo_finding.rockstar.api import *
+    
+    def main():
+        import enzo
+        pf = EnzoStaticOutputInMemory()
+        mine = ytcfg.getint('yt','__topcomm_parallel_rank')
+        size = ytcfg.getint('yt','__topcomm_parallel_size')
+
+        # Get DM particle mass
+        all_fields = set(pf.h.derived_field_list + pf.h.field_list)
+        for g in pf.h.grids:
+            if g.proc_num == mine:
+                if 'particle_type' in all_fields:
+                    sel = g['particle_type'] == 1
+                else:
+                    sel = Ellipsis
+                pm = g['ParticleMassMsun'][sel][0]
+                break
+                
+        # Call rockstar.
+        ts = TimeSeriesData([pf])
+        outbase = "./rockstar_halos_%04d" % pf['NumberOfPythonTopGridCalls']
+        rh = RockstarHaloFinder(ts, num_readers = size, particle_mass=pm,
+            outbase = outbase)
+        rh.run()
+    
+        # Load the halos off disk.
+        fname = outbase + "/out_0.list"
+        rhalos = LoadRockstarHalos(pf, fname)
+

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