[yt-svn] commit/yt: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu May 1 06:13:28 PDT 2014
5 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/36103e2efd7c/
Changeset: 36103e2efd7c
Branch: yt
User: bwoshea
Date: 2014-04-25 05:37:52
Summary: added ability to control line width in the annotate_grids call. Also added the 'white' color table, so that all of the grids are white. (This latter bit may be useful for certain kinds of simulations.)
Affected #: 2 files
diff -r 1a67d558b51cf89b66417704c5bcd9533810a023 -r 36103e2efd7c7645f6c276a1ae9ac1fdcf849966 yt/visualization/_colormap_data.py
--- a/yt/visualization/_colormap_data.py
+++ b/yt/visualization/_colormap_data.py
@@ -7757,6 +7757,115 @@
1.0, 1.0, 1.0, 1.0, 1.0, 1.0]),
)
+
+color_map_luts['all_white'] = \
+ (
+array([ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0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.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]),
+ )
+
color_map_luts['B-W LINEAR'] = color_map_luts['idl00']
color_map_luts['BLUE'] = color_map_luts['idl01']
color_map_luts['GRN-RED-BLU-WHT'] = color_map_luts['idl02']
@@ -7798,6 +7907,7 @@
color_map_luts['Rainbow18'] = color_map_luts['idl38']
color_map_luts['Rainbow + white'] = color_map_luts['idl39']
color_map_luts['Rainbow + black'] = color_map_luts['idl40']
+color_map_luts['white'] = color_map_luts['all_white']
# Create a reversed LUT for each of the above defined LUTs
# and append a "_r" (for reversal. consistent with MPL convention).
diff -r 1a67d558b51cf89b66417704c5bcd9533810a023 -r 36103e2efd7c7645f6c276a1ae9ac1fdcf849966 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -337,20 +337,21 @@
class GridBoundaryCallback(PlotCallback):
"""
annotate_grids(alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False, periodic=True,
- min_level=None, max_level=None, cmap='B-W LINEAR_r'):
+ min_level=None, max_level=None, cmap='B-W LINEAR_r', linewidth=1.0):
Draws grids on an existing PlotWindow object.
Adds grid boundaries to a plot, optionally with alpha-blending. By default,
colors different levels of grids with different colors going from white to
black, but you can change to any arbitrary colormap with cmap keyword
- (or all black cells for all levels with cmap=None). Cuttoff for display is at
+ (or all black cells for all levels with cmap=None, or all white cells for all
+ levels with cmap='white'). Cuttoff for display is at
min_pix wide. draw_ids puts the grid id in the corner of the grid.
(Not so great in projections...). One can set min and maximum level of
- grids to display.
+ grids to display, and can change the linewidth of the displayed grids.
"""
_type_name = "grids"
def __init__(self, alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False, periodic=True,
- min_level=None, max_level=None, cmap='B-W LINEAR_r'):
+ min_level=None, max_level=None, cmap='B-W LINEAR_r', linewidth=1.0):
PlotCallback.__init__(self)
self.alpha = alpha
self.min_pix = min_pix
@@ -359,6 +360,7 @@
self.periodic = periodic
self.min_level = min_level
self.max_level = max_level
+ self.linewidth = linewidth
self.cmap = cmap
def __call__(self, plot):
@@ -414,7 +416,7 @@
verts=verts.transpose()[visible,:,:]
grid_collection = matplotlib.collections.PolyCollection(
verts, facecolors="none",
- edgecolors=edgecolors)
+ edgecolors=edgecolors, linewidth=self.linewidth)
plot._axes.hold(True)
plot._axes.add_collection(grid_collection)
https://bitbucket.org/yt_analysis/yt/commits/e5f4b65921a1/
Changeset: e5f4b65921a1
Branch: yt
User: bwoshea
Date: 2014-04-25 15:04:49
Summary: updating plot modification to include edgecolors.
Affected #: 1 file
diff -r 36103e2efd7c7645f6c276a1ae9ac1fdcf849966 -r e5f4b65921a1385a81ff37958032b290775c0666 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -337,21 +337,23 @@
class GridBoundaryCallback(PlotCallback):
"""
annotate_grids(alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False, periodic=True,
- min_level=None, max_level=None, cmap='B-W LINEAR_r', linewidth=1.0):
+ min_level=None, max_level=None, cmap='B-W LINEAR_r', edgecolors=None,
+ linewidth=1.0):
Draws grids on an existing PlotWindow object.
Adds grid boundaries to a plot, optionally with alpha-blending. By default,
colors different levels of grids with different colors going from white to
- black, but you can change to any arbitrary colormap with cmap keyword
- (or all black cells for all levels with cmap=None, or all white cells for all
- levels with cmap='white'). Cuttoff for display is at
- min_pix wide. draw_ids puts the grid id in the corner of the grid.
+ black, but you can change to any arbitrary colormap with cmap keyword, to all black
+ grid edges for all levels with cmap=None and edgecolors=None, or to an arbitrary single
+ color for grid edges with edgecolors='YourChosenColor' (e.g., edgecolors='white').
+ Note that setting edgecolors overrides cmap if you have both set to non-None values.
+ Cutoff for display is at min_pix wide. draw_ids puts the grid id in the corner of the grid.
(Not so great in projections...). One can set min and maximum level of
grids to display, and can change the linewidth of the displayed grids.
"""
_type_name = "grids"
def __init__(self, alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False, periodic=True,
- min_level=None, max_level=None, cmap='B-W LINEAR_r', linewidth=1.0):
+ min_level=None, max_level=None, cmap='B-W LINEAR_r', edgecolors = None, linewidth=1.0):
PlotCallback.__init__(self)
self.alpha = alpha
self.min_pix = min_pix
@@ -362,6 +364,7 @@
self.max_level = max_level
self.linewidth = linewidth
self.cmap = cmap
+ self.edgecolors = edgecolors
def __call__(self, plot):
x0, x1 = plot.xlim
@@ -401,13 +404,17 @@
( levels >= min_level) & \
( levels <= max_level)
- if self.cmap is not None:
- edgecolors = apply_colormap(levels[(levels <= max_level) & (levels >= min_level)]*1.0,
- color_bounds=[0,plot.data.pf.h.max_level],
- cmap_name=self.cmap)[0,:,:]*1.0/255.
- edgecolors[:,3] = self.alpha
- else:
- edgecolors = (0.0,0.0,0.0,self.alpha)
+ # Grids can either be set by edgecolors OR a colormap.
+ if self.edgecolors is not None:
+ edgecolors = self.edgecolors
+ else: # use colormap if not explicity overridden by edgecolors
+ if self.cmap is not None:
+ edgecolors = apply_colormap(levels[(levels <= max_level) & (levels >= min_level)]*1.0,
+ color_bounds=[0,plot.data.pf.h.max_level],
+ cmap_name=self.cmap)[0,:,:]*1.0/255.
+ edgecolors[:,3] = self.alpha
+ else:
+ edgecolors = (0.0,0.0,0.0,self.alpha)
if visible.nonzero()[0].size == 0: continue
verts = np.array(
https://bitbucket.org/yt_analysis/yt/commits/694c639cd3f3/
Changeset: 694c639cd3f3
Branch: yt
User: bwoshea
Date: 2014-04-25 15:07:17
Summary: removed white colormap - redundant now that we use edgecolors for annotate_grids()
Affected #: 1 file
diff -r e5f4b65921a1385a81ff37958032b290775c0666 -r 694c639cd3f3164a09a7ce312ed239cd282cb61f yt/visualization/_colormap_data.py
--- a/yt/visualization/_colormap_data.py
+++ b/yt/visualization/_colormap_data.py
@@ -7757,115 +7757,6 @@
1.0, 1.0, 1.0, 1.0, 1.0, 1.0]),
)
-
-color_map_luts['all_white'] = \
- (
-array([ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.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color_map_luts['Rainbow18'] = color_map_luts['idl38']
color_map_luts['Rainbow + white'] = color_map_luts['idl39']
color_map_luts['Rainbow + black'] = color_map_luts['idl40']
-color_map_luts['white'] = color_map_luts['all_white']
# Create a reversed LUT for each of the above defined LUTs
# and append a "_r" (for reversal. consistent with MPL convention).
https://bitbucket.org/yt_analysis/yt/commits/43ef2f50b913/
Changeset: 43ef2f50b913
Branch: yt
User: bwoshea
Date: 2014-04-25 22:17:05
Summary: Modifying edge colors argument so that it handles alpha.
Affected #: 1 file
diff -r 694c639cd3f3164a09a7ce312ed239cd282cb61f -r 43ef2f50b913f1ffbb8f65f736c14fdbb6acfa2f yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -28,6 +28,8 @@
sec_per_day, sec_per_hr
from yt.visualization.image_writer import apply_colormap
+from matplotlib.colors import colorConverter
+
import _MPL
callback_registry = {}
@@ -345,7 +347,9 @@
colors different levels of grids with different colors going from white to
black, but you can change to any arbitrary colormap with cmap keyword, to all black
grid edges for all levels with cmap=None and edgecolors=None, or to an arbitrary single
- color for grid edges with edgecolors='YourChosenColor' (e.g., edgecolors='white').
+ color for grid edges with edgecolors='YourChosenColor' defined in any of the standard ways
+ (e.g., edgecolors='white', edgecolors='r', edgecolors='#00FFFF', or edgecolor='0.3', where
+ the last is a float in 0-1 scale indicating gray).
Note that setting edgecolors overrides cmap if you have both set to non-None values.
Cutoff for display is at min_pix wide. draw_ids puts the grid id in the corner of the grid.
(Not so great in projections...). One can set min and maximum level of
@@ -406,7 +410,7 @@
# Grids can either be set by edgecolors OR a colormap.
if self.edgecolors is not None:
- edgecolors = self.edgecolors
+ edgecolors = colorConverter.to_rgba(self.edgecolors, alpha=self.alpha)
else: # use colormap if not explicity overridden by edgecolors
if self.cmap is not None:
edgecolors = apply_colormap(levels[(levels <= max_level) & (levels >= min_level)]*1.0,
https://bitbucket.org/yt_analysis/yt/commits/2d487f4a5362/
Changeset: 2d487f4a5362
Branch: yt
User: MatthewTurk
Date: 2014-05-01 15:13:22
Summary: Merged in bwoshea/yt-grids (pull request #856)
Some additions to annotate_grids()
Affected #: 2 files
diff -r 84e29e8f60dfb35ab4194e627a2855f253738068 -r 2d487f4a53627602f608511d8990d21c5e45256a yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -28,6 +28,8 @@
sec_per_day, sec_per_hr
from yt.visualization.image_writer import apply_colormap
+from matplotlib.colors import colorConverter
+
import _MPL
callback_registry = {}
@@ -337,20 +339,25 @@
class GridBoundaryCallback(PlotCallback):
"""
annotate_grids(alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False, periodic=True,
- min_level=None, max_level=None, cmap='B-W LINEAR_r'):
+ min_level=None, max_level=None, cmap='B-W LINEAR_r', edgecolors=None,
+ linewidth=1.0):
Draws grids on an existing PlotWindow object.
Adds grid boundaries to a plot, optionally with alpha-blending. By default,
colors different levels of grids with different colors going from white to
- black, but you can change to any arbitrary colormap with cmap keyword
- (or all black cells for all levels with cmap=None). Cuttoff for display is at
- min_pix wide. draw_ids puts the grid id in the corner of the grid.
+ black, but you can change to any arbitrary colormap with cmap keyword, to all black
+ grid edges for all levels with cmap=None and edgecolors=None, or to an arbitrary single
+ color for grid edges with edgecolors='YourChosenColor' defined in any of the standard ways
+ (e.g., edgecolors='white', edgecolors='r', edgecolors='#00FFFF', or edgecolor='0.3', where
+ the last is a float in 0-1 scale indicating gray).
+ Note that setting edgecolors overrides cmap if you have both set to non-None values.
+ Cutoff for display is at min_pix wide. draw_ids puts the grid id in the corner of the grid.
(Not so great in projections...). One can set min and maximum level of
- grids to display.
+ grids to display, and can change the linewidth of the displayed grids.
"""
_type_name = "grids"
def __init__(self, alpha=0.7, min_pix=1, min_pix_ids=20, draw_ids=False, periodic=True,
- min_level=None, max_level=None, cmap='B-W LINEAR_r'):
+ min_level=None, max_level=None, cmap='B-W LINEAR_r', edgecolors = None, linewidth=1.0):
PlotCallback.__init__(self)
self.alpha = alpha
self.min_pix = min_pix
@@ -359,7 +366,9 @@
self.periodic = periodic
self.min_level = min_level
self.max_level = max_level
+ self.linewidth = linewidth
self.cmap = cmap
+ self.edgecolors = edgecolors
def __call__(self, plot):
x0, x1 = plot.xlim
@@ -399,13 +408,17 @@
( levels >= min_level) & \
( levels <= max_level)
- if self.cmap is not None:
- edgecolors = apply_colormap(levels[(levels <= max_level) & (levels >= min_level)]*1.0,
- color_bounds=[0,plot.data.pf.h.max_level],
- cmap_name=self.cmap)[0,:,:]*1.0/255.
- edgecolors[:,3] = self.alpha
- else:
- edgecolors = (0.0,0.0,0.0,self.alpha)
+ # Grids can either be set by edgecolors OR a colormap.
+ if self.edgecolors is not None:
+ edgecolors = colorConverter.to_rgba(self.edgecolors, alpha=self.alpha)
+ else: # use colormap if not explicity overridden by edgecolors
+ if self.cmap is not None:
+ edgecolors = apply_colormap(levels[(levels <= max_level) & (levels >= min_level)]*1.0,
+ color_bounds=[0,plot.data.pf.h.max_level],
+ cmap_name=self.cmap)[0,:,:]*1.0/255.
+ edgecolors[:,3] = self.alpha
+ else:
+ edgecolors = (0.0,0.0,0.0,self.alpha)
if visible.nonzero()[0].size == 0: continue
verts = np.array(
@@ -414,7 +427,7 @@
verts=verts.transpose()[visible,:,:]
grid_collection = matplotlib.collections.PolyCollection(
verts, facecolors="none",
- edgecolors=edgecolors)
+ edgecolors=edgecolors, linewidth=self.linewidth)
plot._axes.hold(True)
plot._axes.add_collection(grid_collection)
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