[Yt-svn] commit/yt-doc: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Jun 1 16:52:07 PDT 2011


2 new changesets in yt-doc:

http://bitbucket.org/yt_analysis/yt-doc/changeset/9707fa5c508c/
changeset:   9707fa5c508c
branches:    
user:        MatthewTurk
date:        2011-06-02 01:49:16
summary:     Fixing dt->dts in the docs.  Thanks, Casey!
affected #:  1 file (1 byte)

--- a/source/analyzing/generating_processed_data.rst	Wed Apr 06 15:18:27 2011 -0400
+++ b/source/analyzing/generating_processed_data.rst	Wed Jun 01 19:49:16 2011 -0400
@@ -167,7 +167,7 @@
 
 .. code-block:: python
 
-   print ray['dt'].sum()
+   print ray['dts'].sum()
    print ray['t']
 
 These can be used as inputs to, for instance, the Matplotlib function


http://bitbucket.org/yt_analysis/yt-doc/changeset/4c3a85c0ad17/
changeset:   4c3a85c0ad17
branches:    
user:        MatthewTurk
date:        2011-06-02 01:49:23
summary:     Merging
affected #:  2 files (4.4 KB)

--- a/source/analysis_modules/halo_profiling.rst	Wed Jun 01 19:49:16 2011 -0400
+++ b/source/analysis_modules/halo_profiling.rst	Wed Jun 01 19:49:23 2011 -0400
@@ -2,7 +2,8 @@
 
 Halo Profiling
 ==============
-.. sectionauthor:: Britton Smith <britton.smith at colorado.edu>
+.. sectionauthor:: Britton Smith <britton.smith at colorado.edu>,
+   Stephen Skory <s at skory.us>
 
 The halo profiler provides a means of performing analysis on multiple points in a dataset at 
 once.  This is primarily intended for use with cosmological simulations, in which  
@@ -29,50 +30,91 @@
 Most of the halo profiler's options are configured with keyword arguments given at 
 instantiation.  These options are:
 
- * **output_dir** (*str*): if specified, all output will be put into this path instead of in the dataset directories.  Default: None.
+ * **output_dir** (*str*): if specified, all output will be put into this path
+   instead of in the dataset directories.  Default: None.
 
- * **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 <../cookbook/running_halofinder.html>`_.  In "single" mode, the one and only halo center is identified automatically as the location of the peak in the density field.  Default: "multiple".
+ * **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 <../cookbook/running_halofinder.html>`_.  In "single" mode, the
+   one and only halo center is identified automatically as the location of the
+   peak in the density field.  Default: "multiple".
 
- * **halo_list_file** (*str*): name of file containing the list of halos.  The halo profiler will look for this file in the data directory.  Default: "HopAnalysis.out".
+ * **halo_list_file** (*str*): name of file containing the list of halos.
+   The halo profiler will look for this file in the data directory.
+   Default: "HopAnalysis.out".
 
- * **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".
+ * **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".
 
- * **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).
+ * **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).
 
- * **halo_finder_args** (*tuple*): args given with call to halo finder function.  Default: None.
+ * **halo_finder_args** (*tuple*): args given with call to halo finder function.
+   Default: None.
 
- * **halo_finder_kwargs** (*dict*): kwargs given with call to halo finder function. Default: None.
+ * **halo_finder_kwargs** (*dict*): kwargs given with call to halo finder
+   function. Default: None.
 
- * **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.
+ * **recenter** (*string* or function name): The name of a function
+   that will be used to move the center of the halo for the purposes of
+   analysis. See explanation and examples, below. Default: None, which
+   is equivalent to the center of mass of the halo as output by the halo
+   finder.
 
- * **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.
+ * **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.
 
- * **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.
+ * **radius_units** (*str*): the units of **halo_radius**. 
+   Default: "1" (code units).
 
- * **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.
+ * **n_profile_bins** (*int*): the number of bins in the radial profiles.
+   Default: 50.
 
- * **radius_units** (*str*): the units of **halo_radius**.  Default: "1" (code units).
+ * **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".
 
- * **n_profile_bins** (*int*): the number of bins in the radial profiles.  Default: 50.
+ * **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".
 
- * **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".
+ * **projection_width** (*float*): the width of halo projections.
+   Default: 8.0.
 
- * **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".
+ * **projection_width_units** (*str*): the units of projection_width.
+   Default: "mpc".
 
- * **projection_width** (*float*): the width of halo projections.  Default: 8.0.
+ * **project_at_level** (*int* or "max"): the maximum refinement level to be
+   included in projections.  Default: "max" (maximum level within the dataset).
 
- * **projection_width_units** (*str*): the units of projection_width. Default: "mpc".
+ * **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).
 
- * **project_at_level** (*int* or "max"): the maximum refinement level to be included in projections.  Default: "max" (maximum level within the dataset).
+ * **filter_quantities** (*list*): quantities from the original halo list
+   file to be written out in the filtered list file.  Default: ['id','center'].
 
- * **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).
+ * **use_critical_density** (*bool*): if True, the definition of overdensity for 
+   virial quantities is calculated with respect to the critical density.  If False, 
+   overdensity is with respect to mean matter density, which is lower by a factor 
+   of Omega_M.  Default: False.
 
- * **filter_quantities** (*list*): quantities from the original halo list file to be written out in the filtered list file.  Default: ['id','center'].
 
-.. warning:: The halo profiler runs in parallel in a round-robin style, evenly distributing the list of halos among all processors.  Hence, the halo profiler will not work in parallel when **halos** is set to single.
+.. warning:: The halo profiler runs in parallel in a round-robin style, evenly
+   distributing the list of halos among all processors.  Hence, the halo profiler will not work in parallel when **halos** is set to single.
 
 Profiles
 --------
@@ -107,41 +149,56 @@
   hp.add_projection('Metallicity', weight_field='Density')
   hp.make_projections(axes=[0, 1, 2], save_cube=True, save_images=True, halo_list="filtered")
 
-If **save_cube** is set to True, the projection data will be written to a set of hdf5 files 
-in the directory given by **projection_output_dir**.  The keyword, **halo_list**, can be 
-used to select between the full list of halos ("all"), the filtered list ("filtered"), or 
-an entirely new list given in the form of a file name.  See :ref:`filter_functions` for a 
+If **save_cube** is set to True, the projection data
+will be written to a set of hdf5 files 
+in the directory given by **projection_output_dir**. 
+The keyword, **halo_list**, can be 
+used to select between the full list of halos ("all"),
+the filtered list ("filtered"), or 
+an entirely new list given in the form of a file name.
+See :ref:`filter_functions` for a 
 discussion of filtering halos.
 
 .. image:: _images/projections.png
    :width: 500
 
-Projections of Density (top) and Temperature, weighted by Density (bottom), in the x (left), 
+Projections of Density (top) and Temperature,
+weighted by Density (bottom), in the x (left), 
 y (middle), and z (right) directions for a single halo with a width of 8 Mpc.
 
 Halo Filters
 ------------
 
-Filters can be added to create a refined list of halos based on their profiles or to avoid 
-profiling halos altogether based on information given in the halo list file.
+Filters can be added to create a refined list of
+halos based on their profiles or to avoid 
+profiling halos altogether based on information
+given in the halo list file.
 
 .. _filter_functions:
 
 Filter Functions
 ^^^^^^^^^^^^^^^^
 
-It is often the case that one is looking to identify halos with a specific set of 
-properties.  This can be accomplished through the creation of filter functions.  A filter 
-function can take as many args and kwargs as you like, as long as the first argument is a 
-profile object, or at least a dictionary which contains the profile arrays for each field.  
-Filter functions must return a list of two things.  The first is a True or False indicating 
-whether the halo passed the filter.  The second is a dictionary containing quantities 
-calculated for that halo that will be written to a file if the halo passes the filter.  A 
-sample filter function based on virial quantities can be found in 
+It is often the case that one is looking to
+identify halos with a specific set of 
+properties.  This can be accomplished through the creation
+of filter functions.  A filter 
+function can take as many args and kwargs as you like,
+as long as the first argument is a 
+profile object, or at least a dictionary which contains
+the profile arrays for each field.  
+Filter functions must return a list of two things.
+The first is a True or False indicating 
+whether the halo passed the filter. 
+The second is a dictionary containing quantities 
+calculated for that halo that will be written to a
+file if the halo passes the filter.
+A  sample filter function based on virial quantities can be found in 
 ``yt/analysis_modules/halo_profiler/halo_filters.py``.
 
-Halo filtering takes place during the call to :meth:`make_profiles`.  The 
-:meth:`add_halo_filter` method is used to add a filter to be used during the profiling:
+Halo filtering takes place during the call to :meth:`make_profiles`.
+The  :meth:`add_halo_filter` method is used to add a filter to be used
+during the profiling:
 
 .. code-block:: python
 
@@ -149,15 +206,22 @@
                      overdensity_field='ActualOverdensity', 
 		     virial_overdensity=200, 
 		     virial_filters=[['TotalMassMsun','>=','1e14']],
-		     virial_quantities=['TotalMassMsun','RadiusMpc'])
+		     virial_quantities=['TotalMassMsun','RadiusMpc'],
+		     use_log=True)
 
-The addition above will calculate and return virial quantities, mass and radius, for an 
-overdensity of 200.  In order to pass the filter, at least one point in the profile must be 
-above the specified overdensity and the virial mass must be at least 1e14 solar masses.  If 
-the VirialFilter function has been added to the filter list, the halo profiler will make 
-sure that the fields necessary for calculating virial quantities are added.  As 
-many filters as desired can be added.  If filters have been added, the next call to 
-:meth:`make_profiles` will filter by all of the added filter functions:
+The addition above will calculate and return virial quantities,
+mass and radius, for an 
+overdensity of 200.  In order to pass the filter, at least one
+point in the profile must be 
+above the specified overdensity and the virial mass must be at
+least 1e14 solar masses.  The **use_log** keyword indicates that interpolation 
+should be done in log space.  If 
+the VirialFilter function has been added to the filter list,
+the halo profiler will make 
+sure that the fields necessary for calculating virial quantities are added.
+As  many filters as desired can be added.  If filters have been added,
+the next call to :meth:`make_profiles` will filter by all of
+the added filter functions:
 
 .. code-block:: python
 
@@ -166,16 +230,23 @@
 If the **filename** keyword is set, a file will be written with all of the filtered halos 
 and the quantities returned by the filter functions.
 
-.. note:: If the profiles have already been run, the halo profiler will read in the previously created output files instead of re-running the profiles.  The halo profiler will check to make sure the output file contains all of the requested halo fields.  If not, the profile will be made again from scratch.
+.. note:: If the profiles have already been run, the halo profiler will read
+   in the previously created output files instead of re-running the profiles.
+   The halo profiler will check to make sure the output file contains all of
+   the requested halo fields.  If not, the profile will be made again from
+   scratch.
 
 .. _halo_profiler_pre_filters:
 
 Pre-filters
 ^^^^^^^^^^^
 
-A single dataset can contain thousands or tens of thousands of halos.  Significant time can 
-be saved by not profiling halos that are certain to not pass any filter functions in place.  
-Simple filters based on quantities provided in the initial halo list can be used to filter 
+A single dataset can contain thousands or tens of thousands of halos.
+Significant time can 
+be saved by not profiling halos that are certain to not pass any filter
+functions in place.  
+Simple filters based on quantities provided in the initial halo list
+can be used to filter 
 out unwanted halos using the **prefilters** keyword:
 
 .. code-block:: python
@@ -183,7 +254,128 @@
   hp.make_profiles(filename="FilteredQuantities.out",
 		   prefilters=["halo['mass'] > 1e13"])
 
-Arguments provided with the **prefilters** keyword should be given as a list of strings.  
+Arguments provided with the **prefilters** keyword should be given
+as a list of strings.  
 Each string in the list will be evaluated with an *eval*.
 
-.. note:: If a VirialFilter function has been added with a filter based on mass (as in the example above), a prefilter will be automatically added to filter out halos with masses greater or less than (depending on the conditional of the filter) a factor of ten of the specified virial mass.
+.. note:: If a VirialFilter function has been added with a filter based
+   on mass (as in the example above), a prefilter will be automatically
+   added to filter out halos with masses greater or less than (depending
+   on the conditional of the filter) a factor of ten of the specified
+   virial mass.
+
+Recentering the Halo For Analysis
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+It is possible to move the center of the halo to a new point using an
+arbitrary function for making profiles.
+By default, the center is provided by the halo finder,
+which outputs the center of mass of the particles. For the purposes of
+analysis, it may be important to recenter onto a gas density maximum,
+or a temperature minimum.
+
+There are a number of built-in functions to do this, listed below.
+Each of the functions uses mass-weighted fields for the calculations
+of new center points.
+To use
+them, supply the HaloProfiler with the ``recenter`` option and 
+the name of the function, as in the example below.
+
+.. code-block:: python
+
+   hp = amods.halo_profiler.HaloProfiler("data0092",
+       recenter="Max_Dark_Matter_Density")
+
+
+  * *Min_Dark_Matter_Density* - Recenter on the point of minimum dark matter
+    density in the halo.
+
+  * *Max_Dark_Matter_Density* - Recenter on the point of maximum dark matter
+    density in the halo.
+
+  * *CoM_Dark_Matter_Density* - Recenter on the center of mass of the dark
+    matter density field. This will be very similar to what the halo finder
+    provides, but not precisely similar.
+
+  * *Min_Gas_Density* - Recenter on the point of minimum gas density in the
+    halo.
+
+  * *Max_Gas_Density* - Recenter on the point of maximum gas density in the
+    halo.
+
+  * *CoM_Gas_Density* - Recenter on the center of mass of the gas density field
+    in the halo.
+
+  * *Min_Total_Density* - Recenter on the point of minimum total (gas + dark
+    matter) density in the halo.
+
+  * *Max_Total_Density* - Recenter on the point of maximum total density in the
+    halo.
+
+  * *CoM_Total_Density* - Recenter on the center of mass for the total density
+    in the halo.
+
+  * *Min_Temperature* - Recenter on the point of minimum temperature in the
+    halo.
+
+  * *Max_Temperature* - Recenter on the point of maximum temperature in the
+    halo.
+
+It is also possible to supply a user-defined function to the HaloProfiler.
+This can be used if the pre-defined functions above are not sufficient.
+The function takes a single argument, a data container for the halo,
+which is a sphere. The function returns a 3-list with the new center.
+
+In this example below, a function is used such that the halos will be
+re-centered on the point of absolute minimum temperature, that is not
+mass weighted.
+
+.. code-block:: python
+
+   from yt.mods import *
+   
+   def find_min_temp(sphere):
+       ma, mini, mx, my, mz, mg = sphere.quantities['MinLocation']('Temperature')
+       return [mx,my,mz]
+   
+   hp = amods.halo_profiler.HaloProfiler("data0092",
+       recenter=find_min_temp)
+
+It is possible to make more complicated functions. This example below extends
+the example above to include a distance control that prevents the center from
+being moved too far. If the recenter moves too far, ``[-1, -1, -1]`` is
+returned which will prevent the halo from being profiled.
+Any triplet of values less than the ``domain_left_edge`` will suffice.
+There will be a note made in the output (stderr) showing which halos were
+skipped.
+
+.. code-block:: python
+
+   from yt.mods import *
+   from yt.utilities.math_utils import periodic_dist
+   
+   def find_min_temp_dist(sphere):
+       old = sphere.center
+       ma, mini, mx, my, mz, mg = sphere.quantities['MinLocation']('Temperature')
+       d = sphere.pf['kpc'] * periodic_dist(old, [mx, my, mz],
+           sphere.pf.domain_right_edge - sphere.pf.domain_left_edge)
+       # If new center farther than 5 kpc away, don't recenter
+       if d > 5.: return [-1, -1, -1]
+       return [mx,my,mz]
+   
+   hp = amods.halo_profiler.HaloProfiler("data0092",
+       recenter=find_min_temp_dist)
+
+.. warning::
+
+   If the halo profiler is run in parallel, and a recentering function is used
+   that is user-defined, two flags need to be set in the ``quantities`` call
+   as in the example below. These need to be set explicitly because the defaults
+   will lead to crashes. The built-in recentering functions have these flags
+   set already.
+   
+   .. code-block:: python
+      
+      ma, mini, mx, my, mz, mg = sphere.quantities['MinLocation']('Temperature',
+        lazy_reader=False, preload=False)
+


--- a/source/analyzing/generating_processed_data.rst	Wed Jun 01 19:49:16 2011 -0400
+++ b/source/analyzing/generating_processed_data.rst	Wed Jun 01 19:49:23 2011 -0400
@@ -43,7 +43,7 @@
 
 .. code-block:: python
 
-   sl = pf.h.proj(0, 0.5)
+   sl = pf.h.slice(0, 0.5)
    frb = FixedResolutionBuffer(sl, (0.3, 0.5, 0.6, 0.8), (512, 512))
    my_image = frb["Density"]

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