Skip to content

Commit 4dc94be

Browse files
authored
Merge pull request #86 from simpeg/ref/view
ref/view
2 parents 5d802e3 + 247a612 commit 4dc94be

File tree

5 files changed

+34
-18
lines changed

5 files changed

+34
-18
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[bumpversion]
2-
current_version = 0.1.13
2+
current_version = 0.1.14
33
files = setup.py discretize/__init__.py docs/conf.py
44

discretize/View.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def plotImage(
4848
streamOpts=None,
4949
gridOpts=None,
5050
numbering=True, annotationColor='w',
51-
range_x=None, range_y=None, sample_grid=None
51+
range_x=None, range_y=None, sample_grid=None,
52+
stream_threshold=None
5253
):
5354
"""
5455
Mesh.plotImage(v)
@@ -116,7 +117,7 @@ def plotImage(
116117
ax=ax, clim=clim, showIt=showIt,
117118
pcolorOpts=pcolorOpts, streamOpts=streamOpts,
118119
gridOpts=gridOpts, range_x=range_x, range_y=range_y,
119-
sample_grid=sample_grid
120+
sample_grid=sample_grid, stream_threshold=stream_threshold
120121
)
121122
elif self.dim == 3:
122123
# get copy of image and average to cell-centers is necessary
@@ -186,14 +187,15 @@ def plotImage(
186187
plt.show()
187188
return ph
188189

189-
def plotSlice(self, v, vType='CC',
190-
normal='Z', ind=None, grid=False, view='real',
191-
ax=None, clim=None, showIt=False,
192-
pcolorOpts=None,
193-
streamOpts=None,
194-
gridOpts=None,
195-
range_x=None, range_y=None
196-
):
190+
def plotSlice(
191+
self, v, vType='CC',
192+
normal='Z', ind=None, grid=False, view='real',
193+
ax=None, clim=None, showIt=False,
194+
pcolorOpts=None,
195+
streamOpts=None,
196+
gridOpts=None,
197+
range_x=None, range_y=None
198+
):
197199

198200
"""
199201
Plots a slice of a 3D mesh.
@@ -321,7 +323,8 @@ def _plotImage2D(
321323
gridOpts=None,
322324
range_x=None,
323325
range_y=None,
324-
sample_grid=None
326+
sample_grid=None,
327+
stream_threshold=None
325328
):
326329

327330
if pcolorOpts is None:
@@ -427,8 +430,21 @@ def _plotImage2D(
427430
U = Ui
428431
V = Vi
429432

430-
out += (ax.pcolormesh(x, y, np.sqrt(U**2+V**2).T, vmin=clim[0], vmax=clim[1], **pcolorOpts),)
431-
out += (ax.streamplot(tMi.vectorCCx, tMi.vectorCCy, Ui.T, Vi.T, **streamOpts),)
433+
if stream_threshold is not None:
434+
mask_me = np.sqrt(U**2 + V**2) <= stream_threshold
435+
Ui = np.ma.masked_where(mask_me, Ui)
436+
Vi = np.ma.masked_where(mask_me, Vi)
437+
438+
out += (
439+
ax.pcolormesh(
440+
x, y, np.sqrt(U**2+V**2).T, vmin=clim[0], vmax=clim[1],
441+
**pcolorOpts),
442+
)
443+
out += (
444+
ax.streamplot(
445+
tMi.vectorCCx, tMi.vectorCCy, Ui.T, Vi.T, **streamOpts
446+
),
447+
)
432448

433449
if grid:
434450
xXGrid = np.c_[self.vectorNx, self.vectorNx, np.nan*np.ones(self.nNx)].flatten()

discretize/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""
1919
)
2020

21-
__version__ = '0.1.13'
21+
__version__ = '0.1.14'
2222
__author__ = 'SimPEG Team'
2323
__license__ = 'MIT'
2424
__copyright__ = '2013 - 2017, SimPEG Developers, http://simpeg.xyz'

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
# built documents.
6161
#
6262
# The short X.Y version.
63-
version = '0.1.13'
63+
version = '0.1.14'
6464
# The full version, including alpha/beta/rc tags.
65-
release = '0.1.13'
65+
release = '0.1.14'
6666

6767
# The language for content autogenerated by Sphinx. Refer to documentation
6868
# for a list of supported languages.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def configuration(parent_package='', top_path=None):
5656

5757
setup(
5858
name="discretize",
59-
version="0.1.13",
59+
version="0.1.14",
6060
install_requires=[
6161
'numpy>=1.7',
6262
'scipy>=0.13',

0 commit comments

Comments
 (0)