[Yt-svn] yt: 4 new changesets
hg at spacepope.org
hg at spacepope.org
Sat Feb 5 14:31:07 PST 2011
hg Repository: yt
details: yt/rev/2431a34715d6
changeset: 3715:2431a34715d6
user: Matthew Turk <matthewturk at gmail.com>
date:
Sat Feb 05 14:50:51 2011 -0500
description:
Fixes to hop_circles
hg Repository: yt
details: yt/rev/a2d94365b2b3
changeset: 3716:a2d94365b2b3
user: Matthew Turk <matthewturk at gmail.com>
date:
Sat Feb 05 17:30:09 2011 -0500
description:
Fixing a bug in add_line in the TransferFunction object and fixing a bug I
introduced a few nights ago in a misguided attempt to enable infinite opacity.
Turns out that we often have negative values when, for instance, volume
rendering density.
hg Repository: yt
details: yt/rev/74ade65d97b3
changeset: 3717:74ade65d97b3
user: Matthew Turk <matthewturk at gmail.com>
date:
Sat Feb 05 14:50:51 2011 -0500
description:
Fixes to hop_circles
hg Repository: yt
details: yt/rev/15d793f6c883
changeset: 3718:15d793f6c883
user: Matthew Turk <matthewturk at gmail.com>
date:
Sat Feb 05 17:31:03 2011 -0500
description:
Merging
diffstat:
yt/utilities/_amr_utils/VolumeIntegrator.pyx | 11 ++---------
yt/visualization/eps_writer.py | 7 +++----
yt/visualization/plot_modifications.py | 9 +++++----
yt/visualization/volume_rendering/transfer_functions.py | 7 ++++---
4 files changed, 14 insertions(+), 20 deletions(-)
diffs (120 lines):
diff -r 01afdaebaaa2 -r 15d793f6c883 yt/utilities/_amr_utils/VolumeIntegrator.pyx
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx Wed Feb 02 22:41:09 2011 -0500
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx Sat Feb 05 17:31:03 2011 -0500
@@ -126,17 +126,14 @@
cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit,
np.float64_t *dvs):
- cdef np.float64_t bv, dy, dd, tf, bp
+ cdef np.float64_t bv, dy, dd, tf
cdef int bin_id
if fit.pass_through == 1: return dvs[fit.field_id]
if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0
bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
- if bin_id < 0 or bin_id + 2 > fit.nbins: return 0.0
dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
- bp = fit.values[bin_id + 1]
- if bp < 0.0: return bp
bv = fit.values[bin_id]
- dy = bp - bv
+ dy = fit.values[bin_id + 1] - bv
if fit.weight_field_id != -1:
return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)
return (bv + dd*dy*fit.idbin)
@@ -222,7 +219,6 @@
# 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 self.istorage[fid] < 0.0: continue
if fid != -1: self.istorage[i] *= self.istorage[fid]
for i in range(6):
trgba[i] = self.istorage[self.field_table_ids[i]]
@@ -239,9 +235,6 @@
# This is the new way: alpha corresponds to opacity of a given
# slice. Previously it was ill-defined, but represented some
# measure of emissivity.
- if trgba[i+3] < 0.0:
- rgba[i] = trgba[i]
- continue
ta = fmax((1.0 - dt*trgba[i+3]), 0.0)
rgba[i ] = dt*trgba[i ] + ta * rgba[i ]
#rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3]
diff -r 01afdaebaaa2 -r 15d793f6c883 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py Wed Feb 02 22:41:09 2011 -0500
+++ b/yt/visualization/eps_writer.py Sat Feb 05 17:31:03 2011 -0500
@@ -29,6 +29,7 @@
import pyx
import numpy as na
from matplotlib import cm
+from _mpl_imports import FigureCanvasAgg
from yt.utilities.definitions import \
x_dict, x_names, \
@@ -389,12 +390,12 @@
_p1.axes[0].set_axis_off() # remove axes
_p1.axes[0].set_position([0,0,1,1]) # rescale figure
_p1.set_facecolor('w') # set background color
- figure_canvas = FigureCanvas(_p1)
+ figure_canvas = FigureCanvasAgg(_p1)
figure_canvas.draw()
size = _p1.get_size_inches() * _p1.dpi
image = pyx.bitmap.image(size[0], size[1], "RGB",
figure_canvas.tostring_rgb())
- figure_canvas.print_png('test.png')
+ #figure_canvas.print_png('test.png')
self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1], image,
width=self.figsize[0],
height=self.figsize[1]))
@@ -547,9 +548,7 @@
proj = "Proj" in plot._type_name and \
plot.data._weight is None
_zlabel = plot.pf.field_info[plot.axis_names["Z"]].get_label(proj)
- print _zlabel
_zlabel = _zlabel.replace("_","\;")
- print _zlabel
_zlog = plot.log_field
else:
_zlabel = plot._z_label.replace("_","\;")
diff -r 01afdaebaaa2 -r 15d793f6c883 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py Wed Feb 02 22:41:09 2011 -0500
+++ b/yt/visualization/plot_modifications.py Sat Feb 05 17:31:03 2011 -0500
@@ -732,8 +732,8 @@
class HopParticleCallback(PlotCallback):
_type_name = "hop_particles"
- def __init__(self, hop_output, p_size=1.0,
- max_number=None, min_size=20, alpha=0.2):
+ def __init__(self, hop_output, max_number, p_size=1.0,
+ min_size=20, alpha=0.2):
"""
Adds particle positions for the members of each halo as identified
by HOP. Along *axis* up to *max_number* groups in *hop_output* that are
@@ -762,8 +762,9 @@
if size < self.min_size: continue
colors = na.ones(size)
plot._axes.hold(True)
- plot._axes.scatter(halo["particle_position_%s" % xf]*dx,
- halo["particle_position_%s" % yf]*dx, edgecolors="None",
+ px = (halo["particle_position_%s" % xf] - x0)*dx
+ py = (halo["particle_position_%s" % yf] - y0)*dy
+ plot._axes.scatter(px, py, edgecolors="None",
s=self.p_size, c='black', alpha=self.alpha)
plot._axes.set_xlim(xx0,xx1)
plot._axes.set_ylim(yy0,yy1)
diff -r 01afdaebaaa2 -r 15d793f6c883 yt/visualization/volume_rendering/transfer_functions.py
--- a/yt/visualization/volume_rendering/transfer_functions.py Wed Feb 02 22:41:09 2011 -0500
+++ b/yt/visualization/volume_rendering/transfer_functions.py Sat Feb 05 17:31:03 2011 -0500
@@ -116,9 +116,10 @@
x0, y0 = start
x1, y1 = stop
slope = (y1-y0)/(x1-x0)
- vals = na.zeros(self.x.shape, 'float64')
- vals[(self.x >= x0) & (self.x <= x1)] = \
- slope * (self.x - x0) + y0
+ # We create a whole new set of values and then backout the ones that do
+ # not satisfy our bounding box arguments
+ vals = slope * (self.x - x0) + y0
+ vals[~((self.x >= x0) & (self.x <= x1))] = 0.0
self.y = na.clip(na.maximum(vals, self.y), 0.0, 1.0)
def add_step(self, start, stop, value):
More information about the yt-svn
mailing list