[Yt-svn] yt: 2 new changesets
hg at spacepope.org
hg at spacepope.org
Fri Oct 8 10:24:57 PDT 2010
hg Repository: yt
details: yt/rev/2caa69aa24d1
changeset: 3433:2caa69aa24d1
user: Matthew Turk <matthewturk at gmail.com>
date:
Fri Oct 08 10:23:18 2010 -0700
description:
Fixing HDF4 for Enzo
hg Repository: yt
details: yt/rev/99e538399b7a
changeset: 3434:99e538399b7a
user: Matthew Turk <matthewturk at gmail.com>
date:
Fri Oct 08 10:24:19 2010 -0700
description:
Merging
diffstat:
yt/analysis_modules/halo_finding/parallel_hop/setup.py | 2 +-
yt/analysis_modules/halo_profiler/multi_halo_profiler.py | 38 +++++++++++++-----
yt/frontends/enzo/io.py | 2 +-
yt/visualization/eps_writer.py | 2 +
4 files changed, 31 insertions(+), 13 deletions(-)
diffs (133 lines):
diff -r 55531f69ed33 -r 99e538399b7a yt/analysis_modules/halo_finding/parallel_hop/setup.py
--- a/yt/analysis_modules/halo_finding/parallel_hop/setup.py Mon Oct 04 20:03:05 2010 -0700
+++ b/yt/analysis_modules/halo_finding/parallel_hop/setup.py Fri Oct 08 10:24:19 2010 -0700
@@ -6,7 +6,7 @@
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
- config = Configuration('parallel_hop_interface',parent_package,top_path)
+ config = Configuration('parallel_hop',parent_package,top_path)
config.make_config_py() # installs __config__.py
config.make_svn_version_py()
return config
diff -r 55531f69ed33 -r 99e538399b7a yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py Mon Oct 04 20:03:05 2010 -0700
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py Fri Oct 08 10:24:19 2010 -0700
@@ -33,7 +33,7 @@
from yt.convenience import \
load
from yt.data_objects.profiles import \
- BinnedProfile1D
+ BinnedProfile1D, EmptyProfileData
from yt.analysis_modules.halo_finding.api import \
HaloFinder
from .halo_filters import \
@@ -70,7 +70,8 @@
: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
+ given by yt's halo finders. "enzo_hop" for the format written by enzo_hop. "p-groupfinder"
+ for P-Groupfinder. 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".
@@ -155,10 +156,12 @@
self.halo_list_format = {'id':0, 'mass':1, 'center':[7, 8, 9], 'velocity':[10, 11, 12], 'r_max':13}
elif halo_list_format == 'enzo_hop':
self.halo_list_format = {'id':0, 'center':[4, 5, 6]}
+ elif halo_list_format == 'p-groupfinder':
+ self.halo_list_format = {'id':3, 'mass':5, 'center':[0, 1, 2], 'r200kpc':8}
elif isinstance(halo_list_format, types.DictType):
self.halo_list_format = halo_list_format
else:
- mylog.error("Keyword, halo_list_format, must be 'yt_hop', 'enzo_hop', or a dictionary of custom settings.")
+ mylog.error("Keyword, halo_list_format, must be 'yt_hop', 'enzo_hop', 'p-groupfinder', or a dictionary of custom settings.")
return None
# Option to recenter sphere on density center.
@@ -252,6 +255,10 @@
def make_profiles(self, filename=None, prefilters=None, **kwargs):
"Make radial profiles for all halos on the list."
+ if len(self.all_halos) == 0:
+ mylog.error("Halo list is empty, returning.")
+ return None
+
# Reset filtered halo list.
self.filtered_halos = []
@@ -385,9 +392,13 @@
max_grid['y-velocity'][max_cell],
max_grid['z-velocity'][max_cell]])
- profile = BinnedProfile1D(sphere, self.n_profile_bins, "RadiusMpc",
- r_min, halo['r_max'],
- log_space=True, lazy_reader=False)
+ try:
+ profile = BinnedProfile1D(sphere, self.n_profile_bins, "RadiusMpc",
+ r_min, halo['r_max'],
+ log_space=True, lazy_reader=False)
+ except EmptyProfileData:
+ mylog.error("Caught EmptyProfileData exception, returning None for this halo.")
+ return None
for hp in self.profile_fields:
profile.add_fields(hp['field'], weight=hp['weight_field'], accumulation=hp['accumulation'])
@@ -589,11 +600,12 @@
fields = self.halo_list_format.keys()
getID = not 'id' in fields
- getR_max = not 'r_max' in fields
+ has_rmax = 'r_max' in fields
+ has_r200kpc = 'r200kpc' in fields
for line in listLines:
line = line.strip()
- if not(line.startswith('#')):
+ if len(line) > 0 and not line.startswith('#') and not line[0].isalpha():
halo = {}
onLine = line.split()
for field in fields:
@@ -602,10 +614,14 @@
else:
halo[field] = __get_num(onLine[self.halo_list_format[field]])
if getID: halo['id'] = len(haloList)
- if getR_max:
+ if has_rmax:
+ halo['r_max'] *= self.pf.units['mpc']
+ elif has_r200kpc:
+ # If P-Groupfinder used, r_200 [kpc] is calculated.
+ # set r_max as 50% past r_200.
+ halo['r_max'] = 1.5 * halo['r200kpc'] / 1000.
+ else:
halo['r_max'] = self.halo_radius * self.pf.units['mpc']
- else:
- halo['r_max'] *= self.pf.units['mpc']
haloList.append(halo)
mylog.info("Loaded %d halos." % (len(haloList)))
diff -r 55531f69ed33 -r 99e538399b7a yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py Mon Oct 04 20:03:05 2010 -0700
+++ b/yt/frontends/enzo/io.py Fri Oct 08 10:24:19 2010 -0700
@@ -55,7 +55,7 @@
@param field: field to read
@type field: string
"""
- return SD.SD(grid.filename).select(field).get()
+ return SD.SD(grid.filename).select(field).get().swapaxes(0,2)
def _read_data_slice(self, grid, field, axis, coord):
"""
diff -r 55531f69ed33 -r 99e538399b7a yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py Mon Oct 04 20:03:05 2010 -0700
+++ b/yt/visualization/eps_writer.py Fri Oct 08 10:24:19 2010 -0700
@@ -27,6 +27,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import pyx
+import numpy as na
+from matplotlib import cm
from .plot_types import \
VMPlot, \
More information about the yt-svn
mailing list