Skip to content

Commit

Permalink
Merge pull request #325 from K3D-tools/devel
Browse files Browse the repository at this point in the history
2.12.0
  • Loading branch information
artur-trzesiok authored Feb 9, 2022
2 parents 102bdbf + 264fb03 commit 0015a92
Show file tree
Hide file tree
Showing 136 changed files with 1,803 additions and 743 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ before_install:
before_script:
- pip install vtk pixelmatch flask msgpack webdriver_manager selenium scikit-image jupyterlab
- npm install webpack webpack-cli -g
- npm install
- cd js
- npm install
- cd ..
- npm install
- pip install -e .
- cd k3d
script: pytest
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ To install from PyPI use pip:

$ pip install k3d

When using Jupyter Notebook, remember to install and enable the `k3d` extension:

$ jupyter nbextension install --py --user k3d
$ jupyter nbextension enable --py --user k3d

When upgrading from an earlier version, use the following commands:

$ pip install -U k3d
$ jupyter nbextension install --py --user k3d
$ jupyter nbextension enable --py --user k3d

See below for instructions about JupyterLab installation.

### Conda/Anaconda

To install from conda-forge use:
Expand Down Expand Up @@ -99,13 +112,14 @@ K3D-jupyter follows the Python Software Foundation Code of Conduct in everything
<table class="none">
<tr>
<td>
<img src="http://opendreamkit.org/public/logos/Flag_of_Europe.svg" width="128">
<img src="http://opendreamkit.org/public/logos/Flag_of_Europe.svg" width="128">
</td>
<td>
This package was created as part of the Horizon 2020 European
Research Infrastructure project
<a href="https://opendreamkit.org/">OpenDreamKit</a>
(grant agreement <a href="https://opendreamkit.org/">#676541</a>).
Research Infrastructure project
This package was created as part of the Horizon 2020 European
<a href="https://opendreamkit.org/">OpenDreamKit</a>
(grant agreement <a href="https://opendreamkit.org/">#676541</a>).
</td>
</tr>
</table>

1 change: 0 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# To release a new version of K3D on PyPI:

Update _version.py (set release version, remove 'dev')
git add and git commit
rm -rf build
rm -rf dist
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
six
ipywidgets>=7.0.1
ipydatawidgets
traittypes
traitlets
numpy
Expand Down
15 changes: 12 additions & 3 deletions examples/line.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@
"outputs": [],
"source": [
"# Not all implementations of WebGL support line width, this may not work:\n",
"line.width = 5"
"line.width = 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"line.shader = 'thick'"
]
},
{
Expand Down Expand Up @@ -111,7 +120,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -125,7 +134,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.12"
},
"nbTranslate": {
"displayLangs": [
Expand Down
5 changes: 2 additions & 3 deletions examples/mesh_callback.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"import vtk\n",
"import numpy as np\n",
"from k3d.helpers import download\n",
"from pyunpack import Archive\n",
"import ipywidgets as widgets\n",
"\n",
"filename = download('https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')\n",
Expand Down Expand Up @@ -284,7 +283,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -298,7 +297,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.12"
},
"nbTranslate": {
"displayLangs": [
Expand Down
5 changes: 2 additions & 3 deletions examples/mesh_triangles_attribute_vtk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"import vtk\n",
"import numpy as np\n",
"from k3d.helpers import download\n",
"from pyunpack import Archive\n",
"import ipywidgets as widgets\n",
"\n",
"filename = download('https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')\n",
Expand Down Expand Up @@ -60,7 +59,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -74,7 +73,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.12"
},
"nbTranslate": {
"displayLangs": [
Expand Down
39 changes: 33 additions & 6 deletions examples/mesh_volume_texture.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -48,9 +48,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "82c3b23b5e074f81a6c6fff11579af2c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"vertices, indices = quad(20.0, 20.0)\n",
"\n",
Expand All @@ -69,6 +84,18 @@
"plot.display()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"data = plot.get_binary_snapshot()\n",
"\n",
"with open('binary_snapshot.k3d', 'wb') as f:\n",
" f.write(data)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -142,7 +169,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -156,7 +183,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.12"
},
"nbTranslate": {
"displayLangs": [
Expand Down
134 changes: 134 additions & 0 deletions examples/objects_groups.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "1c399e85",
"metadata": {},
"outputs": [],
"source": [
"import k3d\n",
"import math\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c5898675",
"metadata": {},
"outputs": [],
"source": [
"def generate(a, b, c, d, N=1000):\n",
" points = np.zeros(N * 3, dtype=np.float32)\n",
"\n",
" x = y = z = 0\n",
"\n",
" for i in range(N):\n",
" xn = math.sin(a * y) + c * math.cos(a * x)\n",
" yn = math.sin(b * x) + d * math.cos(b * y)\n",
" zn = math.sin(1.4 * (x + z))\n",
"\n",
" points[i * 3] = xn\n",
" points[i * 3 + 1] = yn\n",
" points[i * 3 + 2] = zn\n",
"\n",
" x = xn\n",
" y = yn\n",
" z = zn\n",
" \n",
" return points"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "476c9a32",
"metadata": {},
"outputs": [],
"source": [
"plot = k3d.plot()\n",
"\n",
"for idx in range(5):\n",
" p = generate(1.5 + idx * 0.1, -1.8, 1.6, 0.9)\n",
"\n",
" g = \"Variant %d\" % (idx + 1)\n",
" plot += k3d.points(p, point_size=0.05, name='points', color=k3d.nice_colors[idx], group=g)\n",
" plot += k3d.line(p, name='trajectory', color=k3d.nice_colors[idx], group=g)\n",
"\n",
"plot.display()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bdc28fcd",
"metadata": {},
"outputs": [],
"source": [
"plot.objects[0].name = 'abc'"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "385a58d8",
"metadata": {},
"outputs": [],
"source": [
"plot.objects[0].group = 'Test'"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7a5c3d39",
"metadata": {},
"outputs": [],
"source": [
"plot.objects[1].group = 'Test'"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d436d8eb",
"metadata": {},
"outputs": [],
"source": [
"# back to without group mode\n",
"plot.objects[0].group = None\n",
"plot.objects[1].group = None"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "78bc8be4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 0015a92

Please sign in to comment.