{"id":18767964,"url":"https://github.com/osscar-org/widget-bandsplot","last_synced_at":"2025-04-13T06:32:36.499Z","repository":{"id":40428722,"uuid":"343224369","full_name":"osscar-org/widget-bandsplot","owner":"osscar-org","description":"A Jupyter widget to plot bandstructure and density of states.","archived":false,"fork":false,"pushed_at":"2024-09-12T06:46:45.000Z","size":7448,"stargazers_count":16,"open_issues_count":11,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T23:21:57.718Z","etag":null,"topics":["aiida","aiidalab","bandstructure","density-of-states","juptyer-widget","solid-state-physics"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osscar-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-28T22:00:57.000Z","updated_at":"2025-03-20T15:14:17.000Z","dependencies_parsed_at":"2023-12-11T17:46:27.934Z","dependency_job_id":"e02afe14-e0fd-4f7e-8594-4357c5aef30f","html_url":"https://github.com/osscar-org/widget-bandsplot","commit_stats":{"total_commits":181,"total_committers":8,"mean_commits":22.625,"dds":0.4917127071823204,"last_synced_commit":"36cb6786fa59c2dcbb7842f832b6cc1d2b08a3f3"},"previous_names":["osscar-org/widget-bandsplot","aiidalab/widget-bandsplot"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscar-org%2Fwidget-bandsplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscar-org%2Fwidget-bandsplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscar-org%2Fwidget-bandsplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osscar-org%2Fwidget-bandsplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osscar-org","download_url":"https://codeload.github.com/osscar-org/widget-bandsplot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674678,"owners_count":21143760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiida","aiidalab","bandstructure","density-of-states","juptyer-widget","solid-state-physics"],"created_at":"2024-11-07T19:09:52.030Z","updated_at":"2025-04-13T06:32:31.471Z","avatar_url":"https://github.com/osscar-org.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `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\u003cimg src=\"./example/demo.gif\" width='1200'\u003e\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 \u003cPK\u003e --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## How to cite\n\nWhen using the content of this repository, please cite the following two articles:\n\n1. D. Du, T. J. Baird, S. Bonella and G. Pizzi, OSSCAR, an open platform for collaborative development of computational tools for education in science, *Computer Physics Communications*, **282**, 108546 (2023).\nhttps://doi.org/10.1016/j.cpc.2022.108546\n\n2. D. Du, T. J. Baird, K. Eimre, S. Bonella, G. Pizzi, Jupyter widgets and extensions for education and research in computational physics and chemistry, *Computer Physics Communications*, **305**, 109353 (2024).\nhttps://doi.org/10.1016/j.cpc.2024.109353\n\n\n## Acknowledgements\n\nWe acknowledge support from the EPFL Open Science Fund via the [OSSCAR](http://www.osscar.org) project.\n\n\u003cimg src='https://www.osscar.org/_images/logos.png' width='1200'\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosscar-org%2Fwidget-bandsplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosscar-org%2Fwidget-bandsplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosscar-org%2Fwidget-bandsplot/lists"}