Fix in example notebook.

This commit is contained in:
Dave Marchant
2013-11-18 11:24:27 -08:00
parent 37bcf891be
commit 7d295dc57e
2 changed files with 47 additions and 54 deletions
+1 -5
View File
@@ -75,11 +75,7 @@ class vtkView(object):
def Show(self):
"""
Open the VTK figure window and show the mesh.
Inputs:
param: str imageType: type of image {'cell','face','edge'}
Open the VTK figure window and show the mesh.
"""
#vtkSP = simpeg.visulize.vtk.vtkTools
import SimPEG.visulize.vtk.vtkTools as vtkSP
+46 -49
View File
@@ -1,6 +1,6 @@
{
"metadata": {
"name": "3D rendering with vtkTools"
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,64 +10,61 @@
{
"cell_type": "code",
"collapsed": false,
"input": "import numpy as np, vtk\nimport SimPEG as simpeg",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": "#Make a mesh and model\nx0 = np.zeros(3)\nh1 = np.ones(20)*50\nh2 = np.ones(10)*100\nh3 = np.ones(5)*200\n\nmesh = simpeg.mesh.TensorMesh([h1,h2,h3],x0)\n",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": "# Make a models that correspond to the cells, faces and edges.\nmodels = {'cell':{'Test':np.arange(0,mesh.nC),'AllOnce':np.ones(mesh.nC)},'face':{'Test':np.arange(0,np.sum(mesh.nF)),'AllOnce':np.ones(np.sum(mesh.nF))},'edge':{'Test':np.arange(0,np.sum(mesh.nE)),'AllOnce':np.ones(np.sum(mesh.nE))}}\n# Make the vtk viewer object.\nvtkViewer = simpeg.visulize.vtk.vtkView(mesh,models) \n ",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": "# Show the image \nvtkViewer.Show(imageType='cell')\n",
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": "mesh.nCxx",
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 7,
"text": "20"
}
"input": [
"import numpy as np, vtk\n",
"import SimPEG as simpeg"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Make a mesh and model\n",
"x0 = np.zeros(3)\n",
"h1 = np.ones(20)*50\n",
"h2 = np.ones(10)*100\n",
"h3 = np.ones(5)*200\n",
"\n",
"mesh = simpeg.mesh.TensorMesh([h1,h2,h3],x0)\n"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Make a models that correspond to the cells, faces and edges.\n",
"models = {'cell':{'Test':np.arange(0,mesh.nC),'AllOnce':np.ones(mesh.nC)},'face':{'Test':np.arange(0,np.sum(mesh.nF)),'AllOnce':np.ones(np.sum(mesh.nF))},'edge':{'Test':np.arange(0,np.sum(mesh.nE)),'AllOnce':np.ones(np.sum(mesh.nE))}}\n",
"# Make the vtk viewer object.\n",
"vtkViewer = simpeg.visulize.vtk.vtkView(mesh,models) \n",
" "
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": "",
"input": [
"# Show the image \n",
"vtkViewer.Show()\n"
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": "*"
}
],
"metadata": {}
}
]
}
}