[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Oct 14 14:00:00 PDT 2015
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/f134aa78999f/
Changeset: f134aa78999f
Branch: yt
User: xarthisius
Date: 2015-10-14 18:30:42+00:00
Summary: Rename clip_ratio to stddev_mask, default to 4.0 for yt.volume_render(). Fixes issue #1096
Affected #: 3 files
diff -r 52b57ac913dd7e334914c7e8985f35ebb1618346 -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e yt/data_objects/image_array.py
--- a/yt/data_objects/image_array.py
+++ b/yt/data_objects/image_array.py
@@ -237,7 +237,7 @@
np.clip(out, 0.0, 1.0, out)
return out
- def write_png(self, filename, clip_ratio=None, background='black',
+ def write_png(self, filename, stddev_mask=None, background='black',
rescale=True):
r"""Writes ImageArray to png file.
@@ -245,7 +245,7 @@
----------
filename: string
Note filename not be modified.
- clip_ratio: float, optional
+ stddev_mask: float, optional
Image will be clipped before saving to the standard deviation
of the image multiplied by this value. Useful for enhancing
images. Default: None
@@ -292,10 +292,10 @@
if filename[-4:] != '.png':
filename += '.png'
- if clip_ratio is not None:
+ if stddev_mask is not None:
nz = out[:, :, :3][out[:, :, :3].nonzero()]
return write_bitmap(out.swapaxes(0, 1), filename,
- nz.mean() + clip_ratio*nz.std())
+ nz.mean() + stddev_mask * nz.std())
else:
return write_bitmap(out.swapaxes(0, 1), filename)
diff -r 52b57ac913dd7e334914c7e8985f35ebb1618346 -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e yt/visualization/volume_rendering/scene.py
--- a/yt/visualization/volume_rendering/scene.py
+++ b/yt/visualization/volume_rendering/scene.py
@@ -90,7 +90,7 @@
return self
- def render(self, fname=None, clip_ratio=None, camera=None):
+ def render(self, fname=None, stddev_mask=None, camera=None):
r"""Render all sources in the Scene.
Use the current state of the Scene object to render all sources
@@ -101,9 +101,10 @@
fname: string, optional
If specified, save the rendering as a bitmap to the file "fname".
Default: None
- clip_ratio: float, optional
- If supplied, the 'max_val' argument to write_bitmap will be handed
- clip_ratio * image.std()
+ stddev_mask: float, optional
+ Image will be clipped before saving to the standard deviation
+ of the image multiplied by this value. Useful for enhancing
+ images. Default: None
camera: :class:`Camera`, optional
If specified, use a different :class:`Camera` to render the scene.
@@ -125,7 +126,7 @@
self._validate()
bmp = self.composite(camera=camera)
if fname is not None:
- bmp.write_png(fname, clip_ratio=clip_ratio)
+ bmp.write_png(fname, stddev_mask=stddev_mask)
return bmp
def _validate(self):
diff -r 52b57ac913dd7e334914c7e8985f35ebb1618346 -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e yt/visualization/volume_rendering/volume_rendering.py
--- a/yt/visualization/volume_rendering/volume_rendering.py
+++ b/yt/visualization/volume_rendering/volume_rendering.py
@@ -19,7 +19,7 @@
from yt.funcs import mylog
-def volume_render(data_source, field=None, fname=None, clip_ratio=None):
+def volume_render(data_source, field=None, fname=None, stddev_mask=4.0):
r""" Create a simple volume rendering of a data source.
A helper function that creates a default camera view, transfer
@@ -41,10 +41,10 @@
fname: string, optional
If specified, the resulting rendering will be saved to this filename
in png format.
- clip_ratio: float, optional
- If specified, the resulting image will be clipped before saving,
- using a threshold based on clip_ratio multiplied by the standard
- deviation of the pixel values. Recommended values are between 2 and 6.
+ stddev_mask: float
+ The resulting image will be clipped before saving, using a threshold
+ based on `stddev_mask` multiplied by the standard deviation of the pixel
+ values. Recommended values are between 2 and 6. Default: 4.0
Returns
-------
@@ -58,7 +58,7 @@
Example:
>>> import yt
>>> ds = yt.load("Enzo_64/DD0046/DD0046")
- >>> im, sc = yt.volume_render(ds, fname='test.png', clip_ratio=4.0)
+ >>> im, sc = yt.volume_render(ds, fname='test.png')
"""
data_source = data_source_or_all(data_source)
sc = Scene()
@@ -82,5 +82,5 @@
vol = VolumeSource(data_source, field=field)
sc.add_source(vol)
sc.camera = Camera(data_source)
- im = sc.render(fname=fname, clip_ratio=clip_ratio)
+ im = sc.render(fname=fname, stddev_mask=stddev_mask)
return im, sc
https://bitbucket.org/yt_analysis/yt/commits/727ee5feca6b/
Changeset: 727ee5feca6b
Branch: yt
User: xarthisius
Date: 2015-10-14 19:00:40+00:00
Summary: Rename clip_ratio to sigma_clip. Fixes issue #1096
Affected #: 15 files
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/cookbook/amrkdtree_downsampling.py
--- a/doc/source/cookbook/amrkdtree_downsampling.py
+++ b/doc/source/cookbook/amrkdtree_downsampling.py
@@ -48,12 +48,12 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds=[-27.5, -25.5],
alpha=np.ones(4, dtype='float64'), colormap='RdBu_r')
-sc.render("v2.png", clip_ratio=6.0)
+sc.render("v2.png", sigma_clip=6.0)
# This looks better. Now let's try turning on opacity.
tf.grey_opacity = True
-sc.render("v3.png", clip_ratio=6.0)
+sc.render("v3.png", sigma_clip=6.0)
#
## That seemed to pick out som interesting structures. Now let's bump up the
## opacity.
@@ -61,11 +61,11 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds=[-27.5, -25.5],
alpha=10.0 * np.ones(4, dtype='float64'), colormap='RdBu_r')
-sc.render("v4.png", clip_ratio=6.0)
+sc.render("v4.png", sigma_clip=6.0)
#
## This looks pretty good, now lets go back to the full resolution AMRKDTree
#
render_source.set_volume(kd)
-sc.render("v5.png", clip_ratio=6.0)
+sc.render("v5.png", sigma_clip=6.0)
# This looks great!
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/cookbook/camera_movement.py
--- a/doc/source/cookbook/camera_movement.py
+++ b/doc/source/cookbook/camera_movement.py
@@ -14,15 +14,15 @@
frame = 0
# Move to the maximum density location over 5 frames
for _ in cam.iter_move(max_c, 5):
- sc.render('camera_movement_%04i.png' % frame, clip_ratio=8.0)
+ sc.render('camera_movement_%04i.png' % frame, sigma_clip=8.0)
frame += 1
# Zoom in by a factor of 10 over 5 frames
for _ in cam.iter_zoom(10.0, 5):
- sc.render('camera_movement_%04i.png' % frame, clip_ratio=8.0)
+ sc.render('camera_movement_%04i.png' % frame, sigma_clip=8.0)
frame += 1
# Do a rotation over 5 frames
for _ in cam.iter_rotate(np.pi, 5):
- sc.render('camera_movement_%04i.png' % frame, clip_ratio=8.0)
+ sc.render('camera_movement_%04i.png' % frame, sigma_clip=8.0)
frame += 1
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/cookbook/image_background_colors.py
--- a/doc/source/cookbook/image_background_colors.py
+++ b/doc/source/cookbook/image_background_colors.py
@@ -9,7 +9,7 @@
ds = yt.load("Enzo_64/DD0043/data0043")
im, sc = yt.volume_render(ds, 'density')
-im.write_png("original.png", clip_ratio=8.0)
+im.write_png("original.png", sigma_clip=8.0)
# Our image array can now be transformed to include different background
# colors. By default, the background color is black. The following
@@ -22,10 +22,10 @@
# None (0.,0.,0.,0.) <-- Transparent!
# any rgba list/array: [r,g,b,a], bounded by 0..1
-# We include the clip_ratio=8 keyword here to bring out more contrast between
+# We include the sigma_clip=8 keyword here to bring out more contrast between
# the background and foreground, but it is entirely optional.
-im.write_png('black_bg.png', background='black', clip_ratio=8.0)
-im.write_png('white_bg.png', background='white', clip_ratio=8.0)
-im.write_png('green_bg.png', background=[0.,1.,0.,1.], clip_ratio=8.0)
-im.write_png('transparent_bg.png', background=None, clip_ratio=8.0)
+im.write_png('black_bg.png', background='black', sigma_clip=8.0)
+im.write_png('white_bg.png', background='white', sigma_clip=8.0)
+im.write_png('green_bg.png', background=[0.,1.,0.,1.], sigma_clip=8.0)
+im.write_png('transparent_bg.png', background=None, sigma_clip=8.0)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/cookbook/opaque_rendering.py
--- a/doc/source/cookbook/opaque_rendering.py
+++ b/doc/source/cookbook/opaque_rendering.py
@@ -5,14 +5,14 @@
# We start by building a default volume rendering scene
-im, sc = yt.volume_render(ds, field=("gas","density"), fname="v0.png", clip_ratio=6.0)
+im, sc = yt.volume_render(ds, field=("gas","density"), fname="v0.png", sigma_clip=6.0)
sc.camera.set_width(ds.arr(0.1,'code_length'))
tf = sc.get_source(0).transfer_function
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=np.logspace(-3,0,4), colormap = 'RdBu_r')
-im = sc.render("v1.png", clip_ratio=6.0)
+im = sc.render("v1.png", sigma_clip=6.0)
# In this case, the default alphas used (np.logspace(-3,0,Nbins)) does not
# accentuate the outer regions of the galaxy. Let's start by bringing up the
@@ -22,27 +22,27 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=np.logspace(0,0,4), colormap = 'RdBu_r')
-im = sc.render("v2.png", clip_ratio=6.0)
+im = sc.render("v2.png", sigma_clip=6.0)
# Now let's set the grey_opacity to True. This should make the inner portions
# start to be obcured
tf.grey_opacity = True
-im = sc.render("v3.png", clip_ratio=6.0)
+im = sc.render("v3.png", sigma_clip=6.0)
# That looks pretty good, but let's start bumping up the opacity.
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=10.0*np.ones(4,dtype='float64'), colormap = 'RdBu_r')
-im = sc.render("v4.png", clip_ratio=6.0)
+im = sc.render("v4.png", sigma_clip=6.0)
# Let's bump up again to see if we can obscure the inner contour.
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=30.0*np.ones(4,dtype='float64'), colormap = 'RdBu_r')
-im = sc.render("v5.png", clip_ratio=6.0)
+im = sc.render("v5.png", sigma_clip=6.0)
# Now we are losing sight of everything. Let's see if we can obscure the next
# layer
@@ -50,13 +50,13 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=100.0*np.ones(4,dtype='float64'), colormap = 'RdBu_r')
-im = sc.render("v6.png", clip_ratio=6.0)
+im = sc.render("v6.png", sigma_clip=6.0)
# That is very opaque! Now lets go back and see what it would look like with
# grey_opacity = False
tf.grey_opacity=False
-im = sc.render("v7.png", clip_ratio=6.0)
+im = sc.render("v7.png", sigma_clip=6.0)
# That looks pretty different, but the main thing is that you can see that the
# inner contours are somewhat visible again.
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/cookbook/simple_volume_rendering.py
--- a/doc/source/cookbook/simple_volume_rendering.py
+++ b/doc/source/cookbook/simple_volume_rendering.py
@@ -6,14 +6,14 @@
# Create a volume rendering, which will determine data bounds, use the first
# acceptable field in the field_list, and set up a default transfer function.
-#im, sc = yt.volume_render(ds, fname="%s_volume_rendered.png" % ds, clip_ratio=8.0)
+#im, sc = yt.volume_render(ds, fname="%s_volume_rendered.png" % ds, sigma_clip=8.0)
# You can easily specify a different field
-im, sc = yt.volume_render(ds, field=('gas','density'), fname="%s_density_volume_rendered.png" % ds, clip_ratio=8.0)
+im, sc = yt.volume_render(ds, field=('gas','density'), fname="%s_density_volume_rendered.png" % ds, sigma_clip=8.0)
# Now increase the resolution
sc.camera.resolution = (512, 512)
-im = sc.render(fname='big.png', clip_ratio=8.0)
+im = sc.render(fname='big.png', sigma_clip=8.0)
# Now modify the transfer function
# First get the render source, in this case the entire domain, with field ('gas','density')
@@ -25,4 +25,4 @@
np.log10(ds.quan(5.0e-31, 'g/cm**3')),
np.log10(ds.quan(1.0e-29, 'g/cm**3')),
scale=30.0, colormap='RdBu_r')
-im = sc.render(fname='new_tf.png', clip_ratio=None)
+im = sc.render(fname='new_tf.png', sigma_clip=None)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/cookbook/various_lens.py
--- a/doc/source/cookbook/various_lens.py
+++ b/doc/source/cookbook/various_lens.py
@@ -34,7 +34,7 @@
cam.set_width(ds.domain_width * 0.5)
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_plane-parallel.png', clip_ratio=6.0)
+sc.render('lens_plane-parallel.png', sigma_clip=6.0)
# Perspective lens
cam = Camera(ds, lens_type='perspective')
@@ -50,7 +50,7 @@
cam.set_width(ds.domain_width * 0.5)
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_perspective.png', clip_ratio=6.0)
+sc.render('lens_perspective.png', sigma_clip=6.0)
# Stereo-perspective lens
cam = Camera(ds, lens_type='stereo-perspective')
@@ -65,7 +65,7 @@
cam.lens.disparity = ds.domain_width[0] * 1.e-3
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_stereo-perspective.png', clip_ratio=6.0)
+sc.render('lens_stereo-perspective.png', sigma_clip=6.0)
# Fisheye lens
dd = ds.sphere(ds.domain_center, ds.domain_width[0] / 10)
@@ -79,7 +79,7 @@
cam.lens.fov = 360.0
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_fisheye.png', clip_ratio=6.0)
+sc.render('lens_fisheye.png', sigma_clip=6.0)
# Spherical lens
cam = Camera(ds, lens_type='spherical')
@@ -96,7 +96,7 @@
cam.set_width(ds.domain_width * 0.5)
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_spherical.png', clip_ratio=6.0)
+sc.render('lens_spherical.png', sigma_clip=6.0)
# Stereo-spherical lens
cam = Camera(ds, lens_type='stereo-spherical')
@@ -111,4 +111,4 @@
cam.lens.disparity = ds.domain_width[0] * 1.e-3
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_stereo-spherical.png', clip_ratio=6.0)
\ No newline at end of file
+sc.render('lens_stereo-spherical.png', sigma_clip=6.0)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 doc/source/quickstart/6)_Volume_Rendering.ipynb
--- a/doc/source/quickstart/6)_Volume_Rendering.ipynb
+++ b/doc/source/quickstart/6)_Volume_Rendering.ipynb
@@ -56,14 +56,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "If we want to apply a clipping, we can specify the `clip_ratio`. This will clip the upper bounds to this value times the standard deviation of the values in the image array."
+ "If we want to apply a clipping, we can specify the `sigma_clip`. This will clip the upper bounds to this value times the standard deviation of the values in the image array."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "cam.show(clip_ratio=4)"
+ "cam.show(sigma_clip=4)"
],
"language": "python",
"metadata": {},
@@ -83,7 +83,7 @@
"tf = yt.ColorTransferFunction((-28, -25))\n",
"tf.add_layers(4, w=0.03)\n",
"cam = ds.camera([0.5, 0.5, 0.5], [1.0, 1.0, 1.0], (20.0, 'kpc'), 512, tf, no_ghost=False)\n",
- "cam.show(clip_ratio=4.0)"
+ "cam.show(sigma_clip=4.0)"
],
"language": "python",
"metadata": {},
@@ -93,4 +93,4 @@
"metadata": {}
}
]
-}
\ No newline at end of file
+}
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/data_objects/image_array.py
--- a/yt/data_objects/image_array.py
+++ b/yt/data_objects/image_array.py
@@ -237,7 +237,7 @@
np.clip(out, 0.0, 1.0, out)
return out
- def write_png(self, filename, stddev_mask=None, background='black',
+ def write_png(self, filename, sigma_clip=None, background='black',
rescale=True):
r"""Writes ImageArray to png file.
@@ -245,7 +245,7 @@
----------
filename: string
Note filename not be modified.
- stddev_mask: float, optional
+ sigma_clip: float, optional
Image will be clipped before saving to the standard deviation
of the image multiplied by this value. Useful for enhancing
images. Default: None
@@ -292,10 +292,10 @@
if filename[-4:] != '.png':
filename += '.png'
- if stddev_mask is not None:
+ if sigma_clip is not None:
nz = out[:, :, :3][out[:, :, :3].nonzero()]
return write_bitmap(out.swapaxes(0, 1), filename,
- nz.mean() + stddev_mask * nz.std())
+ nz.mean() + sigma_clip * nz.std())
else:
return write_bitmap(out.swapaxes(0, 1), filename)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/scene.py
--- a/yt/visualization/volume_rendering/scene.py
+++ b/yt/visualization/volume_rendering/scene.py
@@ -90,7 +90,7 @@
return self
- def render(self, fname=None, stddev_mask=None, camera=None):
+ def render(self, fname=None, sigma_clip=None, camera=None):
r"""Render all sources in the Scene.
Use the current state of the Scene object to render all sources
@@ -101,7 +101,7 @@
fname: string, optional
If specified, save the rendering as a bitmap to the file "fname".
Default: None
- stddev_mask: float, optional
+ sigma_clip: float, optional
Image will be clipped before saving to the standard deviation
of the image multiplied by this value. Useful for enhancing
images. Default: None
@@ -126,7 +126,7 @@
self._validate()
bmp = self.composite(camera=camera)
if fname is not None:
- bmp.write_png(fname, stddev_mask=stddev_mask)
+ bmp.write_png(fname, sigma_clip=sigma_clip)
return bmp
def _validate(self):
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/tests/rotation_volume_rendering.py
--- a/yt/visualization/volume_rendering/tests/rotation_volume_rendering.py
+++ b/yt/visualization/volume_rendering/tests/rotation_volume_rendering.py
@@ -21,4 +21,4 @@
frames = 10
for i in range(frames):
sc.camera.yaw(angle/frames)
- sc.render('test_rot_%04i.png' % i, clip_ratio=6.0)
+ sc.render('test_rot_%04i.png' % i, sigma_clip=6.0)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/tests/simple_volume_rendering.py
--- a/yt/visualization/volume_rendering/tests/simple_volume_rendering.py
+++ b/yt/visualization/volume_rendering/tests/simple_volume_rendering.py
@@ -14,4 +14,4 @@
fake_random_ds
ds = fake_random_ds(32)
-im, sc = yt.volume_render(ds, fname='test.png', clip_ratio=4.0)
+im, sc = yt.volume_render(ds, fname='test.png', sigma_clip=4.0)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/tests/test_lenses.py
--- a/yt/visualization/volume_rendering/tests/test_lenses.py
+++ b/yt/visualization/volume_rendering/tests/test_lenses.py
@@ -28,7 +28,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_perspective_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_perspective_%s.png' % field[1], sigma_clip=6.0)
def test_stereoperspective_lens():
#ds = fake_random_ds(32, fields = field)
@@ -42,7 +42,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_stereoperspective_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_stereoperspective_%s.png' % field[1], sigma_clip=6.0)
def test_fisheye_lens():
ds = fake_random_ds(32, fields = field)
@@ -60,7 +60,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_fisheye_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_fisheye_%s.png' % field[1], sigma_clip=6.0)
def test_plane_lens():
ds = fake_random_ds(32, fields = field)
@@ -76,7 +76,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_plane_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_plane_%s.png' % field[1], sigma_clip=6.0)
def test_spherical_lens():
#ds = fake_random_ds(32, fields = field)
@@ -90,7 +90,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_spherical_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_spherical_%s.png' % field[1], sigma_clip=6.0)
def test_stereospherical_lens():
#ds = fake_random_ds(32, fields = field)
@@ -106,5 +106,5 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_stereospherical_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_stereospherical_%s.png' % field[1], sigma_clip=6.0)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/tests/test_scene.py
--- a/yt/visualization/volume_rendering/tests/test_scene.py
+++ b/yt/visualization/volume_rendering/tests/test_scene.py
@@ -48,9 +48,9 @@
mi_bound = ((ma-mi)*(0.10))+mi
ma_bound = ((ma-mi)*(0.90))+mi
tf.map_to_colormap(mi_bound, ma_bound, scale=0.01, colormap='Reds_r')
- sc.render('test_scene.png', clip_ratio=6.0)
+ sc.render('test_scene.png', sigma_clip=6.0)
nrot = 2
for i in range(nrot):
sc.camera.pitch(2*np.pi/nrot)
- sc.render('test_rot_%04i.png' % i, clip_ratio=6.0)
+ sc.render('test_rot_%04i.png' % i, sigma_clip=6.0)
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/tests/test_simple_vr.py
--- a/yt/visualization/volume_rendering/tests/test_simple_vr.py
+++ b/yt/visualization/volume_rendering/tests/test_simple_vr.py
@@ -15,7 +15,7 @@
def test_simple_vr():
ds = fake_random_ds(32)
- im, sc = yt.volume_render(ds, fname='test.png', clip_ratio=4.0)
+ im, sc = yt.volume_render(ds, fname='test.png', sigma_clip=4.0)
print(sc)
return im, sc
diff -r f134aa78999fa9d922a6e9cf6746b90ff94dea4e -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 yt/visualization/volume_rendering/volume_rendering.py
--- a/yt/visualization/volume_rendering/volume_rendering.py
+++ b/yt/visualization/volume_rendering/volume_rendering.py
@@ -19,7 +19,7 @@
from yt.funcs import mylog
-def volume_render(data_source, field=None, fname=None, stddev_mask=4.0):
+def volume_render(data_source, field=None, fname=None, sigma_clip=4.0):
r""" Create a simple volume rendering of a data source.
A helper function that creates a default camera view, transfer
@@ -41,9 +41,9 @@
fname: string, optional
If specified, the resulting rendering will be saved to this filename
in png format.
- stddev_mask: float
+ sigma_clip: float
The resulting image will be clipped before saving, using a threshold
- based on `stddev_mask` multiplied by the standard deviation of the pixel
+ based on `sigma_clip` multiplied by the standard deviation of the pixel
values. Recommended values are between 2 and 6. Default: 4.0
Returns
@@ -82,5 +82,5 @@
vol = VolumeSource(data_source, field=field)
sc.add_source(vol)
sc.camera = Camera(data_source)
- im = sc.render(fname=fname, stddev_mask=stddev_mask)
+ im = sc.render(fname=fname, sigma_clip=sigma_clip)
return im, sc
https://bitbucket.org/yt_analysis/yt/commits/f9a9135a1abb/
Changeset: f9a9135a1abb
Branch: yt
User: xarthisius
Date: 2015-10-14 19:04:49+00:00
Summary: Deprecate 'clip_ratio' keyword in ImageArray.write_png method
Affected #: 1 file
diff -r 727ee5feca6b8e7021e75322e854b10b1ef1b597 -r f9a9135a1abb73443ed9b6ed0fb5758e24eab544 yt/data_objects/image_array.py
--- a/yt/data_objects/image_array.py
+++ b/yt/data_objects/image_array.py
@@ -11,10 +11,12 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import warnings
import numpy as np
from yt.visualization.image_writer import write_bitmap, write_image
from yt.units.yt_array import YTArray
+
class ImageArray(YTArray):
r"""A custom Numpy ndarray used for images.
@@ -238,7 +240,7 @@
return out
def write_png(self, filename, sigma_clip=None, background='black',
- rescale=True):
+ rescale=True, clip_ratio=None):
r"""Writes ImageArray to png file.
Parameters
@@ -292,6 +294,10 @@
if filename[-4:] != '.png':
filename += '.png'
+ if clip_ratio is not None:
+ warnings.warn("'clip_ratio' keyword is deprecated. Use 'sigma_clip' instead")
+ sigma_clip = clip_ratio
+
if sigma_clip is not None:
nz = out[:, :, :3][out[:, :, :3].nonzero()]
return write_bitmap(out.swapaxes(0, 1), filename,
https://bitbucket.org/yt_analysis/yt/commits/d3ba9ef67a78/
Changeset: d3ba9ef67a78
Branch: yt
User: ngoldbaum
Date: 2015-10-14 20:59:48+00:00
Summary: Merged in xarthisius/yt (pull request #1794)
[experimental] Rename clip_ratio to sigma_clip. Fixes issue #1096
Affected #: 15 files
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/cookbook/amrkdtree_downsampling.py
--- a/doc/source/cookbook/amrkdtree_downsampling.py
+++ b/doc/source/cookbook/amrkdtree_downsampling.py
@@ -48,12 +48,12 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds=[-27.5, -25.5],
alpha=np.ones(4, dtype='float64'), colormap='RdBu_r')
-sc.render("v2.png", clip_ratio=6.0)
+sc.render("v2.png", sigma_clip=6.0)
# This looks better. Now let's try turning on opacity.
tf.grey_opacity = True
-sc.render("v3.png", clip_ratio=6.0)
+sc.render("v3.png", sigma_clip=6.0)
#
## That seemed to pick out som interesting structures. Now let's bump up the
## opacity.
@@ -61,11 +61,11 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds=[-27.5, -25.5],
alpha=10.0 * np.ones(4, dtype='float64'), colormap='RdBu_r')
-sc.render("v4.png", clip_ratio=6.0)
+sc.render("v4.png", sigma_clip=6.0)
#
## This looks pretty good, now lets go back to the full resolution AMRKDTree
#
render_source.set_volume(kd)
-sc.render("v5.png", clip_ratio=6.0)
+sc.render("v5.png", sigma_clip=6.0)
# This looks great!
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/cookbook/camera_movement.py
--- a/doc/source/cookbook/camera_movement.py
+++ b/doc/source/cookbook/camera_movement.py
@@ -14,15 +14,15 @@
frame = 0
# Move to the maximum density location over 5 frames
for _ in cam.iter_move(max_c, 5):
- sc.render('camera_movement_%04i.png' % frame, clip_ratio=8.0)
+ sc.render('camera_movement_%04i.png' % frame, sigma_clip=8.0)
frame += 1
# Zoom in by a factor of 10 over 5 frames
for _ in cam.iter_zoom(10.0, 5):
- sc.render('camera_movement_%04i.png' % frame, clip_ratio=8.0)
+ sc.render('camera_movement_%04i.png' % frame, sigma_clip=8.0)
frame += 1
# Do a rotation over 5 frames
for _ in cam.iter_rotate(np.pi, 5):
- sc.render('camera_movement_%04i.png' % frame, clip_ratio=8.0)
+ sc.render('camera_movement_%04i.png' % frame, sigma_clip=8.0)
frame += 1
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/cookbook/image_background_colors.py
--- a/doc/source/cookbook/image_background_colors.py
+++ b/doc/source/cookbook/image_background_colors.py
@@ -9,7 +9,7 @@
ds = yt.load("Enzo_64/DD0043/data0043")
im, sc = yt.volume_render(ds, 'density')
-im.write_png("original.png", clip_ratio=8.0)
+im.write_png("original.png", sigma_clip=8.0)
# Our image array can now be transformed to include different background
# colors. By default, the background color is black. The following
@@ -22,10 +22,10 @@
# None (0.,0.,0.,0.) <-- Transparent!
# any rgba list/array: [r,g,b,a], bounded by 0..1
-# We include the clip_ratio=8 keyword here to bring out more contrast between
+# We include the sigma_clip=8 keyword here to bring out more contrast between
# the background and foreground, but it is entirely optional.
-im.write_png('black_bg.png', background='black', clip_ratio=8.0)
-im.write_png('white_bg.png', background='white', clip_ratio=8.0)
-im.write_png('green_bg.png', background=[0.,1.,0.,1.], clip_ratio=8.0)
-im.write_png('transparent_bg.png', background=None, clip_ratio=8.0)
+im.write_png('black_bg.png', background='black', sigma_clip=8.0)
+im.write_png('white_bg.png', background='white', sigma_clip=8.0)
+im.write_png('green_bg.png', background=[0.,1.,0.,1.], sigma_clip=8.0)
+im.write_png('transparent_bg.png', background=None, sigma_clip=8.0)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/cookbook/opaque_rendering.py
--- a/doc/source/cookbook/opaque_rendering.py
+++ b/doc/source/cookbook/opaque_rendering.py
@@ -5,14 +5,14 @@
# We start by building a default volume rendering scene
-im, sc = yt.volume_render(ds, field=("gas","density"), fname="v0.png", clip_ratio=6.0)
+im, sc = yt.volume_render(ds, field=("gas","density"), fname="v0.png", sigma_clip=6.0)
sc.camera.set_width(ds.arr(0.1,'code_length'))
tf = sc.get_source(0).transfer_function
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=np.logspace(-3,0,4), colormap = 'RdBu_r')
-im = sc.render("v1.png", clip_ratio=6.0)
+im = sc.render("v1.png", sigma_clip=6.0)
# In this case, the default alphas used (np.logspace(-3,0,Nbins)) does not
# accentuate the outer regions of the galaxy. Let's start by bringing up the
@@ -22,27 +22,27 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=np.logspace(0,0,4), colormap = 'RdBu_r')
-im = sc.render("v2.png", clip_ratio=6.0)
+im = sc.render("v2.png", sigma_clip=6.0)
# Now let's set the grey_opacity to True. This should make the inner portions
# start to be obcured
tf.grey_opacity = True
-im = sc.render("v3.png", clip_ratio=6.0)
+im = sc.render("v3.png", sigma_clip=6.0)
# That looks pretty good, but let's start bumping up the opacity.
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=10.0*np.ones(4,dtype='float64'), colormap = 'RdBu_r')
-im = sc.render("v4.png", clip_ratio=6.0)
+im = sc.render("v4.png", sigma_clip=6.0)
# Let's bump up again to see if we can obscure the inner contour.
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=30.0*np.ones(4,dtype='float64'), colormap = 'RdBu_r')
-im = sc.render("v5.png", clip_ratio=6.0)
+im = sc.render("v5.png", sigma_clip=6.0)
# Now we are losing sight of everything. Let's see if we can obscure the next
# layer
@@ -50,13 +50,13 @@
tf.clear()
tf.add_layers(4, 0.01, col_bounds = [-27.5,-25.5],
alpha=100.0*np.ones(4,dtype='float64'), colormap = 'RdBu_r')
-im = sc.render("v6.png", clip_ratio=6.0)
+im = sc.render("v6.png", sigma_clip=6.0)
# That is very opaque! Now lets go back and see what it would look like with
# grey_opacity = False
tf.grey_opacity=False
-im = sc.render("v7.png", clip_ratio=6.0)
+im = sc.render("v7.png", sigma_clip=6.0)
# That looks pretty different, but the main thing is that you can see that the
# inner contours are somewhat visible again.
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/cookbook/simple_volume_rendering.py
--- a/doc/source/cookbook/simple_volume_rendering.py
+++ b/doc/source/cookbook/simple_volume_rendering.py
@@ -6,14 +6,14 @@
# Create a volume rendering, which will determine data bounds, use the first
# acceptable field in the field_list, and set up a default transfer function.
-#im, sc = yt.volume_render(ds, fname="%s_volume_rendered.png" % ds, clip_ratio=8.0)
+#im, sc = yt.volume_render(ds, fname="%s_volume_rendered.png" % ds, sigma_clip=8.0)
# You can easily specify a different field
-im, sc = yt.volume_render(ds, field=('gas','density'), fname="%s_density_volume_rendered.png" % ds, clip_ratio=8.0)
+im, sc = yt.volume_render(ds, field=('gas','density'), fname="%s_density_volume_rendered.png" % ds, sigma_clip=8.0)
# Now increase the resolution
sc.camera.resolution = (512, 512)
-im = sc.render(fname='big.png', clip_ratio=8.0)
+im = sc.render(fname='big.png', sigma_clip=8.0)
# Now modify the transfer function
# First get the render source, in this case the entire domain, with field ('gas','density')
@@ -25,4 +25,4 @@
np.log10(ds.quan(5.0e-31, 'g/cm**3')),
np.log10(ds.quan(1.0e-29, 'g/cm**3')),
scale=30.0, colormap='RdBu_r')
-im = sc.render(fname='new_tf.png', clip_ratio=None)
+im = sc.render(fname='new_tf.png', sigma_clip=None)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/cookbook/various_lens.py
--- a/doc/source/cookbook/various_lens.py
+++ b/doc/source/cookbook/various_lens.py
@@ -34,7 +34,7 @@
cam.set_width(ds.domain_width * 0.5)
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_plane-parallel.png', clip_ratio=6.0)
+sc.render('lens_plane-parallel.png', sigma_clip=6.0)
# Perspective lens
cam = Camera(ds, lens_type='perspective')
@@ -50,7 +50,7 @@
cam.set_width(ds.domain_width * 0.5)
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_perspective.png', clip_ratio=6.0)
+sc.render('lens_perspective.png', sigma_clip=6.0)
# Stereo-perspective lens
cam = Camera(ds, lens_type='stereo-perspective')
@@ -65,7 +65,7 @@
cam.lens.disparity = ds.domain_width[0] * 1.e-3
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_stereo-perspective.png', clip_ratio=6.0)
+sc.render('lens_stereo-perspective.png', sigma_clip=6.0)
# Fisheye lens
dd = ds.sphere(ds.domain_center, ds.domain_width[0] / 10)
@@ -79,7 +79,7 @@
cam.lens.fov = 360.0
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_fisheye.png', clip_ratio=6.0)
+sc.render('lens_fisheye.png', sigma_clip=6.0)
# Spherical lens
cam = Camera(ds, lens_type='spherical')
@@ -96,7 +96,7 @@
cam.set_width(ds.domain_width * 0.5)
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_spherical.png', clip_ratio=6.0)
+sc.render('lens_spherical.png', sigma_clip=6.0)
# Stereo-spherical lens
cam = Camera(ds, lens_type='stereo-spherical')
@@ -111,4 +111,4 @@
cam.lens.disparity = ds.domain_width[0] * 1.e-3
sc.camera = cam
sc.add_source(vol)
-sc.render('lens_stereo-spherical.png', clip_ratio=6.0)
\ No newline at end of file
+sc.render('lens_stereo-spherical.png', sigma_clip=6.0)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f doc/source/quickstart/6)_Volume_Rendering.ipynb
--- a/doc/source/quickstart/6)_Volume_Rendering.ipynb
+++ b/doc/source/quickstart/6)_Volume_Rendering.ipynb
@@ -56,14 +56,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "If we want to apply a clipping, we can specify the `clip_ratio`. This will clip the upper bounds to this value times the standard deviation of the values in the image array."
+ "If we want to apply a clipping, we can specify the `sigma_clip`. This will clip the upper bounds to this value times the standard deviation of the values in the image array."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "cam.show(clip_ratio=4)"
+ "cam.show(sigma_clip=4)"
],
"language": "python",
"metadata": {},
@@ -83,7 +83,7 @@
"tf = yt.ColorTransferFunction((-28, -25))\n",
"tf.add_layers(4, w=0.03)\n",
"cam = ds.camera([0.5, 0.5, 0.5], [1.0, 1.0, 1.0], (20.0, 'kpc'), 512, tf, no_ghost=False)\n",
- "cam.show(clip_ratio=4.0)"
+ "cam.show(sigma_clip=4.0)"
],
"language": "python",
"metadata": {},
@@ -93,4 +93,4 @@
"metadata": {}
}
]
-}
\ No newline at end of file
+}
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/data_objects/image_array.py
--- a/yt/data_objects/image_array.py
+++ b/yt/data_objects/image_array.py
@@ -11,10 +11,12 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import warnings
import numpy as np
from yt.visualization.image_writer import write_bitmap, write_image
from yt.units.yt_array import YTArray
+
class ImageArray(YTArray):
r"""A custom Numpy ndarray used for images.
@@ -237,15 +239,15 @@
np.clip(out, 0.0, 1.0, out)
return out
- def write_png(self, filename, clip_ratio=None, background='black',
- rescale=True):
+ def write_png(self, filename, sigma_clip=None, background='black',
+ rescale=True, clip_ratio=None):
r"""Writes ImageArray to png file.
Parameters
----------
filename: string
Note filename not be modified.
- clip_ratio: float, optional
+ sigma_clip: float, optional
Image will be clipped before saving to the standard deviation
of the image multiplied by this value. Useful for enhancing
images. Default: None
@@ -293,9 +295,13 @@
filename += '.png'
if clip_ratio is not None:
+ warnings.warn("'clip_ratio' keyword is deprecated. Use 'sigma_clip' instead")
+ sigma_clip = clip_ratio
+
+ if sigma_clip is not None:
nz = out[:, :, :3][out[:, :, :3].nonzero()]
return write_bitmap(out.swapaxes(0, 1), filename,
- nz.mean() + clip_ratio*nz.std())
+ nz.mean() + sigma_clip * nz.std())
else:
return write_bitmap(out.swapaxes(0, 1), filename)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/scene.py
--- a/yt/visualization/volume_rendering/scene.py
+++ b/yt/visualization/volume_rendering/scene.py
@@ -90,7 +90,7 @@
return self
- def render(self, fname=None, clip_ratio=None, camera=None):
+ def render(self, fname=None, sigma_clip=None, camera=None):
r"""Render all sources in the Scene.
Use the current state of the Scene object to render all sources
@@ -101,9 +101,10 @@
fname: string, optional
If specified, save the rendering as a bitmap to the file "fname".
Default: None
- clip_ratio: float, optional
- If supplied, the 'max_val' argument to write_bitmap will be handed
- clip_ratio * image.std()
+ sigma_clip: float, optional
+ Image will be clipped before saving to the standard deviation
+ of the image multiplied by this value. Useful for enhancing
+ images. Default: None
camera: :class:`Camera`, optional
If specified, use a different :class:`Camera` to render the scene.
@@ -125,7 +126,7 @@
self._validate()
bmp = self.composite(camera=camera)
if fname is not None:
- bmp.write_png(fname, clip_ratio=clip_ratio)
+ bmp.write_png(fname, sigma_clip=sigma_clip)
return bmp
def _validate(self):
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/tests/rotation_volume_rendering.py
--- a/yt/visualization/volume_rendering/tests/rotation_volume_rendering.py
+++ b/yt/visualization/volume_rendering/tests/rotation_volume_rendering.py
@@ -21,4 +21,4 @@
frames = 10
for i in range(frames):
sc.camera.yaw(angle/frames)
- sc.render('test_rot_%04i.png' % i, clip_ratio=6.0)
+ sc.render('test_rot_%04i.png' % i, sigma_clip=6.0)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/tests/simple_volume_rendering.py
--- a/yt/visualization/volume_rendering/tests/simple_volume_rendering.py
+++ b/yt/visualization/volume_rendering/tests/simple_volume_rendering.py
@@ -14,4 +14,4 @@
fake_random_ds
ds = fake_random_ds(32)
-im, sc = yt.volume_render(ds, fname='test.png', clip_ratio=4.0)
+im, sc = yt.volume_render(ds, fname='test.png', sigma_clip=4.0)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/tests/test_lenses.py
--- a/yt/visualization/volume_rendering/tests/test_lenses.py
+++ b/yt/visualization/volume_rendering/tests/test_lenses.py
@@ -28,7 +28,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_perspective_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_perspective_%s.png' % field[1], sigma_clip=6.0)
def test_stereoperspective_lens():
#ds = fake_random_ds(32, fields = field)
@@ -42,7 +42,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_stereoperspective_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_stereoperspective_%s.png' % field[1], sigma_clip=6.0)
def test_fisheye_lens():
ds = fake_random_ds(32, fields = field)
@@ -60,7 +60,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_fisheye_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_fisheye_%s.png' % field[1], sigma_clip=6.0)
def test_plane_lens():
ds = fake_random_ds(32, fields = field)
@@ -76,7 +76,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_plane_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_plane_%s.png' % field[1], sigma_clip=6.0)
def test_spherical_lens():
#ds = fake_random_ds(32, fields = field)
@@ -90,7 +90,7 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_spherical_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_spherical_%s.png' % field[1], sigma_clip=6.0)
def test_stereospherical_lens():
#ds = fake_random_ds(32, fields = field)
@@ -106,5 +106,5 @@
tf.grey_opacity = True
sc.camera = cam
sc.add_source(vol)
- sc.render('test_stereospherical_%s.png' % field[1], clip_ratio=6.0)
+ sc.render('test_stereospherical_%s.png' % field[1], sigma_clip=6.0)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/tests/test_scene.py
--- a/yt/visualization/volume_rendering/tests/test_scene.py
+++ b/yt/visualization/volume_rendering/tests/test_scene.py
@@ -48,9 +48,9 @@
mi_bound = ((ma-mi)*(0.10))+mi
ma_bound = ((ma-mi)*(0.90))+mi
tf.map_to_colormap(mi_bound, ma_bound, scale=0.01, colormap='Reds_r')
- sc.render('test_scene.png', clip_ratio=6.0)
+ sc.render('test_scene.png', sigma_clip=6.0)
nrot = 2
for i in range(nrot):
sc.camera.pitch(2*np.pi/nrot)
- sc.render('test_rot_%04i.png' % i, clip_ratio=6.0)
+ sc.render('test_rot_%04i.png' % i, sigma_clip=6.0)
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/tests/test_simple_vr.py
--- a/yt/visualization/volume_rendering/tests/test_simple_vr.py
+++ b/yt/visualization/volume_rendering/tests/test_simple_vr.py
@@ -15,7 +15,7 @@
def test_simple_vr():
ds = fake_random_ds(32)
- im, sc = yt.volume_render(ds, fname='test.png', clip_ratio=4.0)
+ im, sc = yt.volume_render(ds, fname='test.png', sigma_clip=4.0)
print(sc)
return im, sc
diff -r 70dbe0da49134ff9f9f0f0012d700896dd2e63fc -r d3ba9ef67a78946c1a0afe6a455310991a228f9f yt/visualization/volume_rendering/volume_rendering.py
--- a/yt/visualization/volume_rendering/volume_rendering.py
+++ b/yt/visualization/volume_rendering/volume_rendering.py
@@ -19,7 +19,7 @@
from yt.funcs import mylog
-def volume_render(data_source, field=None, fname=None, clip_ratio=None):
+def volume_render(data_source, field=None, fname=None, sigma_clip=4.0):
r""" Create a simple volume rendering of a data source.
A helper function that creates a default camera view, transfer
@@ -41,10 +41,10 @@
fname: string, optional
If specified, the resulting rendering will be saved to this filename
in png format.
- clip_ratio: float, optional
- If specified, the resulting image will be clipped before saving,
- using a threshold based on clip_ratio multiplied by the standard
- deviation of the pixel values. Recommended values are between 2 and 6.
+ sigma_clip: float
+ The resulting image will be clipped before saving, using a threshold
+ based on `sigma_clip` multiplied by the standard deviation of the pixel
+ values. Recommended values are between 2 and 6. Default: 4.0
Returns
-------
@@ -58,7 +58,7 @@
Example:
>>> import yt
>>> ds = yt.load("Enzo_64/DD0046/DD0046")
- >>> im, sc = yt.volume_render(ds, fname='test.png', clip_ratio=4.0)
+ >>> im, sc = yt.volume_render(ds, fname='test.png')
"""
data_source = data_source_or_all(data_source)
sc = Scene()
@@ -82,5 +82,5 @@
vol = VolumeSource(data_source, field=field)
sc.add_source(vol)
sc.camera = Camera(data_source)
- im = sc.render(fname=fname, clip_ratio=clip_ratio)
+ im = sc.render(fname=fname, sigma_clip=sigma_clip)
return im, sc
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