gustaf


Namegustaf JSON
Version 0.0.24 PyPI version JSON
download
home_page
SummaryProcess and visualize numerical-analysis-geometries.
upload_time2024-03-05 21:44:14
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2021 Jaewook Lee Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gustaf/utils/arr.py:unique_rows Copyright (C) 2019, the scikit-image team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of skimage nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. gustaf/veritces.py:update_vertices gustaf/vertices.py:remove_unreferenced_vertices gustaf/helpers/data.py:TrackedArray, make_tracked_array The MIT License (MIT) Copyright (c) 2019 Michael Dawson-Haggerty Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gustaf/helpers/notebook.py:get_shape MIT License Copyright (c) 2017 Marco Musy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords numerical-analysis geometry visualization mesh
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![gustaf](docs/source/gustaf-logo.png)

__gustaf__ is a Python library to process and visualize numerical-analysis-geometries;
gustaf currently supports the following elements:
- points,
- lines,
- triangle,
- quadrilateral,
- tetrahedron, and
- hexahedron.

# Installation
`gustaf` only has `numpy` for its strict dependency. The minimal version can be installed using `pip`.
```
pip install gustaf
```
To install all the [optional dependencies](#optional-dependencies) at the same time, you can use:
```
# quotation marks required for some shells
pip install "gustaf[all]"
```
For the latest develop version of gustaf:
```
pip install git+https://github.com/tataratat/gustaf.git@main
```

# Quick Start
This example shows how to create volume elements and plot data on them.
For visualization, gustaf uses [vedo](https://vedo.embl.es) as main backend.

To begin we need to import the needed libraries:

```python
import gustaf as gus
import numpy as np
```
## Create a tetrahedron
Now we create our first volume. It will be just a basic cube. Even here we can
already choose between using a tetrahedron and a hexahedron-based
mesh. The `Volumes` class will use tetrahedrons if the volumes keyword is made
up of a list of 4 elements (defining the corners of the tetrahedron), if 8
elements are in each list hexahedrons are used ([defining the corners of the hexahedron in the correct order](https://tataratat.github.io/gustaf/_generated/gustaf.utils.connec.make_hexa_volumes.html#gustaf.utils.connec.make_hexa_volumes)).
```python
# create tetrahedron mesh using Volumes
# it requires vertices and connectivity info, volumes
tet = gus.Volumes(
    vertices=[
        [0.0, 0.0, 0.0],
        [1.0, 0.0, 0.0],
        [0.0, 1.0, 0.0],
        [1.0, 1.0, 0.0],
        [0.0, 0.0, 1.0],
        [1.0, 0.0, 1.0],
        [0.0, 1.0, 1.0],
        [1.0, 1.0, 1.0],
    ],
    volumes=[
        [0, 2, 7, 3],
        [0, 2, 6, 7],
        [0, 6, 4, 7],
        [5, 0, 4, 7],
        [5, 0, 7, 1],
        [7, 0, 3, 1],
    ],
)

# set line color and width
tet.show_options["lc"] = "black"
tet.show_options["lw"] = 4

tet.show(background="grey")
```
![Tetrahedron based volume](docs/source/_static/tet.png)
```python
hexa = gus.Volumes(
    vertices=[
        [0.0, 0.0, 0.0], #0
        [1.0, 0.0, 0.0], #1
        [0.0, 1.0, 0.0],
        [1.0, 1.0, 0.0], #3
        [0.0, 0.0, 1.0],
        [1.0, 0.0, 1.0],
        [0.0, 1.0, 1.0], #6
        [1.0, 1.0, 1.0],
    ],
    volumes=[
        [0, 1, 3, 2, 4, 5, 7, 6],
    ],
)

hexa.show_options["lc"] = "black"
hexa.show_options["lw"] = 4

hexa.show(background="grey")
```
![Hexahedron based volume](docs/source/_static/quad.png)
## Basic visualization

As just shown, it is really easy to show the objects by just calling the
`show()` function on the object. But that is just the beginning of the
possibilities in vedo. You can plot multiple objects next to each other:
```python
# show multiple items in one plot
# each list will be put into a separate subplot.
gus.show(
    ["Tetrahedron", tet],
    ["Hexahedron", hexa]
)
```
![Compare hexahedron and tetrahedron-based volumes](docs/source/_static/tet_quad.png)

Now let's add a color map to the object for the norm of the
coordinate, and let us also add at each vertex an arrow with random direction
and length.
```python
# let's visualize some scalar data and vector data defined on vertices
tet.vertex_data["arange"] = np.arange(len(tet.vertices))  # scalar
tet.show_options["data"] = "arange"
tet.vertex_data["random"] = np.random.random((len(tet.vertices), 3))  # vector
tet.show_options["arrow_data"] = "random"
tet.show(background="grey")
```
![Add additional data to the object](docs/source/_static/tet_vertex_data.png)

Are you interested in splines?
Please checkout [splinepy](https://tataratat.github.io/splinepy/)!


# Optional Dependencies
| Package | Description |
| ------- | ----------- |
| [numpy](https://numpy.org) | Fast array data operations. |
| [vedo](https://vedo.embl.es) | Default renderer / visualization core of gustaf. |
| [scipy](https://scipy.org) | Create k-d trees and simple rotation matrices.|
| [napf](https://github.com/tataratat/napf) | Fast k-d tree build / query based on nanoflann. Supersedes scipy if it is importable. |
| [funi](https://github.com/tataratat/funi) | A different method to find unique float array rows. But faster than k-d trees! |
| [meshio](https://github.com/nschloe/meshio) | Supports loading/exporting numerous mesh formats. |

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gustaf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "numerical-analysis,geometry,visualization,mesh",
    "author": "",
    "author_email": "Jaewook Lee <jaewooklee042@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/06/50/575c6448939273d8f9dd95f5f568bebba2a70dfcda9a0e898fae0686f3c9/gustaf-0.0.24.tar.gz",
    "platform": null,
    "description": "![gustaf](docs/source/gustaf-logo.png)\n\n__gustaf__ is a Python library to process and visualize numerical-analysis-geometries;\ngustaf currently supports the following elements:\n- points,\n- lines,\n- triangle,\n- quadrilateral,\n- tetrahedron, and\n- hexahedron.\n\n# Installation\n`gustaf` only has `numpy` for its strict dependency. The minimal version can be installed using `pip`.\n```\npip install gustaf\n```\nTo install all the [optional dependencies](#optional-dependencies) at the same time, you can use:\n```\n# quotation marks required for some shells\npip install \"gustaf[all]\"\n```\nFor the latest develop version of gustaf:\n```\npip install git+https://github.com/tataratat/gustaf.git@main\n```\n\n# Quick Start\nThis example shows how to create volume elements and plot data on them.\nFor visualization, gustaf uses [vedo](https://vedo.embl.es) as main backend.\n\nTo begin we need to import the needed libraries:\n\n```python\nimport gustaf as gus\nimport numpy as np\n```\n## Create a tetrahedron\nNow we create our first volume. It will be just a basic cube. Even here we can\nalready choose between using a tetrahedron and a hexahedron-based\nmesh. The `Volumes` class will use tetrahedrons if the volumes keyword is made\nup of a list of 4 elements (defining the corners of the tetrahedron), if 8\nelements are in each list hexahedrons are used ([defining the corners of the hexahedron in the correct order](https://tataratat.github.io/gustaf/_generated/gustaf.utils.connec.make_hexa_volumes.html#gustaf.utils.connec.make_hexa_volumes)).\n```python\n# create tetrahedron mesh using Volumes\n# it requires vertices and connectivity info, volumes\ntet = gus.Volumes(\n    vertices=[\n        [0.0, 0.0, 0.0],\n        [1.0, 0.0, 0.0],\n        [0.0, 1.0, 0.0],\n        [1.0, 1.0, 0.0],\n        [0.0, 0.0, 1.0],\n        [1.0, 0.0, 1.0],\n        [0.0, 1.0, 1.0],\n        [1.0, 1.0, 1.0],\n    ],\n    volumes=[\n        [0, 2, 7, 3],\n        [0, 2, 6, 7],\n        [0, 6, 4, 7],\n        [5, 0, 4, 7],\n        [5, 0, 7, 1],\n        [7, 0, 3, 1],\n    ],\n)\n\n# set line color and width\ntet.show_options[\"lc\"] = \"black\"\ntet.show_options[\"lw\"] = 4\n\ntet.show(background=\"grey\")\n```\n![Tetrahedron based volume](docs/source/_static/tet.png)\n```python\nhexa = gus.Volumes(\n    vertices=[\n        [0.0, 0.0, 0.0], #0\n        [1.0, 0.0, 0.0], #1\n        [0.0, 1.0, 0.0],\n        [1.0, 1.0, 0.0], #3\n        [0.0, 0.0, 1.0],\n        [1.0, 0.0, 1.0],\n        [0.0, 1.0, 1.0], #6\n        [1.0, 1.0, 1.0],\n    ],\n    volumes=[\n        [0, 1, 3, 2, 4, 5, 7, 6],\n    ],\n)\n\nhexa.show_options[\"lc\"] = \"black\"\nhexa.show_options[\"lw\"] = 4\n\nhexa.show(background=\"grey\")\n```\n![Hexahedron based volume](docs/source/_static/quad.png)\n## Basic visualization\n\nAs just shown, it is really easy to show the objects by just calling the\n`show()` function on the object. But that is just the beginning of the\npossibilities in vedo. You can plot multiple objects next to each other:\n```python\n# show multiple items in one plot\n# each list will be put into a separate subplot.\ngus.show(\n    [\"Tetrahedron\", tet],\n    [\"Hexahedron\", hexa]\n)\n```\n![Compare hexahedron and tetrahedron-based volumes](docs/source/_static/tet_quad.png)\n\nNow let's add a color map to the object for the norm of the\ncoordinate, and let us also add at each vertex an arrow with random direction\nand length.\n```python\n# let's visualize some scalar data and vector data defined on vertices\ntet.vertex_data[\"arange\"] = np.arange(len(tet.vertices))  # scalar\ntet.show_options[\"data\"] = \"arange\"\ntet.vertex_data[\"random\"] = np.random.random((len(tet.vertices), 3))  # vector\ntet.show_options[\"arrow_data\"] = \"random\"\ntet.show(background=\"grey\")\n```\n![Add additional data to the object](docs/source/_static/tet_vertex_data.png)\n\nAre you interested in splines?\nPlease checkout [splinepy](https://tataratat.github.io/splinepy/)!\n\n\n# Optional Dependencies\n| Package | Description |\n| ------- | ----------- |\n| [numpy](https://numpy.org) | Fast array data operations. |\n| [vedo](https://vedo.embl.es) | Default renderer / visualization core of gustaf. |\n| [scipy](https://scipy.org) | Create k-d trees and simple rotation matrices.|\n| [napf](https://github.com/tataratat/napf) | Fast k-d tree build / query based on nanoflann. Supersedes scipy if it is importable. |\n| [funi](https://github.com/tataratat/funi) | A different method to find unique float array rows. But faster than k-d trees! |\n| [meshio](https://github.com/nschloe/meshio) | Supports loading/exporting numerous mesh formats. |\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 Jaewook Lee  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  gustaf/utils/arr.py:unique_rows  Copyright (C) 2019, the scikit-image team All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of skimage nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  gustaf/veritces.py:update_vertices gustaf/vertices.py:remove_unreferenced_vertices gustaf/helpers/data.py:TrackedArray, make_tracked_array The MIT License (MIT)  Copyright (c) 2019 Michael Dawson-Haggerty  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  gustaf/helpers/notebook.py:get_shape MIT License  Copyright (c) 2017 Marco Musy  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Process and visualize numerical-analysis-geometries.",
    "version": "0.0.24",
    "project_urls": null,
    "split_keywords": [
        "numerical-analysis",
        "geometry",
        "visualization",
        "mesh"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fbee7104ef1ed7d8a2792b3e90c4556d9f99296fdb0b35458b13e7491329302b",
                "md5": "e3609be9dac7bc2e725ac60413b2c222",
                "sha256": "3bd89c2ed015eff14f61641e2c442379f2a916eeae2ef062c1fb7dd0a9596ba9"
            },
            "downloads": -1,
            "filename": "gustaf-0.0.24-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3609be9dac7bc2e725ac60413b2c222",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 68363,
            "upload_time": "2024-03-05T21:44:12",
            "upload_time_iso_8601": "2024-03-05T21:44:12.909044Z",
            "url": "https://files.pythonhosted.org/packages/fb/ee/7104ef1ed7d8a2792b3e90c4556d9f99296fdb0b35458b13e7491329302b/gustaf-0.0.24-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0650575c6448939273d8f9dd95f5f568bebba2a70dfcda9a0e898fae0686f3c9",
                "md5": "12d6ee2e9c4ac24375466ec723cd9513",
                "sha256": "6438866a72139b1082f8d508defff81453098b294bf8fe78a462c645afd23be9"
            },
            "downloads": -1,
            "filename": "gustaf-0.0.24.tar.gz",
            "has_sig": false,
            "md5_digest": "12d6ee2e9c4ac24375466ec723cd9513",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 63541,
            "upload_time": "2024-03-05T21:44:14",
            "upload_time_iso_8601": "2024-03-05T21:44:14.159605Z",
            "url": "https://files.pythonhosted.org/packages/06/50/575c6448939273d8f9dd95f5f568bebba2a70dfcda9a0e898fae0686f3c9/gustaf-0.0.24.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 21:44:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "gustaf"
}
        
Elapsed time: 0.20543s