[yt-svn] commit/yt-3.0: 6 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Dec 21 14:19:40 PST 2012
6 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/changeset/b9c760b05a89/
changeset: b9c760b05a89
branch: yt-3.0
user: sskory
date: 2012-12-20 23:26:27
summary: Adding support for mulitple types of active particle that may or may
not appear in every grid. This is in combination with a change to Enzo 3.0
that lists this information in the grid hierarchy file.
affected #: 3 files
diff -r 6fb278bef80f6f6e30f3e67ee00ee0a98556a6a6 -r b9c760b05a8909f2dd8b64b92abc27b7639dfe3b yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
@@ -674,7 +674,7 @@
elif self.velocity_center[1] == 'sphere':
mylog.info('Calculating sphere bulk velocity.')
sphere.set_field_parameter('bulk_velocity',
- sphere.quantities['BulkVelocity']()
+ sphere.quantities['BulkVelocity']())
else:
mylog.error("Invalid parameter: velocity_center.")
return None
diff -r 6fb278bef80f6f6e30f3e67ee00ee0a98556a6a6 -r b9c760b05a8909f2dd8b64b92abc27b7639dfe3b yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -282,7 +282,9 @@
pbar = get_pbar("Parsing Hierarchy", self.num_grids)
if self.parameter_file.parameters["VersionNumber"] > 2.0:
active_particles = True
- nap = []
+ nap = {}
+ for type in self.parameters["AppendActiveParticleType"]:
+ nap[type] = []
else:
active_particles = False
nap = None
@@ -297,9 +299,16 @@
fn.append(["-1"])
if nb > 0: fn[-1] = _next_token_line("BaryonFileName", f)
npart.append(int(_next_token_line("NumberOfParticles", f)[0]))
+ # Below we find out what active particles exist in this grid,
+ # and add their counts individually.
if active_particles:
- ta = int(_next_token_line( "NumberOfActiveParticles", f)[0])
- nap.append(ta)
+ types = _next_token_line("PresentParticleTypes", f)
+ counts = [int(c) for c in _next_token_line("ParticleTypeCounts", f)]
+ for type in self.parameters["AppendActiveParticleType"]:
+ if type in types:
+ nap[type].append(counts[types.index(type)])
+ else:
+ nap[type].append(0)
if nb == 0 and npart[-1] > 0: fn[-1] = _next_token_line("ParticleFileName", f)
for line in f:
if len(line) < 2: break
@@ -316,7 +325,9 @@
def _initialize_grid_arrays(self):
super(EnzoHierarchy, self)._initialize_grid_arrays()
- self.grid_active_particle_count = np.zeros((self.num_grids,1), 'int32')
+ self.grid_active_particle_count = {}
+ for type in self.parameters["AppendActiveParticleType"]:
+ self.grid_active_particle_count[type] = np.zeros((self.num_grids,1), 'int32')
def _fill_arrays(self, ei, si, LE, RE, npart, nap):
self.grid_dimensions.flat[:] = ei
@@ -326,7 +337,8 @@
self.grid_right_edge.flat[:] = RE
self.grid_particle_count.flat[:] = npart
if nap is not None:
- self.grid_active_particle_count.flat[:] = nap
+ for type in nap:
+ self.grid_active_particle_count[type].flat[:] = nap[type]
def __pointer_handler(self, m):
sgi = int(m[2])-1
@@ -372,8 +384,10 @@
reconstruct = ytcfg.getboolean("yt","reconstruct_hierarchy")
for g,f in izip(self.grids, self.filenames):
g._prepare_grid()
- g.NumberOfActiveParticles = \
- self.grid_active_particle_count[g.id - g._id_offset,0]
+ g.NumberOfActiveParticles = {}
+ for type in self.parameters["AppendActiveParticleType"]:
+ g.NumberOfActiveParticles[type] = \
+ self.grid_active_particle_count[type][g.id - g._id_offset,0]
g._setup_dx()
g.set_filename(f[0])
if reconstruct:
@@ -382,12 +396,16 @@
self.max_level = self.grid_levels.max()
def _detect_active_particle_fields(self):
- gs = self.grids[self.grid_active_particle_count.flat > 0]
+ select_grids = np.zeros(len(self.grids), dtype='int32')
+ for type in self.grid_active_particle_count:
+ select_grids += self.grid_active_particle_count[type].flat
+ gs = self.grids[select_grids > 0]
grids = sorted((g for g in gs), key = lambda a: a.filename)
handle = last = None
- ap_list = self.parameter_file.parameters["AppendActiveParticleType"]
+ ap_list = self.parameter_file["AppendActiveParticleType"]
_fields = dict((ap, []) for ap in ap_list)
fields = []
+ skip = []
for g in grids:
# We inspect every grid, for now, until we have a list of
# attributes in a defined location.
@@ -396,9 +414,11 @@
handle = h5py.File(g.filename)
node = handle["/Grid%08i/Particles/" % g.id]
for ptype in (str(p) for p in node):
+ if ptype in skip: continue
for field in (str(f) for f in node[ptype]):
_fields[ptype].append(field)
fields += [(ptype, field) for field in _fields.pop(ptype)]
+ skip.append(ptype)
if len(_fields) == 0: break
if handle is not None: handle.close()
return set(fields)
@@ -829,6 +849,9 @@
self.particle_types = ["all"]
for ptype in self.parameters.get("AppendActiveParticleType", []):
self.particle_types.append(ptype)
+ if self.parameters["NumberOfParticles"] > 0:
+ self.particle_types.append("DarkMatter")
+ self.parameters["AppendActiveParticleType"].append("DarkMatter")
if self.dimensionality == 1:
self._setup_1d()
diff -r 6fb278bef80f6f6e30f3e67ee00ee0a98556a6a6 -r b9c760b05a8909f2dd8b64b92abc27b7639dfe3b yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -61,7 +61,7 @@
data = self._read_chunk_data(chunk, pfields, 'active',
"/Particles/%s" % ptypes[0])
for g in chunk.objs:
- if g.NumberOfActiveParticles == 0: continue
+ if g.NumberOfActiveParticles[ptypes[0]] == 0: continue
x, y, z = (data[g.id].pop(fn) for ft, fn in pfields)
size += g.count_particles(selector, x, y, z)
read_fields = fields[:]
@@ -75,7 +75,7 @@
data = self._read_chunk_data(chunk, read_fields, 'active',
"/Particles/%s" % ptypes[0])
for g in chunk.objs:
- if g.NumberOfActiveParticles == 0: continue
+ if g.NumberOfActiveParticles[ptypes[0]] == 0: continue
x, y, z = (data[g.id][fn] for ft, fn in pfields)
mask = g.select_particles(selector, x, y, z)
if mask is None: continue
@@ -182,7 +182,7 @@
if filter_particles == 'any' and g.NumberOfParticles == 0:
continue
elif filter_particles == 'active' and \
- g.NumberOfActiveParticles == 0:
+ g.NumberOfActiveParticles[fields[0][0]] == 0:
continue
grids_by_file[g.filename].append(g.id)
sets = [fname for ftype, fname in fields]
https://bitbucket.org/yt_analysis/yt-3.0/changeset/de642606e0e2/
changeset: de642606e0e2
branch: yt-3.0
user: sskory
date: 2012-12-20 23:35:40
summary: Merge.
affected #: 2 files
diff -r b9c760b05a8909f2dd8b64b92abc27b7639dfe3b -r de642606e0e292fdc2f879528171251f6fdb550d yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -24,6 +24,7 @@
"""
from libc.stdlib cimport malloc, free
+from libc.math cimport floor
cimport numpy as np
import numpy as np
from oct_container cimport Oct, OctAllocationContainer, OctreeContainer
@@ -145,7 +146,7 @@
for i in range(3):
pp[i] = ppos[i] - self.DLE[i]
dds[i] = (self.DRE[i] - self.DLE[i])/self.nn[i]
- ind[i] = <np.int64_t> (pp[i]/dds[i])
+ ind[i] = <np.int64_t> (floor(pp[i]/dds[i]))
cp[i] = (ind[i] + 0.5) * dds[i]
cur = self.root_mesh[ind[0]][ind[1]][ind[2]]
while cur.children[0][0][0] != NULL:
diff -r b9c760b05a8909f2dd8b64b92abc27b7639dfe3b -r de642606e0e292fdc2f879528171251f6fdb550d yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -758,6 +758,62 @@
if self._plot_type is None:
self._plot_type = kwargs.pop("plot_type")
PWViewer.__init__(self, *args, **kwargs)
+
+ def _setup_origin(self):
+ origin = self.origin
+ axis_index = self.data_source.axis
+ if isinstance(origin, basestring):
+ origin = tuple(origin.split('-'))[:3]
+ if 1 == len(origin):
+ origin = ('lower', 'left') + origin
+ elif 2 == len(origin) and origin[0] in set(['left','right','center']):
+ o0map = {'left': 'lower', 'right': 'upper', 'center': 'center'}
+ origin = (o0map[origin[0]],) + origin
+ elif 2 == len(origin) and origin[0] in set(['lower','upper','center']):
+ origin = (origin[0], 'center', origin[-1])
+ assert origin[-1] in ['window', 'domain']
+
+ if origin[2] == 'window':
+ xllim, xrlim = self.xlim
+ yllim, yrlim = self.ylim
+ elif origin[2] == 'domain':
+ xllim = self.pf.domain_left_edge[x_dict[axis_index]]
+ xrlim = self.pf.domain_right_edge[x_dict[axis_index]]
+ yllim = self.pf.domain_left_edge[y_dict[axis_index]]
+ yrlim = self.pf.domain_right_edge[y_dict[axis_index]]
+ else:
+ mylog.warn("origin = {0}".format(origin))
+ msg = ('origin keyword "{0}" not recognized, must declare "domain" '
+ 'or "center" as the last term in origin.').format(self.origin)
+ raise RuntimeError(msg)
+
+ if origin[0] == 'lower':
+ yc = yllim
+ elif origin[0] == 'upper':
+ yc = yrlim
+ elif origin[0] == 'center':
+ yc = (yllim + yrlim)/2.0
+ else:
+ mylog.warn("origin = {0}".format(origin))
+ msg = ('origin keyword "{0}" not recognized, must declare "lower" '
+ '"upper" or "center" as the first term in origin.')
+ msg = msg.format(self.origin)
+ raise RuntimeError(msg)
+
+ if origin[1] == 'left':
+ xc = xllim
+ elif origin[1] == 'right':
+ xc = xrlim
+ elif origin[1] == 'center':
+ xc = (xllim + xrlim)/2.0
+ else:
+ mylog.warn("origin = {0}".format(origin))
+ msg = ('origin keyword "{0}" not recognized, must declare "left" '
+ '"right" or "center" as the second term in origin.')
+ msg = msg.format(self.origin)
+ raise RuntimeError(msg)
+
+ return xc, yc
def _setup_plots(self):
if self._current_field is not None:
@@ -769,20 +825,7 @@
md = self.get_metadata(f, strip_mathml = False, return_string = False)
axis_index = self.data_source.axis
- if self.origin == 'center-window':
- xc = (self.xlim[0]+self.xlim[1])/2
- yc = (self.ylim[0]+self.ylim[1])/2
- elif self.origin == 'center-domain':
- xc = (self.pf.domain_left_edge[x_dict[axis_index]]+
- self.pf.domain_right_edge[x_dict[axis_index]])/2
- yc = (self.pf.domain_left_edge[y_dict[axis_index]]+
- self.pf.domain_right_edge[y_dict[axis_index]])/2
- elif self.origin == 'left-domain':
- xc = self.pf.domain_left_edge[x_dict[axis_index]]
- yc = self.pf.domain_left_edge[y_dict[axis_index]]
- else:
- raise RuntimeError(
- 'origin keyword: \"%(k)s\" not recognized' % {'k': self.origin})
+ xc, yc = self._setup_origin()
(unit_x, unit_y) = md['axes_unit_names']
@@ -1045,12 +1088,32 @@
Defaults to None, which automatically picks an appropriate unit.
If axes_unit is '1', 'u', or 'unitary', it will not display the
units, and only show the axes name.
- origin : string
- The location of the origin of the plot coordinate system.
- Currently, can be set to three options: 'left-domain', corresponding
- to the bottom-left hand corner of the simulation domain, 'center-domain',
- corresponding the center of the simulation domain, or 'center-window' for
- the center of the plot window.
+ origin : string or length 1, 2, or 3 sequence of strings
+ The location of the origin of the plot coordinate system. This is
+ represented by '-' separated string or a tuple of strings. In the
+ first index the y-location is given by 'lower', 'upper', or 'center'.
+ The second index is the x-location, given as 'left', 'right', or
+ 'center'. Finally, the whether the origin is applied in 'domain' space
+ or plot 'window' space is given. For example, both 'upper-right-domain'
+ and ['upper', 'right', 'domain'] both place the origin in the upper
+ right hand corner of domain space. If x or y are not given, a value is
+ inffered. For instance, 'left-domain' corresponds to the lower-left
+ hand corner of the simulation domain, 'center-domain' corresponds to the
+ center of the simulation domain, or 'center-window' for the center of
+ the plot window. Further examples:
+
+ ================================== ============================
+ format example
+ ================================== ============================
+ '{space}' 'domain'
+ '{xloc}-{space}' 'left-window'
+ '{yloc}-{space}' 'upper-domain'
+ '{yloc}-{xloc}-{space}' 'lower-right-window'
+ ('{space}',) ('window',)
+ ('{xloc}', '{space}') ('right', 'domain')
+ ('{yloc}', '{space}') ('lower', 'window')
+ ('{yloc}', '{xloc}', '{space}') ('lower', 'right', 'window')
+ ================================== ============================
fontsize : integer
The size of the fonts for the axis, colorbar, and tick labels.
@@ -1133,12 +1196,33 @@
Defaults to None, which automatically picks an appropriate unit.
If axes_unit is '1', 'u', or 'unitary', it will not display the
units, and only show the axes name.
- origin : A string
- The location of the origin of the plot coordinate system.
- Currently, can be set to three options: 'left-domain', corresponding
- to the bottom-left hand corner of the simulation domain, 'center-domain',
- corresponding the center of the simulation domain, or 'center-window' for
- the center of the plot window.
+ origin : string or length 1, 2, or 3 sequence of strings
+ The location of the origin of the plot coordinate system. This is
+ represented by '-' separated string or a tuple of strings. In the
+ first index the y-location is given by 'lower', 'upper', or 'center'.
+ The second index is the x-location, given as 'left', 'right', or
+ 'center'. Finally, the whether the origin is applied in 'domain' space
+ or plot 'window' space is given. For example, both 'upper-right-domain'
+ and ['upper', 'right', 'domain'] both place the origin in the upper
+ right hand corner of domain space. If x or y are not given, a value is
+ inffered. For instance, 'left-domain' corresponds to the lower-left
+ hand corner of the simulation domain, 'center-domain' corresponds to the
+ center of the simulation domain, or 'center-window' for the center of
+ the plot window.Further examples:
+
+ ================================== ============================
+ format example
+ ================================== ============================
+ '{space}' 'domain'
+ '{xloc}-{space}' 'left-window'
+ '{yloc}-{space}' 'upper-domain'
+ '{yloc}-{xloc}-{space}' 'lower-right-window'
+ ('{space}',) ('window',)
+ ('{xloc}', '{space}') ('right', 'domain')
+ ('{yloc}', '{space}') ('lower', 'window')
+ ('{yloc}', '{xloc}', '{space}') ('lower', 'right', 'window')
+ ================================== ============================
+
weight_field : string
The name of the weighting field. Set to None for no weight.
fontsize : integer
https://bitbucket.org/yt_analysis/yt-3.0/changeset/89ca91855c2e/
changeset: 89ca91855c2e
branch: yt-3.0
user: sskory
date: 2012-12-20 23:42:44
summary: Cleaner.
affected #: 1 file
diff -r de642606e0e292fdc2f879528171251f6fdb550d -r 89ca91855c2e199a4f9cdbca1ab497293753a6b7 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -405,7 +405,6 @@
ap_list = self.parameter_file["AppendActiveParticleType"]
_fields = dict((ap, []) for ap in ap_list)
fields = []
- skip = []
for g in grids:
# We inspect every grid, for now, until we have a list of
# attributes in a defined location.
@@ -414,11 +413,10 @@
handle = h5py.File(g.filename)
node = handle["/Grid%08i/Particles/" % g.id]
for ptype in (str(p) for p in node):
- if ptype in skip: continue
+ if ptype not in _fields: continue
for field in (str(f) for f in node[ptype]):
_fields[ptype].append(field)
fields += [(ptype, field) for field in _fields.pop(ptype)]
- skip.append(ptype)
if len(_fields) == 0: break
if handle is not None: handle.close()
return set(fields)
https://bitbucket.org/yt_analysis/yt-3.0/changeset/16404a06694e/
changeset: 16404a06694e
branch: yt-3.0
user: sskory
date: 2012-12-21 22:12:54
summary: Modifying the NumberOfActiveParticles to an array with a property function.
affected #: 2 files
diff -r 89ca91855c2e199a4f9cdbca1ab497293753a6b7 -r 16404a06694e90d716848d420a024e57ffefa21d yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -406,7 +406,8 @@
ii = self.check_available(data)
original_fields = data.keys() # Copy
dd = self._function(self, data)
- dd *= self._convert_function(data)
+ if dd is not None:
+ dd *= self._convert_function(data)
for field_name in data.keys():
if field_name not in original_fields:
del data[field_name]
diff -r 89ca91855c2e199a4f9cdbca1ab497293753a6b7 -r 16404a06694e90d716848d420a024e57ffefa21d yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -123,6 +123,11 @@
return [self.hierarchy.grids[cid - self._id_offset]
for cid in self._children_ids]
+ @property
+ def NumberOfActiveParticles(self):
+ if not hasattr(self, '_NumberOfActiveParticles'): return None
+ return self._NumberOfActiveParticles[self.id - self._id_offset]
+
class EnzoGridInMemory(EnzoGrid):
__slots__ = ['proc_num']
def set_filename(self, filename):
@@ -302,13 +307,13 @@
# Below we find out what active particles exist in this grid,
# and add their counts individually.
if active_particles:
- types = _next_token_line("PresentParticleTypes", f)
+ ptypes = _next_token_line("PresentParticleTypes", f)
counts = [int(c) for c in _next_token_line("ParticleTypeCounts", f)]
- for type in self.parameters["AppendActiveParticleType"]:
- if type in types:
- nap[type].append(counts[types.index(type)])
+ for ptype in self.parameters["AppendActiveParticleType"]:
+ if ptype in ptypes:
+ nap[ptype].append(counts[ptypes.index(ptype)])
else:
- nap[type].append(0)
+ nap[ptype].append(0)
if nb == 0 and npart[-1] > 0: fn[-1] = _next_token_line("ParticleFileName", f)
for line in f:
if len(line) < 2: break
@@ -325,9 +330,9 @@
def _initialize_grid_arrays(self):
super(EnzoHierarchy, self)._initialize_grid_arrays()
- self.grid_active_particle_count = {}
- for type in self.parameters["AppendActiveParticleType"]:
- self.grid_active_particle_count[type] = np.zeros((self.num_grids,1), 'int32')
+ pdtype = [(ptype, 'i4') for ptype in
+ self.parameters["AppendActiveParticleType"]]
+ self.grid_active_particle_count = np.zeros(self.num_grids, dtype=pdtype)
def _fill_arrays(self, ei, si, LE, RE, npart, nap):
self.grid_dimensions.flat[:] = ei
@@ -337,8 +342,8 @@
self.grid_right_edge.flat[:] = RE
self.grid_particle_count.flat[:] = npart
if nap is not None:
- for type in nap:
- self.grid_active_particle_count[type].flat[:] = nap[type]
+ for ptype in nap:
+ self.grid_active_particle_count[ptype].flat[:] = nap[ptype]
def __pointer_handler(self, m):
sgi = int(m[2])-1
@@ -384,10 +389,8 @@
reconstruct = ytcfg.getboolean("yt","reconstruct_hierarchy")
for g,f in izip(self.grids, self.filenames):
g._prepare_grid()
- g.NumberOfActiveParticles = {}
- for type in self.parameters["AppendActiveParticleType"]:
- g.NumberOfActiveParticles[type] = \
- self.grid_active_particle_count[type][g.id - g._id_offset,0]
+ g._NumberOfActiveParticles = \
+ self.grid_active_particle_count
g._setup_dx()
g.set_filename(f[0])
if reconstruct:
@@ -397,8 +400,8 @@
def _detect_active_particle_fields(self):
select_grids = np.zeros(len(self.grids), dtype='int32')
- for type in self.grid_active_particle_count:
- select_grids += self.grid_active_particle_count[type].flat
+ for ptype in self.parameter_file["AppendActiveParticleType"]:
+ select_grids += self.grid_active_particle_count[ptype].flat
gs = self.grids[select_grids > 0]
grids = sorted((g for g in gs), key = lambda a: a.filename)
handle = last = None
https://bitbucket.org/yt_analysis/yt-3.0/changeset/576eed8a4660/
changeset: 576eed8a4660
branch: yt-3.0
user: sskory
date: 2012-12-21 22:58:58
summary: Removing _NumberOfActiveParticles from grids.
affected #: 1 file
diff -r 16404a06694e90d716848d420a024e57ffefa21d -r 576eed8a46605c6484a9a0957a781ea1069438a6 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -125,8 +125,7 @@
@property
def NumberOfActiveParticles(self):
- if not hasattr(self, '_NumberOfActiveParticles'): return None
- return self._NumberOfActiveParticles[self.id - self._id_offset]
+ return self.hierarchy.grid_active_particle_count[self.id - self._id_offset]
class EnzoGridInMemory(EnzoGrid):
__slots__ = ['proc_num']
@@ -330,8 +329,11 @@
def _initialize_grid_arrays(self):
super(EnzoHierarchy, self)._initialize_grid_arrays()
- pdtype = [(ptype, 'i4') for ptype in
- self.parameters["AppendActiveParticleType"]]
+ if len(self.parameters["AppendActiveParticleType"]):
+ pdtype = [(ptype, 'i4') for ptype in
+ self.parameters["AppendActiveParticleType"]]
+ else:
+ pdtype = None
self.grid_active_particle_count = np.zeros(self.num_grids, dtype=pdtype)
def _fill_arrays(self, ei, si, LE, RE, npart, nap):
@@ -389,8 +391,6 @@
reconstruct = ytcfg.getboolean("yt","reconstruct_hierarchy")
for g,f in izip(self.grids, self.filenames):
g._prepare_grid()
- g._NumberOfActiveParticles = \
- self.grid_active_particle_count
g._setup_dx()
g.set_filename(f[0])
if reconstruct:
https://bitbucket.org/yt_analysis/yt-3.0/changeset/aaaca1723217/
changeset: aaaca1723217
branch: yt-3.0
user: sskory
date: 2012-12-21 23:04:23
summary: A few changes to work with older Enzo datasets.
affected #: 1 file
diff -r 576eed8a46605c6484a9a0957a781ea1069438a6 -r aaaca172321776fadf448c18ce8753dee31e3999 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -125,6 +125,7 @@
@property
def NumberOfActiveParticles(self):
+ if not hasattr(self.hierarchy, "grid_active_particle_count"): return 0
return self.hierarchy.grid_active_particle_count[self.id - self._id_offset]
class EnzoGridInMemory(EnzoGrid):
@@ -329,7 +330,8 @@
def _initialize_grid_arrays(self):
super(EnzoHierarchy, self)._initialize_grid_arrays()
- if len(self.parameters["AppendActiveParticleType"]):
+ if "AppendActiveParticleType" in self.parameters.keys() and \
+ len(self.parameters["AppendActiveParticleType"]):
pdtype = [(ptype, 'i4') for ptype in
self.parameters["AppendActiveParticleType"]]
else:
@@ -850,7 +852,8 @@
self.particle_types = ["all"]
for ptype in self.parameters.get("AppendActiveParticleType", []):
self.particle_types.append(ptype)
- if self.parameters["NumberOfParticles"] > 0:
+ if self.parameters["NumberOfParticles"] > 0 and \
+ "AppendActiveParticleType" in self.parameters.keys():
self.particle_types.append("DarkMatter")
self.parameters["AppendActiveParticleType"].append("DarkMatter")
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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