[Yt-svn] yt-commit r1515 - trunk/yt/extensions

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Tue Nov 3 15:38:55 PST 2009


Author: britton
Date: Tue Nov  3 15:38:53 2009
New Revision: 1515
URL: http://yt.enzotools.org/changeset/1515

Log:
Added docstrings to EnzoSimulation and HaloProfiler.


Modified:
   trunk/yt/extensions/EnzoSimulation.py
   trunk/yt/extensions/HaloProfiler.py

Modified: trunk/yt/extensions/EnzoSimulation.py
==============================================================================
--- trunk/yt/extensions/EnzoSimulation.py	(original)
+++ trunk/yt/extensions/EnzoSimulation.py	Tue Nov  3 15:38:53 2009
@@ -11,6 +11,24 @@
     """
     def __init__(self, EnzoParameterFile, initial_time=None, final_time=None, initial_redshift=None, final_redshift=None,
                  links=False, enzo_parameters=None, get_time_outputs=True, get_redshift_outputs=True):
+        """
+        Initialize an EnzoSimulation object.
+        :param initial_time (float): the initial time in code units for the dataset list.  Default: None.
+        :param final_time (float): the final time in code units for the dataset list.  Default: None.
+        :param initial_redshift (float): the initial (highest) redshift for the dataset list.  Only for 
+               cosmological simulations.  Default: None.
+        :param final_redshift (float): the final (lowest) redshift for the dataset list.  Only for cosmological 
+               simulations.  Default: None.
+        :param links (bool): if True, each entry in the dataset list will contain entries, previous and next, that 
+               point to the previous and next entries on the dataset list.  Default: False.
+        :param enzo_parameters (dict): a dictionary specify additional parameters to be retrieved from the 
+               parameter file.  The format should be the name of the parameter as the key and the variable type as 
+               the value.  For example, {'CosmologyComovingBoxSize':float}.  All parameter values will be stored in 
+               the dictionary attribute, enzoParameters.  Default: None.
+        :param get_time_outputs (bool): if False, the time datasets, specified in Enzo with the dtDataDump, will not 
+               be added to the dataset list.  Default: True.
+        :param get_redshift_outputs (bool): if False, the redshift datasets will not be added to the dataset list.  Default: True.
+        """
         self.EnzoParameterFile = EnzoParameterFile
         self.enzoParameters = {}
         self.redshiftOutputs = []
@@ -212,7 +230,17 @@
 
     def imagine_minimal_splice(self, initial_redshift, final_redshift, decimals=3, filename=None, 
                                redshift_output_string='CosmologyOutputRedshift', start_index=0):
-        "Create imaginary list of redshift outputs to maximally span a redshift interval."
+        """
+        Create imaginary list of redshift outputs to maximally span a redshift interval.
+        :param decimals (int): The decimal place to which the output redshift will be rounded.  
+               If the decimal place in question is nonzero, the redshift will be rounded up to 
+               ensure continuity of the splice.  Default: 3.
+        :param filename (str): If provided, a file will be written with the redshift outputs in 
+               the form in which they should be given in the enzo parameter file.  Default: None.
+        :param redshift_output_string (str): The parameter accompanying the redshift outputs in the 
+               enzo parameter file.  Default: "CosmologyOutputRedshift".
+        :param start_index (int): The index of the first redshift output.  Default: 0.
+        """
 
         z = initial_redshift
         outputs = []
@@ -239,8 +267,19 @@
 
         return outputs
 
-    def _create_cosmology_splice(self, minimal=True, deltaz_min=0.0, initial_redshift=None, final_redshift=None):
-        "Create list of datasets to be used for LightCones or LightRays."
+    def create_cosmology_splice(self, minimal=True, deltaz_min=0.0, initial_redshift=None, final_redshift=None):
+        """
+        Create list of datasets to be used for LightCones or LightRays.
+        :param minimal (bool): if True, the minimum number of datasets is used to connect the initial and final 
+               redshift.  If false, the list will contain as many entries as possible within the redshift 
+               interval.  Default: True.
+        :param deltaz_min (float): specifies the minimum delta z between consecutive datasets in the returned 
+               list.  Default: 0.0.
+        :param initial_redshift (float): the initial (highest) redshift in the cosmology splice list.  If none 
+               given, the highest redshift dataset present will be used.  Default: None.
+        :param final_redshift (float): the final (lowest) redshift in the cosmology splice list.  If none given, 
+               the lowest redshift dataset present will be used.  Default: None.
+        """
 
         if initial_redshift is None: initial_redshift = self.InitialRedshift
         if final_redshift is None: final_redshift = self.FinalRedshift

Modified: trunk/yt/extensions/HaloProfiler.py
==============================================================================
--- trunk/yt/extensions/HaloProfiler.py	(original)
+++ trunk/yt/extensions/HaloProfiler.py	Tue Nov  3 15:38:53 2009
@@ -36,6 +36,7 @@
 PROFILE_RADIUS_THRESHOLD = 2
 
 class HaloProfiler(lagos.ParallelAnalysisInterface):
+    "Radial profiling, filtering, and projections for halos in cosmological simulations."
     def __init__(self, dataset, halos='multiple', halo_list_file='HopAnalysis.out', halo_list_format='yt_hop',
                  halo_finder_function=HaloFinder, halo_finder_args=None, halo_finder_kwargs=None,
                  use_density_center=False, density_center_exponent=1.0, use_field_max_center=None,
@@ -43,6 +44,56 @@
                  profile_output_dir='radial_profiles', projection_output_dir='projections',
                  projection_width=8.0, projection_width_units='mpc', project_at_level='max',
                  velocity_center=['bulk', 'halo'], filter_quantities=['id','center']):
+        """
+        Initialize a HaloProfiler object.
+        :param halos (str): "multiple" for profiling more than one halo.  In this mode halos are read in 
+               from a list or identified with a halo finder.  In "single" mode, the one and only halo 
+               center is identified automatically as the location of the peak in the density field.  
+               Default: "multiple".
+        :param halo_list_file (str): name of file containing the list of halos.  The HaloProfiler will 
+               look for this file in the data directory.  Default: "HopAnalysis.out".
+        :param halo_list_format (str or dict): the format of the halo list file.  "yt_hop" for the format 
+               given by yt's halo finders.  "enzo_hop" for the format written by enzo_hop.  This keyword 
+               can also be given in the form of a dictionary specifying the column in which various 
+               properties can be found.  For example, {"id": 0, "center": [1, 2, 3], "mass": 4, "radius": 5}.  
+               Default: "yt_hop".
+        :param halo_finder_function (function): If halos is set to multiple and the file given by 
+               halo_list_file does not exit, the halo finding function specified here will be called.  
+               Default: HaloFinder (yt_hop).
+        :param halo_finder_args (tuple): args given with call to halo finder function.  Default: None.
+        :param halo_finder_kwargs (dict): kwargs given with call to halo finder function. Default: None.
+        :param use_density_center (bool): re-center halos before performing profiles with an center of mass 
+               weighted by overdensity.  This is generally not needed.  Default: False.
+        :param density_center_exponent (float): when use_density_center set to True, this specifies the 
+               exponent, alpha, such that the halo center calculation is weighted by overdensity^alpha.  
+               Default: 1.0.
+        :param use_field_max_center (str): another alternative for halo re-centering by selecting the 
+               location of the maximum of the field given by this keyword.  This is generally not needed.  
+               Default: None.
+        :param halo_radius (float): if no halo radii are provided in the halo list file, this parameter is 
+               used to specify the radius out to which radial profiles will be made.  This keyword is also 
+               used when halos is set to single.  Default: 0.1.
+        :param radius_units (str): the units of halo_radius.  Default: "1" (code units).
+        :param n_profile_bins (int): the number of bins in the radial profiles.  Default: 50.
+        :param profile_output_dir (str): the subdirectory, inside the data directory, in which radial profile 
+               output files will be created.  The directory will be created if it does not exist.  
+               Default: "radial_profiles".
+        :param projection_output_dir (str): the subdirectory, inside the data directory, in which projection 
+               output files will be created.  The directory will be created if it does not exist.  
+               Default: "projections".
+        :param projection_width (float): the width of halo projections.  Default: 8.0.
+        :param projection_width_units (str): the units of projection_width. Default: "mpc".
+        :param project_at_level (int or "max"): the maximum refinement level to be included in projections.  
+               Default: "max" (maximum level within the dataset).
+        :param velocity_center (list): the method in which the halo bulk velocity is calculated (used for 
+               calculation of radial and tangential velocities.  Valid options are:
+     	          - ["bulk", "halo"] (Default): the velocity provided in the halo list
+                  - ["bulk", "sphere"]: the bulk velocity of the sphere centered on the halo center.
+    	          - ["max", field]: the velocity of the cell that is the location of the maximum of the field 
+                                    specified (used only when halos set to single).
+        :param filter_quantities (list): quantities from the original halo list file to be written out in the 
+               filtered list file.  Default: ['id','center'].
+        """
 
         self.dataset = dataset
 
@@ -190,7 +241,7 @@
         # If a lower mass cutoff is being used, use it to make a pre-filter.
         if prefilters is None: prefilters = []
         virial_prefilter = None
-        virial_prefilter_safety_factor = 0.1
+        virial_prefilter_safety_factor = 0.5
         all_filter_functions = [hf['function'] for hf in self._halo_filters]
         virial_filter = VirialFilter in all_filter_functions
         if 'mass' in self.halo_list_format and VirialFilter in all_filter_functions:



More information about the yt-svn mailing list