[Yt-svn] commit/yt: brittonsmith: Added use_log keyword option to virial filter to do interpolation

Bitbucket commits-noreply at bitbucket.org
Fri Apr 15 12:38:51 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/2e218b6d4813/
changeset:   r4137:2e218b6d4813
branch:      yt
user:        brittonsmith
date:        2011-04-15 21:38:41
summary:     Added use_log keyword option to virial filter to do interpolation
in log space.
affected #:  1 file (1.3 KB)

--- a/yt/analysis_modules/halo_profiler/halo_filters.py	Fri Apr 15 14:52:04 2011 -0400
+++ b/yt/analysis_modules/halo_profiler/halo_filters.py	Fri Apr 15 15:38:41 2011 -0400
@@ -32,7 +32,7 @@
                  virial_overdensity=200., must_be_virialized=True,
                  virial_filters=[['TotalMassMsun', '>=','1e14']],
                  virial_quantities=['TotalMassMsun', 'RadiusMpc'],
-                 virial_index=None):
+                 virial_index=None, use_log=False):
     """
     Filter halos by virial quantities.
     Return values are a True or False whether the halo passed the filter, 
@@ -40,6 +40,23 @@
     the virial_quantities keyword.  Thresholds for virial quantities are 
     given with the virial_filters keyword in the following way: 
     [field, condition, value].
+    :param: overdensity_field (str): the field used for interpolation with the 
+    specified critical value given with 'virial_overdensity'.  
+    Default: 'ActualOverdensity'.
+    :param: virial_overdensity (flt): the value used for interpolation.  
+    Default: 200.[['TotalMassMsun', '>=','1e14']]
+    :param: must_be_virialized (bool): if no values in the profile are above the 
+    value of virial_overdensity, the halo does not pass the filter.  
+    Default: True.
+    :param: virial_filters (list): conditional filters based on virial quantities 
+    given in the following way: [field, condition, value].  
+    Default: [['TotalMassMsun', '>=','1e14']].
+    :param: virial_quantities (list): fields for which interpolated values should 
+    be calculated and returned.  Default: ['TotalMassMsun', 'RadiusMpc'].
+    :param: virial_index (list): if given as a list, the index of the radial profile 
+    which is used for interpolation is placed here.  Default: None.
+    :param: use_log (bool): if True, interpolation is done in log space.  
+    Default: False.
     """
 
     fields = deepcopy(virial_quantities)
@@ -65,6 +82,10 @@
             for field in fields:
                 temp_profile[field].append(profile[field][q])
 
+    if use_log:
+        for field in temp_profile.keys():
+            temp_profile[field] = na.log10(temp_profile[field])
+
     virial = dict((field, 0.0) for field in fields)
 
     if (not (na.array(overDensity) >= virial_overdensity).any()) and \
@@ -100,6 +121,10 @@
                 temp_profile[field][index]
             virial[field] = value
 
+    if use_log:
+        for field in virial.keys():
+            virial[field] = na.power(10, virial[field])
+
     for vfilter in virial_filters:
         if eval("%s %s %s" % (virial[vfilter[0]],vfilter[1],vfilter[2])):
             mylog.debug("(%s %s %s) returned True for %s." % \

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