[Yt-svn] yt: 2 new changesets

hg at spacepope.org hg at spacepope.org
Mon Jan 24 13:22:47 PST 2011


hg Repository: yt
details:   yt/rev/a0a46227e840
changeset: 3687:a0a46227e840
user:      John Wise <jwise at astro.princeton.edu>
date:
Mon Jan 17 17:12:47 2011 -0500
description:
Adding a function to the EnzoFOF class to find the most massive
progenitors from the halo relationships.

hg Repository: yt
details:   yt/rev/e77d851f122f
changeset: 3688:e77d851f122f
user:      John Wise <jwise at astro.princeton.edu>
date:
Mon Jan 24 13:42:37 2011 -0500
description:
Added a constraint of a minimum relationship between halos when
constructing the merger tree.

diffstat:

 yt/analysis_modules/halo_merger_tree/enzofof_merger_tree.py |  42 ++++++++++++-
 1 files changed, 40 insertions(+), 2 deletions(-)

diffs (66 lines):

diff -r 801c166a7ddc -r e77d851f122f yt/analysis_modules/halo_merger_tree/enzofof_merger_tree.py
--- a/yt/analysis_modules/halo_merger_tree/enzofof_merger_tree.py	Mon Jan 24 14:41:18 2011 -0500
+++ b/yt/analysis_modules/halo_merger_tree/enzofof_merger_tree.py	Mon Jan 24 13:42:37 2011 -0500
@@ -171,7 +171,8 @@
         return of_child_from_me, of_mine_from_me
 
 class EnzoFOFMergerBranch(object):
-    def __init__(self, tree, output_num, halo_id, max_children):
+    def __init__(self, tree, output_num, halo_id, max_children,
+                 min_relation=0.25):
         self.output_num = output_num
         self.halo_id = halo_id
         self.npart = tree.relationships[output_num][halo_id]["NumberOfParticles"]
@@ -183,7 +184,7 @@
         for k in sorted_keys:
             if not str(k).isdigit(): continue
             v = tree.relationships[output_num][halo_id][k]
-            if v[1] != 0.0 and halo_count < max_children:
+            if v[1] > min_relation and halo_count < max_children:
                 halo_count += 1
                 self.children.append((k,v[1],v[2]))
                 if v[1] > max_relationship:
@@ -324,6 +325,43 @@
                     this_halos.append(c[0])
             self.filter_small_halos(this, min_particles)
 
+    def get_massive_progenitors(self, halonum, min_relation=0.25):
+        r"""Returns a list of the most massive progenitor halos.
+
+        This routine walks down the tree, following the most massive
+        progenitor on each node.
+
+        Parameters
+        ----------
+        halonum : int
+            Halo number at the last output to trace.
+
+        Output
+        ------
+        output : dict
+            Dictionary of redshifts, cycle numbers, and halo numbers
+            of the most massive progenitor.  keys = {redshift, cycle,
+            halonum}
+        """
+        output = {"redshift": [], "cycle": [], "halonum": []}
+        # First (lowest redshift) node in tree
+        halo0 = halonum
+        for cycle in sorted(self.numbers, reverse=True):
+            if cycle not in self.relationships: break
+            if halo0 not in self.relationships[cycle]: break
+            node = self.relationships[cycle][halo0]
+            output["redshift"].append(self.redshifts[cycle])
+            output["cycle"].append(cycle)
+            output["halonum"].append(halo0)
+            # Find progenitor
+            max_rel = 0.0
+            for k,v in node.items():
+                if not str(k).isdigit(): continue
+                if v[1] > max_rel and v[1] > min_relation:
+                    halo0 = k
+                    max_rel = v[1]
+        return output
+
     def print_tree(self):
         r"""Prints the merger tree to stdout.
         """



More information about the yt-svn mailing list