mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-28 11:26:12 +08:00
Updates to video function (skip frames)
This commit is contained in:
@@ -372,7 +372,7 @@ class TensorView(object):
|
||||
|
||||
return animate(fig, animateFrame, frames=mesh.nCv['xyz'.index(normal)])
|
||||
|
||||
def video(mesh,var,function,figsize=(10,8),colorbar=True):
|
||||
def video(mesh, var, function, figsize=(10, 8), colorbar=True, skip=1):
|
||||
"""
|
||||
Call a function for a list of models to create a video.
|
||||
|
||||
@@ -393,9 +393,11 @@ class TensorView(object):
|
||||
if colorbar:
|
||||
plt.colorbar(function(var[0],ax,clim,tlt,0))
|
||||
|
||||
def animateFrame(i):
|
||||
frames = np.arange(0,len(var),skip)
|
||||
def animateFrame(j):
|
||||
i = frames[j]
|
||||
function(var[i],ax,clim,tlt,i)
|
||||
|
||||
return animate(fig, animateFrame, frames=len(var))
|
||||
return animate(fig, animateFrame, frames=len(frames))
|
||||
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ def randomModel(shape, seed=None, anisotropy=None, its=100, bounds=[0,1]):
|
||||
if len(shape) is 1:
|
||||
smth = np.array([1,10.,1],dtype=float)
|
||||
elif len(shape) is 2:
|
||||
smth = np.array([[1,2,1],[7,10,7],[1,2,1]],dtype=float)
|
||||
smth = np.array([[1,7,1],[2,10,2],[1,7,1]],dtype=float)
|
||||
elif len(shape) is 3:
|
||||
kernal = np.array([1,4,1], dtype=float).reshape((1,3))
|
||||
smth = np.array(sp.kron(sp.kron(kernal,kernal.T).todense()[:],kernal).todense()).reshape((3,3,3))
|
||||
|
||||
Reference in New Issue
Block a user