[Yt-svn] yt-commit r488 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Sun May 18 08:09:59 PDT 2008
Author: mturk
Date: Sun May 18 08:09:55 2008
New Revision: 488
URL: http://yt.spacepope.org/changeset/488
Log:
This 'line_integral' thing is just confusing and probably wrong. I've
eliminated it.
Additionally, weighted projections were not being calculated correctly. I have
decided on a naming scheme:
weighted projection = integral( q * w dl ) / integral ( w dl )
projection = integral( q dl )
which I think is the one everyone else uses. I might split up the calls to
these in the hierarchy and plot collections in order to clarify what's going on
-- projection will still work, but I might add 'line integral' and 'averaged
line integral' or something like that.
Modified:
trunk/yt/lagos/BaseDataTypes.py
trunk/yt/lagos/DerivedFields.py
Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py (original)
+++ trunk/yt/lagos/BaseDataTypes.py Sun May 18 08:09:55 2008
@@ -759,15 +759,14 @@
return True
def __get_dls(self, grid, fields):
+ # Place holder for a time when maybe we will not be doing just
+ # a single dx for every field.
dls = []
convs = []
- for fi, field in enumerate(fields):
- if field in fieldInfo and not fieldInfo[field].line_integral:
- dls.append(1.0)
- convs.append(1.0)
- else:
- dls.append(just_one(grid['d%s' % axis_names[self.axis]]))
- convs.append(self.pf.units[fieldInfo[field].projection_conversion])
+ for field in fields + [self._weight]:
+ if field is None: continue
+ dls.append(just_one(grid['d%s' % axis_names[self.axis]]))
+ convs.append(self.pf.units[fieldInfo[field].projection_conversion])
return na.array(dls), na.array(convs)
def __project_level(self, level, fields):
@@ -780,8 +779,8 @@
g_coords, g_fields = self._project_grid(grid, fields, zero_out)
self.__retval_coords[grid.id] = g_coords
self.__retval_fields[grid.id] = g_fields
- if self._weight is None:
- for fi in range(len(fields)): g_fields[fi] *= dls[fi]
+ for fi in range(len(fields)): g_fields[fi] *= dls[fi]
+ if self._weight is not None: g_coords[3] *= dls[-1]
pbar.update(pi)
pbar.finish()
self.__combine_grids_on_level(level) # In-place
Modified: trunk/yt/lagos/DerivedFields.py
==============================================================================
--- trunk/yt/lagos/DerivedFields.py (original)
+++ trunk/yt/lagos/DerivedFields.py Sun May 18 08:09:55 2008
@@ -130,7 +130,6 @@
units = "", projected_units = "",
take_log = True, validators = None,
particle_type = False, vector_field=False,
- line_integral = True,
projection_conversion = "cm"):
self.name = name
self._function = function
@@ -146,7 +145,6 @@
self._convert_function = convert_function
self.particle_type = particle_type
self.vector_field = vector_field
- self.line_integral = line_integral
self.projection_conversion = projection_conversion
def check_available(self, data):
for validator in self.validators:
@@ -773,11 +771,8 @@
add_field(field, function=lambda a, b: None, take_log=True,
validators=[ValidateDataField(field)], units=r"\rm{g}/\rm{cm}^3")
fieldInfo["x-velocity"].projection_conversion='1'
-fieldInfo["x-velocity"].line_integral = False
fieldInfo["y-velocity"].projection_conversion='1'
-fieldInfo["y-velocity"].line_integral = False
fieldInfo["z-velocity"].projection_conversion='1'
-fieldInfo["z-velocity"].line_integral = False
# Now we override
More information about the yt-svn
mailing list