diff --git a/binder/environment.yml b/binder/environment.yml index 384f1f73..d8eb7577 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -4,8 +4,8 @@ dependencies: - pip - pip: - pylife[all] - - pyvista - - panel + - pyvista[all,jupyter] + - trame<3 - plotly - xvfbwrapper - ipyvtklink diff --git a/demos/hotspot_beam.ipynb b/demos/hotspot_beam.ipynb index ca106cae..6ee4bb25 100644 --- a/demos/hotspot_beam.ipynb +++ b/demos/hotspot_beam.ipynb @@ -32,10 +32,7 @@ "import pylife.mesh.hotspot\n", "import pylife.vmap\n", "\n", - "import pyvista as pv\n", - "\n", - "pv.set_plot_theme('document')\n", - "pv.set_jupyter_backend('panel')" + "import pyvista as pv" ] }, { @@ -102,7 +99,7 @@ "outputs": [], "source": [ "grid = pv.UnstructuredGrid(*mesh.mesh.vtk_data())\n", - "plotter = pv.Plotter(window_size=[1920, 1080])\n", + "plotter = pv.Plotter()\n", "plotter.add_mesh(grid, scalars=mesh.groupby('element_id')['hotspot'].first().to_numpy(), show_edges=True)\n", "plotter.add_scalar_bar()\n", "plotter.show()" @@ -169,9 +166,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.11.0" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/demos/lifetime_calc.ipynb b/demos/lifetime_calc.ipynb index a74839c0..50b00792 100644 --- a/demos/lifetime_calc.ipynb +++ b/demos/lifetime_calc.ipynb @@ -61,10 +61,7 @@ "# mpl.style.use('seaborn')\n", "# mpl.style.use('seaborn-notebook')\n", "mpl.style.use('bmh')\n", - "%matplotlib inline\n", - "\n", - "pv.set_plot_theme('document')\n", - "pv.set_jupyter_backend('panel')" + "%matplotlib inline" ] }, { @@ -255,7 +252,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": true + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } }, "source": [ "#### Plot the damage vs collectives" @@ -433,9 +433,8 @@ "outputs": [], "source": [ "grid = pv.UnstructuredGrid(*pyLife_mesh.mesh.vtk_data())\n", - "plotter = pv.Plotter(window_size=[1920, 1400])\n", - "plotter.add_mesh(grid, scalars=damage.to_numpy(), log_scale=True,\n", - " show_edges=True, cmap='jet')\n", + "plotter = pv.Plotter()\n", + "plotter.add_mesh(grid, scalars=damage.to_numpy(), log_scale=True, show_edges=True, cmap='jet')\n", "plotter.add_scalar_bar()\n", "plotter.show()" ] @@ -516,7 +515,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3" + "pygments_lexer": "ipython3", + "version": "3.11.0" } }, "nbformat": 4, diff --git a/demos/local_stress_with_FE.ipynb b/demos/local_stress_with_FE.ipynb index 23ae55fd..8bc6ecde 100644 --- a/demos/local_stress_with_FE.ipynb +++ b/demos/local_stress_with_FE.ipynb @@ -32,11 +32,7 @@ "import pylife.stress\n", "import pylife.strength.fatigue\n", "import pylife.utils.histogram as psh\n", - "import pyvista as pv\n", - "\n", - "# from ansys.dpf import post\n", - "pv.set_plot_theme('document')\n", - "pv.set_jupyter_backend('panel')" + "import pyvista as pv\n" ] }, { diff --git a/demos/stress_gradient.ipynb b/demos/stress_gradient.ipynb index 46844b32..e32cc75a 100644 --- a/demos/stress_gradient.ipynb +++ b/demos/stress_gradient.ipynb @@ -24,10 +24,7 @@ "import pylife.mesh.gradient\n", "import pylife.vmap\n", "\n", - "import pyvista as pv\n", - "\n", - "pv.set_plot_theme('document')\n", - "pv.set_jupyter_backend('panel')" + "import pyvista as pv" ] }, { @@ -44,7 +41,7 @@ "outputs": [], "source": [ "vm_mesh = pylife.vmap.VMAPImport(\"plate_with_hole.vmap\")\n", - "pyLife_mesh = (vm_mesh.make_mesh('1', 'STATE-2')\n", + "mesh = (vm_mesh.make_mesh('1', 'STATE-2')\n", " .join_coordinates()\n", " .join_variable('STRESS_CAUCHY')\n", " .to_frame())" @@ -63,7 +60,7 @@ "metadata": {}, "outputs": [], "source": [ - "pyLife_mesh['mises'] = pyLife_mesh.equistress.mises()" + "mesh['mises'] = mesh.equistress.mises()" ] }, { @@ -79,7 +76,10 @@ "metadata": {}, "outputs": [], "source": [ - "grad = pyLife_mesh.gradient.gradient_of('mises')" + "grad = mesh.gradient.gradient_of('mises')\n", + "grad[\"abs_grad\"] = np.linalg.norm(grad, axis = 1)\n", + "mesh = mesh.join(grad)\n", + "display(mesh)\n" ] }, { @@ -88,9 +88,11 @@ "metadata": {}, "outputs": [], "source": [ - "grad[\"abs_grad\"] = np.linalg.norm(grad, axis = 1)\n", - "pyLife_mesh = pyLife_mesh.join(grad)\n", - "display(pyLife_mesh)\n" + "grid = pv.UnstructuredGrid(*mesh.mesh.vtk_data())\n", + "plotter = pv.Plotter()\n", + "plotter.add_mesh(grid, scalars=mesh.groupby('element_id')[\"abs_grad\"].mean().to_numpy(), show_edges=True, cmap='jet')\n", + "plotter.add_scalar_bar()\n", + "plotter.show()" ] }, { @@ -99,12 +101,7 @@ "metadata": {}, "outputs": [], "source": [ - "grid = pv.UnstructuredGrid(*pyLife_mesh.mesh.vtk_data())\n", - "plotter = pv.Plotter(window_size=[1920, 1080])\n", - "plotter.add_mesh(grid, scalars=pyLife_mesh.groupby('element_id')[\"abs_grad\"].mean().to_numpy(),\n", - " show_edges=True, cmap='jet')\n", - "plotter.add_scalar_bar()\n", - "plotter.show()" + "\"That's it\"" ] } ], @@ -123,10 +120,11 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3" + "pygments_lexer": "ipython3", + "version": "3.11.0" }, "name": "stress_gradient.ipynb" }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/demos/stress_strength.ipynb b/demos/stress_strength.ipynb index e0697a28..48e16043 100644 --- a/demos/stress_strength.ipynb +++ b/demos/stress_strength.ipynb @@ -338,7 +338,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3" + "pygments_lexer": "ipython3", + "version": "3.11.0" } }, "nbformat": 4, diff --git a/setup.cfg b/setup.cfg index c70dcd50..3afe567c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,7 +70,6 @@ testing = pytest-cov hypothesis pyvista - panel xvfbwrapper testbook ipykernel @@ -84,8 +83,9 @@ docs = plotly jupyter_sphinx myst_parser - panel - pyvista + pyvista[all,jupyter] + trame<3 + ipywidgets xvfbwrapper