[Yt-svn] yt-commit r1300 - in trunk/yt: . lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Thu May 7 15:35:09 PDT 2009
Author: mturk
Date: Thu May 7 15:35:09 2009
New Revision: 1300
URL: http://yt.spacepope.org/changeset/1300
Log:
Lots of changes to fix preloading of particles and baryon fields
* Changed region to 'fully-include' grids on the edge of the region
* deleted the --rpdb argument if found in sys.argv (to allow 'yt' commands to use rpdb
* HDF5LightReader, if it doesn't find a dataset, skips over it rather than throwing an error
* Moved the particle field detection to the outside in grid.get_data, to speed things and rely less on exceptions if it can be helped
* Changed HDF5LightReader to NOT stop if it finds a single exception.
Modified:
trunk/yt/funcs.py
trunk/yt/lagos/BaseDataTypes.py
trunk/yt/lagos/BaseGridType.py
trunk/yt/lagos/DataReadingFuncs.py
trunk/yt/lagos/HDF5LightReader.c
Modified: trunk/yt/funcs.py
==============================================================================
--- trunk/yt/funcs.py (original)
+++ trunk/yt/funcs.py Thu May 7 15:35:09 2009
@@ -58,6 +58,7 @@
sys.excepthook = paste_traceback
if "--rpdb" in sys.argv:
sys.excepthook = rpdb.rpdb_excepthook
+ del sys.argv[sys.argv.index("--rpdb")]
def blank_wrapper(f):
return lambda a: a
Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py (original)
+++ trunk/yt/lagos/BaseDataTypes.py Thu May 7 15:35:09 2009
@@ -1643,8 +1643,8 @@
self.right_edge)
def _is_fully_enclosed(self, grid):
- return na.all( (grid._corners < self.right_edge)
- & (grid._corners > self.left_edge))
+ return na.all( (grid._corners <= self.right_edge)
+ & (grid._corners >= self.left_edge))
@cache_mask
def _get_cut_mask(self, grid):
Modified: trunk/yt/lagos/BaseGridType.py
==============================================================================
--- trunk/yt/lagos/BaseGridType.py (original)
+++ trunk/yt/lagos/BaseGridType.py Thu May 7 15:35:09 2009
@@ -74,6 +74,11 @@
conv_factor = 1.0
if self.pf.field_info.has_key(field):
conv_factor = self.pf.field_info[field]._convert_function(self)
+ if self.pf.field_info[field].particle_type and \
+ self.NumberOfParticles == 0:
+ # because this gets upcast to float
+ self[field] = na.array([],dtype='int64')
+ return self.data[field]
try:
if hasattr(self.hierarchy, 'queue'):
temp = self.hierarchy.queue.pop(self, field)
@@ -82,10 +87,7 @@
self[field] = temp * conv_factor
except self._read_exception, exc:
if field in self.pf.field_info:
- if self.pf.field_info[field].particle_type:
- # because this gets upcast to float
- self[field] = na.array([],dtype='int64')
- elif self.pf.field_info[field].not_in_all:
+ if self.pf.field_info[field].not_in_all:
self[field] = na.zeros(self.ActiveDimensions, dtype='float64')
else:
raise
Modified: trunk/yt/lagos/DataReadingFuncs.py
==============================================================================
--- trunk/yt/lagos/DataReadingFuncs.py (original)
+++ trunk/yt/lagos/DataReadingFuncs.py Thu May 7 15:35:09 2009
@@ -204,7 +204,7 @@
class BaseDataQueue(object):
def __init__(self):
- self.queue = defaultdict(lambda: {})
+ self.queue = defaultdict(dict)
# We need a function for reading a list of sets
# and a function for *popping* from a queue all the appropriate sets
@@ -270,12 +270,9 @@
# We want to pass on any error we might expect -- the preload
# phase should be non-fatal in all cases, and instead dump back to
# the grids.
- try:
- data = HDF5LightReader.ReadMultipleGrids(file, nodes, sets)
- mylog.debug("Read %s items from %s", len(data), os.path.basename(file))
- for gid in data: self.queue[gid].update(data[gid])
- except exc:
- pass
+ data = HDF5LightReader.ReadMultipleGrids(file, nodes, sets)
+ mylog.debug("Read %s items from %s", len(data), os.path.basename(file))
+ for gid in data: self.queue[gid].update(data[gid])
mylog.debug("Finished read of %s", sets)
class DataQueueInMemory(BaseDataQueue):
Modified: trunk/yt/lagos/HDF5LightReader.c
==============================================================================
--- trunk/yt/lagos/HDF5LightReader.c (original)
+++ trunk/yt/lagos/HDF5LightReader.c Thu May 7 15:35:09 2009
@@ -517,14 +517,10 @@
oset_name = PyList_GetItem(set_names, n);
set_name = PyString_AsString(oset_name);
cur_data = get_array_from_nodename(set_name, grid_node);
- if (cur_data == NULL) {
- PyErr_Format(_hdf5ReadError,
- "ReadHDF5DataSet: Error reading (%s, %s, %s)",
- filename, grid_node_name, set_name);
- goto _fail;
+ if (cur_data != NULL) {
+ PyDict_SetItem(grid_data, oset_name, (PyObject *) cur_data);
}
- PyDict_SetItem(grid_data, oset_name, (PyObject *) cur_data);
- Py_DECREF(cur_data); // still one left
+ Py_XDECREF(cur_data); // still one left
}
// We just want the one reference from the grids_dict value set
Py_DECREF(grid_data);
More information about the yt-svn
mailing list