
# PyAPD
A Python library for computing (optimal) anisotropic power diagrams using GPU acceleration. Current main application concerns geometric modelling of polycrystalline materials with curved boundaries with grains of prescribed volumes and fine control over aspect ratio and location of the grains.
## Installation
__Install with pip:__
pip install PyAPD
## Example usage
See `/notebooks/tutorials/example_usage.ipynb` [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/tutorials/example_usage.ipynb?flush_cache=true)
### Google Colab
To quickly test the speed of the GPU-acceleration, you can play around with the notebook `example_usage.ipynb` in Google Colab [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/tutorials/example_usage.ipynb).
Note that by default the Google Colab runtime is CPU-only. To change to a GPU runtime, go to `Runtime > Change runtime type` and click on `T4 GPU`. Note that `T4 GPU` is considered pretty slow and is provided by Google Colab free of charge. To access the gold standard `A100 GPU` via Google Colab, a subscription is required.
For local use, if you do not have a GPU, you should expect a warning
```
[KeOps] Warning : Cuda libraries were not detected on the system ; using cpu only mode
```
but the library is fully functional.
## Paper examples
This library is accompanied by the paper
- M. Buze, J. Feydy, S.M. Roper, K. Sedighiani, D.P. Bourne (2024). Anisotropic power diagrams for polycrystal modeling: efficient generation of curved grains via optimal transport. arXiv e-prints 2403.03571, 2024. [LINK](https://arxiv.org/abs/2403.03571)
The examples presented in the paper can be found in `/notebooks/paper_examples`, which includes all the Jupyter notebooks as they were run, the data that was generated and the plots from the paper. For the ease of access, here we list them with links to view them statically in NBViewer and also a link to an interactive version in Google Colab. Note that the notebooks relying the loading of data will not work out of the box in Google Colab -- the relevant data will have to be loaded manually.
- Runtime tests
1. APD generation
- Gathering data [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/gather_data_apd_gen.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/gather_data_apd_gen.ipynb)
- Plotting the data for the 2D case [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen2D.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen2D.ipynb) and for the 3D case [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen3D.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen3D.ipynb)
2. Finding optimal APDs
- Gathering data [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/gather_optimal_apd.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/gather_optimal_apd.ipynb)
- Plotting the data for the 3D multi-phase case [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/plot_optimal_apd.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/plot_optimal_apd.ipynb)
3. EBSD data examples
- Fitting to data and artificial sample generation [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/fitting_and_artificial_apd/EBSD_examples1.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/fitting_and_artificial_apd/EBSD_examples1.ipynb)
- Pixel level comparison [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/pixel_level_comparison/EBSD_example_pixel_data.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/pixel_level_comparison/EBSD_example_pixel_data.ipynb)
4. Additive manufacturing example [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/AM_example/AM_example.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/AM_example/AM_example.ipynb)
## Citing this work
If you use `PyAPD` for academic research, you may cite the paper to which our library is tied as follows (preprint version for now).
```
@misc{pyapd2024,
title={Anisotropic power diagrams for polycrystal modelling: efficient generation of curved grains via optimal transport},
author={Maciej Buze and Jean Feydy and Steven M. Roper and Karo Sedighiani and David P. Bourne},
year={2024},
eprint={2403.03571},
archivePrefix={arXiv},
primaryClass={cond-mat.mtrl-sci}
}
```
## Related projects
* [DREAM.3D](https://github.com/BlueQuartzSoftware/DREAM3D)
* [Kanapy](https://github.com/ICAMS/Kanapy)
* [Neper](https://github.com/neperfepx/neper)
* [LPM: Laguerre-Polycrystalline-Microstructures](https://github.com/DPBourne/Laguerre-Polycrystalline-Microstructures)
Raw data
{
"_id": null,
"home_page": "https://github.com/mbuze/PyAPD",
"name": "PyAPD",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Maciej Buze, Steve Roper, David Bourne",
"author_email": "maciej.buze@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bb/f4/741242da4e41d7a822fed12e2435aa84a7f1a271777f5c7e2868c171108d/PyAPD-0.1.1.tar.gz",
"platform": null,
"description": "\n\n# PyAPD\t\n\nA Python library for computing (optimal) anisotropic power diagrams using GPU acceleration. Current main application concerns geometric modelling of polycrystalline materials with curved boundaries with grains of prescribed volumes and fine control over aspect ratio and location of the grains.\n\n## Installation\n\n__Install with pip:__\n\n pip install PyAPD\n\n## Example usage\nSee `/notebooks/tutorials/example_usage.ipynb` [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/tutorials/example_usage.ipynb?flush_cache=true)\n\n### Google Colab\n\nTo quickly test the speed of the GPU-acceleration, you can play around with the notebook `example_usage.ipynb` in Google Colab [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/tutorials/example_usage.ipynb). \n\nNote that by default the Google Colab runtime is CPU-only. To change to a GPU runtime, go to `Runtime > Change runtime type` and click on `T4 GPU`. Note that `T4 GPU` is considered pretty slow and is provided by Google Colab free of charge. To access the gold standard `A100 GPU` via Google Colab, a subscription is required.\n\nFor local use, if you do not have a GPU, you should expect a warning \n```\n[KeOps] Warning : Cuda libraries were not detected on the system ; using cpu only mode\n```\nbut the library is fully functional. \n\n## Paper examples\n\nThis library is accompanied by the paper \n\n- M. Buze, J. Feydy, S.M. Roper, K. Sedighiani, D.P. Bourne (2024). Anisotropic power diagrams for polycrystal modeling: efficient generation of curved grains via optimal transport. arXiv e-prints 2403.03571, 2024. [LINK](https://arxiv.org/abs/2403.03571)\n\nThe examples presented in the paper can be found in `/notebooks/paper_examples`, which includes all the Jupyter notebooks as they were run, the data that was generated and the plots from the paper. For the ease of access, here we list them with links to view them statically in NBViewer and also a link to an interactive version in Google Colab. Note that the notebooks relying the loading of data will not work out of the box in Google Colab -- the relevant data will have to be loaded manually. \n- Runtime tests\n\t1. APD generation\n\t\t- Gathering data [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/gather_data_apd_gen.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/gather_data_apd_gen.ipynb) \n\t\t- Plotting the data for the 2D case [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen2D.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen2D.ipynb) and for the 3D case [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen3D.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/apd_generation/plot_data_apd_gen3D.ipynb)\n\t2. Finding optimal APDs\n\t\t- Gathering data [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/gather_optimal_apd.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/gather_optimal_apd.ipynb)\n\t\t- Plotting the data for the 3D multi-phase case [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/plot_optimal_apd.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/runtime_tests/finding_optimal_apd/plot_optimal_apd.ipynb)\n\t3. EBSD data examples\n\t\t- Fitting to data and artificial sample generation [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/fitting_and_artificial_apd/EBSD_examples1.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/fitting_and_artificial_apd/EBSD_examples1.ipynb)\n\t\t- Pixel level comparison [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/pixel_level_comparison/EBSD_example_pixel_data.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/ebsd_examples/pixel_level_comparison/EBSD_example_pixel_data.ipynb)\n\t4. Additive manufacturing example [](https://nbviewer.org/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/AM_example/AM_example.ipynb?flush_cache=true) [](https://colab.research.google.com/github/mbuze/PyAPD/blob/main/notebooks/paper_examples/AM_example/AM_example.ipynb)\n\n\n## Citing this work\n\nIf you use `PyAPD` for academic research, you may cite the paper to which our library is tied as follows (preprint version for now).\n```\n@misc{pyapd2024,\n title={Anisotropic power diagrams for polycrystal modelling: efficient generation of curved grains via optimal transport}, \n author={Maciej Buze and Jean Feydy and Steven M. Roper and Karo Sedighiani and David P. Bourne},\n year={2024},\n eprint={2403.03571},\n archivePrefix={arXiv},\n primaryClass={cond-mat.mtrl-sci}\n}\n```\n\n## Related projects\n\n* [DREAM.3D](https://github.com/BlueQuartzSoftware/DREAM3D)\n* [Kanapy](https://github.com/ICAMS/Kanapy)\n* [Neper](https://github.com/neperfepx/neper)\n* [LPM: Laguerre-Polycrystalline-Microstructures](https://github.com/DPBourne/Laguerre-Polycrystalline-Microstructures)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for generating (optimal) anisotropic power diagrams",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/mbuze/PyAPD"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bbf4741242da4e41d7a822fed12e2435aa84a7f1a271777f5c7e2868c171108d",
"md5": "2ddf6ef5b173554fd3c325a737ced98c",
"sha256": "e12193b7cd38a21069991a1a5c2b475948206ea5b87d38c4a8300160be18b059"
},
"downloads": -1,
"filename": "PyAPD-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "2ddf6ef5b173554fd3c325a737ced98c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 16818,
"upload_time": "2024-09-02T19:22:54",
"upload_time_iso_8601": "2024-09-02T19:22:54.285583Z",
"url": "https://files.pythonhosted.org/packages/bb/f4/741242da4e41d7a822fed12e2435aa84a7f1a271777f5c7e2868c171108d/PyAPD-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-02 19:22:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mbuze",
"github_project": "PyAPD",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyapd"
}