[Yt-svn] yt-commit r1454 - branches/yt-1.5/yt/lagos trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Thu Sep 17 10:45:12 PDT 2009
Author: mturk
Date: Thu Sep 17 10:45:12 2009
New Revision: 1454
URL: http://yt.spacepope.org/changeset/1454
Log:
Fix for defining conversion functions. Previously the lambda was causing
problems for autodetected fields that had CGS conversion factors defined. This
nested function definition ensures that 'field' is bound appropriately to the
actual field name, and we get the right conversion factors out.
Modified:
branches/yt-1.5/yt/lagos/HierarchyType.py
trunk/yt/lagos/HierarchyType.py
Modified: branches/yt-1.5/yt/lagos/HierarchyType.py
==============================================================================
--- branches/yt-1.5/yt/lagos/HierarchyType.py (original)
+++ branches/yt-1.5/yt/lagos/HierarchyType.py Thu Sep 17 10:45:12 2009
@@ -624,7 +624,11 @@
mylog.info("Adding %s to list of fields", field)
cf = None
if self.parameter_file.has_key(field):
- cf = lambda d: d.convert(field)
+ def external_wrapper(f):
+ def _convert_function(data):
+ return data.convert(f)
+ return _convert_function
+ cf = external_wrapper(field)
add_field(field, lambda a, b: None, convert_function=cf,take_log=False)
self.derived_field_list = []
for field in self.parameter_file.field_info:
Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py (original)
+++ trunk/yt/lagos/HierarchyType.py Thu Sep 17 10:45:12 2009
@@ -616,7 +616,11 @@
mylog.info("Adding %s to list of fields", field)
cf = None
if self.parameter_file.has_key(field):
- cf = lambda d: d.convert(field)
+ def external_wrapper(f):
+ def _convert_function(data):
+ return data.convert(f)
+ return _convert_function
+ cf = external_wrapper(field)
add_field(field, lambda a, b: None, convert_function=cf,take_log=False)
self.derived_field_list = []
for field in self.parameter_file.field_info:
More information about the yt-svn
mailing list