[yt-svn] commit/yt: 4 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Aug 1 10:47:37 PDT 2012
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/aa0d211b8c72/
changeset: aa0d211b8c72
branch: yt
user: MatthewTurk
date: 2012-08-01 16:07:17
summary: Adding field_interpolation_tables to dependency list for grid_traversal.pyx
affected #: 1 file
diff -r f5bf25f2ca64e874fece921aa360bbd7e3f07ca8 -r aa0d211b8c720189ee22913e6b08f828cb9072c6 yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -201,6 +201,7 @@
"yt/utilities/lib/kdtree.h",
"yt/utilities/lib/FixedInterpolator.h",
"yt/utilities/lib/fixed_interpolator.pxd",
+ "yt/utilities/lib/field_interpolation_tables.pxd",
]
)
if os.environ.get("GPERFTOOLS", "no").upper() != "NO":
https://bitbucket.org/yt_analysis/yt/changeset/eba585b92f3d/
changeset: eba585b92f3d
branch: yt
user: MatthewTurk
date: 2012-08-01 16:46:48
summary: Adding a grey_opacity option to the ColorTransferFunction object. Here's an
example script demonstrating it:
http://paste.yt-project.org/show/2605/
When set the False (the default) images look very similar to the old-style VR,
before the refactor:
http://i.imgur.com/CXkIE.png
When set to True, the inner layers get attenuated:
http://i.imgur.com/TRy2q.png
affected #: 3 files
diff -r aa0d211b8c720189ee22913e6b08f828cb9072c6 -r eba585b92f3d264946da329deaea6963ec4e32aa yt/utilities/lib/field_interpolation_tables.pxd
--- a/yt/utilities/lib/field_interpolation_tables.pxd
+++ b/yt/utilities/lib/field_interpolation_tables.pxd
@@ -80,7 +80,7 @@
cdef inline void FIT_eval_transfer(np.float64_t dt, np.float64_t *dvs,
np.float64_t *rgba, int n_fits,
FieldInterpolationTable fits[6],
- int field_table_ids[6]) nogil:
+ int field_table_ids[6], int grey_opacity) nogil:
cdef int i, fid, use
cdef np.float64_t ta, tf, ttot, istorage[6], trgba[6], dot_prod
for i in range(6): istorage[i] = 0.0
@@ -91,11 +91,15 @@
if fid != -1: istorage[i] *= istorage[fid]
for i in range(6):
trgba[i] = istorage[field_table_ids[i]]
- ttot = trgba[0] + trgba[1] + trgba[2]
- ta = fmax(1.0 - dt*ttot, 0.0)
- for i in range(3):
- #ta = 1.0-dt*fmax(trgba[i], 0.0))
- rgba[i] = (1.0-ta)*trgba[i] + ta*rgba[i]
+ if grey_opacity == 1:
+ ttot = trgba[0] + trgba[1] + trgba[2]
+ ta = fmax(1.0 - dt*ttot, 0.0)
+ for i in range(3):
+ rgba[i] = (1.0-ta)*trgba[i] + ta*rgba[i]
+ else:
+ for i in range(3):
+ ta = fmax(1.0-dt*trgba[i], 0.0)
+ rgba[i] = dt*trgba[i] + ta*rgba[i]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -104,7 +108,7 @@
np.float64_t *grad, np.float64_t *l_dir, np.float64_t *l_rgba,
np.float64_t *rgba, int n_fits,
FieldInterpolationTable fits[6],
- int field_table_ids[6]) nogil:
+ int field_table_ids[6], int grey_opacity) nogil:
cdef int i, fid, use
cdef np.float64_t ta, tf, istorage[6], trgba[6], dot_prod
dot_prod = 0.0
@@ -119,7 +123,12 @@
if fid != -1: istorage[i] *= istorage[fid]
for i in range(6):
trgba[i] = istorage[field_table_ids[i]]
- ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)
- for i in range(3):
- rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
+ if grey_opacity == 1:
+ ta = fmax(1.0-dt*(trgba[0] + trgba[1] + trgba[2]), 0.0)
+ for i in range(3):
+ rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
+ else:
+ for i in range(3):
+ ta = fmax(1.0-dt*trgba[i], 0.0)
+ rgba[i] = (1.-ta)*trgba[i]*(1. + dot_prod*l_rgba[i]) + ta * rgba[i]
diff -r aa0d211b8c720189ee22913e6b08f828cb9072c6 -r eba585b92f3d264946da329deaea6963ec4e32aa yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -432,6 +432,7 @@
kdtree_utils.kdtree *star_list
np.float64_t *light_dir
np.float64_t *light_rgba
+ int grey_opacity
cdef class ProjectionSampler(ImageSampler):
@@ -528,7 +529,7 @@
dvs[j] = offset_interpolate(vc.dims, dp,
vc.data[j] + offset)
FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits,
- vri.fits, vri.field_table_ids)
+ vri.fits, vri.field_table_ids, vri.grey_opacity)
for j in range(3):
dp[j] += ds[j]
@@ -567,7 +568,7 @@
FIT_eval_transfer_with_light(dt, dvs, grad,
vri.light_dir, vri.light_rgba,
im.rgba, vri.n_fits,
- vri.fits, vri.field_table_ids)
+ vri.fits, vri.field_table_ids, vri.grey_opacity)
for j in range(3):
dp[j] += ds[j]
free(grad)
@@ -659,7 +660,7 @@
for i in range(3):
pos[i] += local_dds[i]
FIT_eval_transfer(dt, dvs, im.rgba, vri.n_fits, vri.fits,
- vri.field_table_ids)
+ vri.field_table_ids, vri.grey_opacity)
for i in range(vc.n_fields):
dvs[i] += slopes[i]
@@ -690,6 +691,7 @@
malloc(sizeof(FieldInterpolationTable) * 6)
self.vra.n_fits = tf_obj.n_field_tables
assert(self.vra.n_fits <= 6)
+ self.vra.grey_opacity = tf_obj.grey_opacity
self.vra.n_samples = n_samples
self.my_field_tables = []
for i in range(self.vra.n_fits):
@@ -755,6 +757,7 @@
malloc(sizeof(FieldInterpolationTable) * 6)
self.vra.n_fits = tf_obj.n_field_tables
assert(self.vra.n_fits <= 6)
+ self.vra.grey_opacity = tf_obj.grey_opacity
self.vra.n_samples = n_samples
self.vra.light_dir = <np.float64_t *> malloc(sizeof(np.float64_t) * 3)
self.vra.light_rgba = <np.float64_t *> malloc(sizeof(np.float64_t) * 4)
diff -r aa0d211b8c720189ee22913e6b08f828cb9072c6 -r eba585b92f3d264946da329deaea6963ec4e32aa yt/visualization/volume_rendering/transfer_functions.py
--- a/yt/visualization/volume_rendering/transfer_functions.py
+++ b/yt/visualization/volume_rendering/transfer_functions.py
@@ -333,7 +333,7 @@
self.field_table_ids[c] = table_id
class ColorTransferFunction(MultiVariateTransferFunction):
- def __init__(self, x_bounds, nbins=256):
+ def __init__(self, x_bounds, nbins=256, grey_opacity = False):
r"""A complete set of transfer functions for standard color-mapping.
This is the best and easiest way to set up volume rendering. It
@@ -350,6 +350,9 @@
nbins : int
How many bins to calculate; in betwee, linear interpolation is
used, so low values are typically fine.
+ grey_opacity : bool
+ Should opacity be calculated on a channel-by-channel basis, or
+ overall? Useful for opaque renderings.
"""
MultiVariateTransferFunction.__init__(self)
self.x_bounds = x_bounds
@@ -360,6 +363,7 @@
self.blue = TransferFunction(x_bounds, nbins)
self.alpha = TransferFunction(x_bounds, nbins)
self.funcs = (self.red, self.green, self.blue, self.alpha)
+ self.grey_opacity = grey_opacity
# Now we do the multivariate stuff
# We assign to Density, but do not weight
@@ -560,9 +564,10 @@
cmap = get_cmap(colormap)
r,g,b,a = cmap(rel)
if alpha is None: alpha = a
- r *= alpha
- g *= alpha
- b *= alpha
+ if self.grey_opacity:
+ r *= alpha
+ g *= alpha
+ b *= alpha
self.add_gaussian(v, w, [r, g, b, alpha])
mylog.debug("Adding gaussian at %s with width %s and colors %s" % (
v, w, (r,g,b,alpha)))
@@ -639,7 +644,10 @@
if mi is None: mi = col_bounds[0] + dist/(10.0*N)
if ma is None: ma = col_bounds[1] - dist/(10.0*N)
if w is None: w = 0.001 * (ma-mi)/N
- if alpha is None: alpha = na.ones(N, dtype="float64")
+ if alpha is None and self.grey_opacity:
+ alpha = na.ones(N, dtype="float64")
+ elif alpha is None and not self.grey_opacity:
+ alpha = na.logspace(-3, 0, N)
for v, a in zip(na.mgrid[mi:ma:N*1j], alpha):
self.sample_colormap(v, w, a, colormap=colormap, col_bounds=col_bounds)
https://bitbucket.org/yt_analysis/yt/changeset/15518bd68e74/
changeset: 15518bd68e74
branch: yt
user: samskillman
date: 2012-08-01 19:44:58
summary: Modifying .hgignore, and getting rid of *= alpha since it is not necessary.
affected #: 2 files
diff -r eba585b92f3d264946da329deaea6963ec4e32aa -r 15518bd68e74742eb3e60963b269f78d7c8ec1c0 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -9,22 +9,25 @@
yt/utilities/kdtree/forthonf2c.h
yt/utilities/libconfig_wrapper.c
yt/utilities/spatial/ckdtree.c
-yt/utilities/_amr_utils/CICDeposit.c
-yt/utilities/_amr_utils/ContourFinding.c
-yt/utilities/_amr_utils/DepthFirstOctree.c
-yt/utilities/_amr_utils/FixedInterpolator.c
-yt/utilities/_amr_utils/fortran_reader.c
-yt/utilities/_amr_utils/freetype_writer.c
-yt/utilities/_amr_utils/geometry_utils.c
-yt/utilities/_amr_utils/Interpolators.c
-yt/utilities/_amr_utils/kdtree.c
-yt/utilities/_amr_utils/misc_utilities.c
-yt/utilities/_amr_utils/Octree.c
-yt/utilities/_amr_utils/png_writer.c
-yt/utilities/_amr_utils/PointsInVolume.c
-yt/utilities/_amr_utils/QuadTree.c
-yt/utilities/_amr_utils/RayIntegrators.c
-yt/utilities/_amr_utils/VolumeIntegrator.c
+yt/utilities/lib/CICDeposit.c
+yt/utilities/lib/ContourFinding.c
+yt/utilities/lib/DepthFirstOctree.c
+yt/utilities/lib/FixedInterpolator.c
+yt/utilities/lib/fortran_reader.c
+yt/utilities/lib/freetype_writer.c
+yt/utilities/lib/geometry_utils.c
+yt/utilities/lib/Interpolators.c
+yt/utilities/lib/kdtree.c
+yt/utilities/lib/misc_utilities.c
+yt/utilities/lib/Octree.c
+yt/utilities/lib/png_writer.c
+yt/utilities/lib/PointsInVolume.c
+yt/utilities/lib/QuadTree.c
+yt/utilities/lib/RayIntegrators.c
+yt/utilities/lib/VolumeIntegrator.c
+yt/utilities/lib/grid_traversal.c
+yt/utilities/lib/marching_cubes.c
+yt/utilities/lib/png_writer.h
syntax: glob
*.pyc
.*.swp
diff -r eba585b92f3d264946da329deaea6963ec4e32aa -r 15518bd68e74742eb3e60963b269f78d7c8ec1c0 yt/visualization/volume_rendering/transfer_functions.py
--- a/yt/visualization/volume_rendering/transfer_functions.py
+++ b/yt/visualization/volume_rendering/transfer_functions.py
@@ -564,10 +564,6 @@
cmap = get_cmap(colormap)
r,g,b,a = cmap(rel)
if alpha is None: alpha = a
- if self.grey_opacity:
- r *= alpha
- g *= alpha
- b *= alpha
self.add_gaussian(v, w, [r, g, b, alpha])
mylog.debug("Adding gaussian at %s with width %s and colors %s" % (
v, w, (r,g,b,alpha)))
@@ -585,7 +581,6 @@
scale_mult = 1.0
else:
scale_mult = scale_func(tomap,0.0,1.0)
- print scale_mult
self.red.y[rel0:rel1] = cc[:,0]*scale_mult
self.green.y[rel0:rel1]= cc[:,1]*scale_mult
self.blue.y[rel0:rel1] = cc[:,2]*scale_mult
https://bitbucket.org/yt_analysis/yt/changeset/2ff4b9960158/
changeset: 2ff4b9960158
branch: yt
user: samskillman
date: 2012-08-01 19:47:01
summary: Merging
affected #: 2 files
diff -r 15518bd68e74742eb3e60963b269f78d7c8ec1c0 -r 2ff4b99601585798c457e113af85c56dd80ba67f yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1222,7 +1222,7 @@
if unit is None:
unit = 'unitary'
if args.width is None:
- width = (1.0, 'unitary')
+ width = None
else:
width = (args.width, args.unit)
diff -r 15518bd68e74742eb3e60963b269f78d7c8ec1c0 -r 2ff4b99601585798c457e113af85c56dd80ba67f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -149,7 +149,7 @@
bounds = [center[x_dict[axis]]-width[0]/2,
center[x_dict[axis]]+width[0]/2,
center[y_dict[axis]]-width[1]/2,
- center[y_dict[axis]]+width[1]/2]
+ center[y_dict[axis]]+width[1]/2]
return (bounds,center)
def GetOffAxisBoundsAndCenter(normal, center, width, pf, unit='1'):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list