[Yt-svn] yt: An attempt to get the new multi variate to give exactly iden...
hg at spacepope.org
hg at spacepope.org
Thu Apr 1 11:30:24 PDT 2010
hg Repository: yt
details: yt/rev/b409318f6420
changeset: 1512:b409318f6420
user: Matthew Turk <matthewturk at gmail.com>
date:
Thu Apr 01 11:30:20 2010 -0700
description:
An attempt to get the new multi variate to give exactly identical results. It
still doesn't quite work, because we're trying to replicate an old, ill-defined
result with a new, well-defined method.
diffstat:
yt/_amr_utils/VolumeIntegrator.pyx | 11 +++++++++--
yt/extensions/volume_rendering/TransferFunction.py | 14 ++++++++++----
2 files changed, 19 insertions(+), 6 deletions(-)
diffs (82 lines):
diff -r b02c9c1919db -r b409318f6420 yt/_amr_utils/VolumeIntegrator.pyx
--- a/yt/_amr_utils/VolumeIntegrator.pyx Thu Apr 01 01:03:30 2010 -0700
+++ b/yt/_amr_utils/VolumeIntegrator.pyx Thu Apr 01 11:30:20 2010 -0700
@@ -82,11 +82,12 @@
np.float64_t idbin
int field_id
int weight_field_id
+ int weight_table_id
int nbins
cdef void FIT_initialize_table(FieldInterpolationTable *fit, int nbins,
np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2,
- int field_id, int weight_field_id = -1):
+ int field_id, int weight_field_id = -1, int weight_table_id = -1):
fit.bounds[0] = bounds1; fit.bounds[1] = bounds2
fit.nbins = nbins
fit.dbin = (fit.bounds[1] - fit.bounds[0])/fit.nbins
@@ -95,6 +96,7 @@
fit.values = values
fit.field_id = field_id
fit.weight_field_id = weight_field_id
+ fit.weight_table_id = weight_table_id
cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit,
np.float64_t *dvs):
@@ -153,7 +155,8 @@
<np.float64_t *> temp.data,
tf_obj.tables[i].x_bounds[0],
tf_obj.tables[i].x_bounds[1],
- tf_obj.field_ids[i], tf_obj.weight_field_ids[i])
+ tf_obj.field_ids[i], tf_obj.weight_field_ids[i],
+ tf_obj.weight_table_ids[i])
self.my_field_tables.append((tf_obj.tables[i],
tf_obj.tables[i].y))
self.field_tables[i].field_id = tf_obj.field_ids[i]
@@ -185,6 +188,10 @@
break
for i in range(self.n_field_tables):
self.istorage[i] = FIT_get_value(&self.field_tables[i], dvs)
+ # We have to do this after the interpolation
+ for i in range(self.n_field_tables):
+ fid = self.field_tables[i].weight_table_id
+ if fid != -1: self.istorage[i] *= self.istorage[fid]
for i in range(6):
trgba[i] = self.istorage[self.field_table_ids[i]]
# A few words on opacity. We're going to be integrating equation 1.23
diff -r b02c9c1919db -r b409318f6420 yt/extensions/volume_rendering/TransferFunction.py
--- a/yt/extensions/volume_rendering/TransferFunction.py Thu Apr 01 01:03:30 2010 -0700
+++ b/yt/extensions/volume_rendering/TransferFunction.py Thu Apr 01 11:30:20 2010 -0700
@@ -87,11 +87,14 @@
self.field_ids = [0] * 6 # This correlates fields with tables
self.weight_field_ids = [-1] * 6 # This correlates
self.field_table_ids = [0] * 6
+ self.weight_table_ids = [-1] * 6
- def add_field_table(self, table, field_id, weight_field_id = -1):
+ def add_field_table(self, table, field_id, weight_field_id = -1,
+ weight_table_id = -1):
self.tables.append(table)
self.field_ids[self.n_field_tables] = field_id
self.weight_field_ids[self.n_field_tables] = weight_field_id
+ self.weight_table_ids[self.n_field_tables] = weight_table_id
self.n_field_tables += 1
def link_channels(self, table_id, channels = 0):
@@ -113,10 +116,13 @@
# Now we do the multivariate stuff
# We assign to Density, but do not weight
- for i,tf in enumerate(self.funcs[:-1]):
- self.add_field_table(tf, 0)
+ for i,tf in enumerate(self.funcs):
+ self.add_field_table(tf, 0, weight_table_id = 3)
self.link_channels(i, i)
- self.link_channels(i, i+3)
+
+ self.alpha_two = TransferFunction(x_bounds, nbins)
+ self.add_field_table(self.alpha_two, 0)
+ self.link_channels(4, [3,4,5])
def add_gaussian(self, location, width, height):
for tf, v in zip(self.funcs, height):
More information about the yt-svn
mailing list