Name | widget-bandsplot JSON |
Version |
0.7.4
JSON |
| download |
home_page | None |
Summary | A Jupyter widget to plot band structure and density of states. |
upload_time | 2024-08-19 15:17:10 |
maintainer | None |
docs_url | None |
author | The OSSCAR team |
requires_python | >=3.9 |
license | BSD 3-Clause License Copyright (c) 2024, OSSCAR (Open Software Services for Classrooms and Research) team, EPFL, Lausanne, Switzerland 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 the copyright holder 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. |
keywords |
anywidget
electronic-structure
jupyter
jupyterlab
osscar
phonons
widget
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# `widget-bandsplot`: Jupyter Widget to Plot Band Structure and Density of States
[![PyPI version](https://badge.fury.io/py/widget-bandsplot.svg)](https://badge.fury.io/py/widget-bandsplot)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/osscar-org/widget-bandsplot/main?labpath=%2Fexample%2Fexample.ipynb)
[![screenshot comparison](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml/badge.svg)](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml)
A Jupyter widget to plot band structures and density of states. The widget is using the [mc-react-bands](https://github.com/materialscloud-org/mc-react-bands) Javascript package and is turned into a Jupyter widget with [anywidget](https://anywidget.dev/).
<img src="./example/demo.gif" width='1200'>
## Installation
```sh
pip install widget-bandsplot
```
## Usage
Minimal usage example of the widget is the following:
```python
widget = BandsPlotWidget(
bands = [bands_data],
dos = dos_data,
energy_range = [-10.0, 10.0],
format_settings = {
"showFermi": True,
"showLegend": True,
}
)
display(widget)
```
where `bands_data` and `dos_data` are contain the band structure and density of states data, respectively. The format for these data objects is the following:
- Band structure data follows the [AiiDA CLI](https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/command_line.html#reference-command-line) export format that can be generated from an [AiiDA BandsData](https://aiida.readthedocs.io/projects/aiida-core/en/v2.6.2/topics/data_types.html#topics-data-types-materials-bands) node with the following command:
```bash
verdi data band export <PK> --format=json
```
- The density of states data uses a custom format, with a a valid example being:
```python
dos_data = {
"fermi_energy": -7.0,
"dos": [
{
"label": "Total DOS", # required
"x": [0.0, 0.1, 0.2], # required
"y": [1.2, 3.2, 0.0], # required
"lineStyle": "dash", # optional
"borderColor": "#41e2b3", # optional
"backgroundColor": "#51258b", # optional
},
{
"label": "Co",
"x": [0.0, 0.1, 0.2],
"y": [1.2, 3.2, 0.0],
"lineStyle": "solid",
"borderColor": "#43ee8b",
"backgroundColor": "#59595c",
},
],
}
```
For more detailed usage, see `example/example.ipynb` and for more example input files see `example/data`.
## Development
Install the python code:
```sh
pip install -e .[dev]
```
You then need to install the JavaScript dependencies and run the development server.
```sh
npm install
npm run dev
```
Open `examples/example.ipynb` in Jupyter notebook or lab to start developing. Changes made in `js/` will be reflected in the notebook.
### Releasing and publishing a new version
In order to make a new release of the library and publish to PYPI, run
```bash
bumpver update --major/--minor/--patch
```
This will
- update version numbers, make a corresponding `git commit` and a `git tag`;
- push this commit and tag to Github, which triggers the Github Action that makes a new Github Release and publishes the package to PYPI.
### Github workflow testing
[![screenshot comparison](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml/badge.svg)](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml)
The `screenshot comparison` test will generate images of the widget using `selenium` and `chrome-driver`, and compares them to the reference image in `test/widget-sample.png`.
To update the reference image: download the generated image from the Github Workflow step called "Upload screenshots" and replace `test/widget-sample.png`.
## Acknowledgements
We acknowledge support from the EPFL Open Science Fund via the [OSSCAR](http://www.osscar.org) project.
<img src='https://www.osscar.org/_images/logos.png' width='1200'>
Raw data
{
"_id": null,
"home_page": null,
"name": "widget-bandsplot",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "anywidget, electronic-structure, jupyter, jupyterlab, osscar, phonons, widget",
"author": "The OSSCAR team",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7b/9f/ae147822b63f02a6a25c1263787c3d0074997e351f2cc6ae365387914d99/widget_bandsplot-0.7.4.tar.gz",
"platform": null,
"description": "# `widget-bandsplot`: Jupyter Widget to Plot Band Structure and Density of States\n\n[![PyPI version](https://badge.fury.io/py/widget-bandsplot.svg)](https://badge.fury.io/py/widget-bandsplot)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/osscar-org/widget-bandsplot/main?labpath=%2Fexample%2Fexample.ipynb)\n[![screenshot comparison](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml/badge.svg)](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml)\n\nA Jupyter widget to plot band structures and density of states. The widget is using the [mc-react-bands](https://github.com/materialscloud-org/mc-react-bands) Javascript package and is turned into a Jupyter widget with [anywidget](https://anywidget.dev/).\n\n<img src=\"./example/demo.gif\" width='1200'>\n\n## Installation\n\n```sh\npip install widget-bandsplot\n```\n\n## Usage\n\nMinimal usage example of the widget is the following:\n\n```python\nwidget = BandsPlotWidget(\n bands = [bands_data],\n dos = dos_data,\n energy_range = [-10.0, 10.0],\n format_settings = {\n \"showFermi\": True,\n \"showLegend\": True,\n }\n)\ndisplay(widget)\n```\n\nwhere `bands_data` and `dos_data` are contain the band structure and density of states data, respectively. The format for these data objects is the following:\n\n- Band structure data follows the [AiiDA CLI](https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/command_line.html#reference-command-line) export format that can be generated from an [AiiDA BandsData](https://aiida.readthedocs.io/projects/aiida-core/en/v2.6.2/topics/data_types.html#topics-data-types-materials-bands) node with the following command:\n ```bash\n verdi data band export <PK> --format=json\n ```\n- The density of states data uses a custom format, with a a valid example being:\n ```python\n dos_data = {\n \"fermi_energy\": -7.0,\n \"dos\": [\n {\n \"label\": \"Total DOS\", # required\n \"x\": [0.0, 0.1, 0.2], # required\n \"y\": [1.2, 3.2, 0.0], # required\n \"lineStyle\": \"dash\", # optional\n \"borderColor\": \"#41e2b3\", # optional\n \"backgroundColor\": \"#51258b\", # optional\n },\n {\n \"label\": \"Co\",\n \"x\": [0.0, 0.1, 0.2],\n \"y\": [1.2, 3.2, 0.0],\n \"lineStyle\": \"solid\",\n \"borderColor\": \"#43ee8b\",\n \"backgroundColor\": \"#59595c\",\n },\n ],\n }\n ```\n\nFor more detailed usage, see `example/example.ipynb` and for more example input files see `example/data`.\n\n## Development\n\nInstall the python code:\n\n```sh\npip install -e .[dev]\n```\n\nYou then need to install the JavaScript dependencies and run the development server.\n\n```sh\nnpm install\nnpm run dev\n```\n\nOpen `examples/example.ipynb` in Jupyter notebook or lab to start developing. Changes made in `js/` will be reflected in the notebook.\n\n### Releasing and publishing a new version\n\nIn order to make a new release of the library and publish to PYPI, run\n\n```bash\nbumpver update --major/--minor/--patch\n```\n\nThis will\n\n- update version numbers, make a corresponding `git commit` and a `git tag`;\n- push this commit and tag to Github, which triggers the Github Action that makes a new Github Release and publishes the package to PYPI.\n\n### Github workflow testing\n\n[![screenshot comparison](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml/badge.svg)](https://github.com/osscar-org/widget-bandsplot/actions/workflows/screenshot-comparison.yml)\n\nThe `screenshot comparison` test will generate images of the widget using `selenium` and `chrome-driver`, and compares them to the reference image in `test/widget-sample.png`.\n\nTo update the reference image: download the generated image from the Github Workflow step called \"Upload screenshots\" and replace `test/widget-sample.png`.\n\n## Acknowledgements\n\nWe acknowledge support from the EPFL Open Science Fund via the [OSSCAR](http://www.osscar.org) project.\n\n<img src='https://www.osscar.org/_images/logos.png' width='1200'>\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2024, OSSCAR (Open Software Services for Classrooms and Research) team, EPFL, Lausanne, Switzerland 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 the copyright holder 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 COPYRIGHT HOLDERS AND CONTRIBUTORS \"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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.",
"summary": "A Jupyter widget to plot band structure and density of states.",
"version": "0.7.4",
"project_urls": {
"Home": "https://www.osscar.org/",
"Source": "https://github.com/osscar-org/widget-bandsplot"
},
"split_keywords": [
"anywidget",
" electronic-structure",
" jupyter",
" jupyterlab",
" osscar",
" phonons",
" widget"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bd0abeaffe8d6e2000d45f2da8e50cc799c12cc86380c1c36cc11ae5935a4295",
"md5": "f64f878babe0731e9a717c990ae9e040",
"sha256": "aae3d2838be80d7ce514a1f3a761a77baef86691d761e908acdf49462551d4be"
},
"downloads": -1,
"filename": "widget_bandsplot-0.7.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f64f878babe0731e9a717c990ae9e040",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 187752,
"upload_time": "2024-08-19T15:17:08",
"upload_time_iso_8601": "2024-08-19T15:17:08.644142Z",
"url": "https://files.pythonhosted.org/packages/bd/0a/beaffe8d6e2000d45f2da8e50cc799c12cc86380c1c36cc11ae5935a4295/widget_bandsplot-0.7.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7b9fae147822b63f02a6a25c1263787c3d0074997e351f2cc6ae365387914d99",
"md5": "ee2d010fb09f249a14da5a41431d81b0",
"sha256": "a627f6fa5b85b98b8a29dae1fce5c00c6ceae3422e8a657c7ff192ee3d836594"
},
"downloads": -1,
"filename": "widget_bandsplot-0.7.4.tar.gz",
"has_sig": false,
"md5_digest": "ee2d010fb09f249a14da5a41431d81b0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 185898,
"upload_time": "2024-08-19T15:17:10",
"upload_time_iso_8601": "2024-08-19T15:17:10.510003Z",
"url": "https://files.pythonhosted.org/packages/7b/9f/ae147822b63f02a6a25c1263787c3d0074997e351f2cc6ae365387914d99/widget_bandsplot-0.7.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-19 15:17:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "osscar-org",
"github_project": "widget-bandsplot",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "widget-bandsplot"
}