Skip to content

Commit c8d2046

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a9ab1ff commit c8d2046

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+220
-244
lines changed

build/lib/crystal_toolkit/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def _repr_mimebundle_(self, include=None, exclude=None):
4343
This only works in Jupyter Lab 3.x or above.\n\n
4444
"""
4545

46-
help_text_plotly = """If you see this text, the Plotly Jupyter Lab extension
47-
is not installed, please consult Plotly documentation for information on how to
46+
help_text_plotly = """If you see this text, the Plotly Jupyter Lab extension
47+
is not installed, please consult Plotly documentation for information on how to
4848
install.
4949
"""
5050

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"10.26434/chemrxiv.11294480.v1": "D. Waroquiers, J. George, M. Horton, S. Schenk, K. Persson, G.-M. Rignanese, X. Gonze, and G. Hautier, \u201cChemEnv\u202f: A Fast and Robust Coordination Environment Identification Tool,\u201d Dec. 2019.\n", "10.3389/fmats.2017.00034": "N. E. R. Zimmermann, M. K. Horton, A. Jain, and M. Haranczyk, \u201cAssessing Local Structure Motifs Using Order Parameters for Motif Recognition, Interstitial Identification, and Diffusion Path Characterization,\u201d Frontiers in Materials, vol. 4, Nov. 2017.\n"}
1+
{"10.26434/chemrxiv.11294480.v1": "D. Waroquiers, J. George, M. Horton, S. Schenk, K. Persson, G.-M. Rignanese, X. Gonze, and G. Hautier, \u201cChemEnv\u202f: A Fast and Robust Coordination Environment Identification Tool,\u201d Dec. 2019.\n", "10.3389/fmats.2017.00034": "N. E. R. Zimmermann, M. K. Horton, A. Jain, and M. Haranczyk, \u201cAssessing Local Structure Motifs Using Order Parameters for Motif Recognition, Interstitial Identification, and Diffusion Path Characterization,\u201d Frontiers in Materials, vol. 4, Nov. 2017.\n"}

build/lib/crystal_toolkit/apps/assets/task_ids_on_load.json

+1-1
Large diffs are not rendered by default.

build/lib/crystal_toolkit/apps/examples/GaN_bs.json

+1-1
Large diffs are not rendered by default.

build/lib/crystal_toolkit/apps/examples/GaN_dos.json

+1-1
Large diffs are not rendered by default.

build/lib/crystal_toolkit/apps/examples/Si_bs.json

+1-1
Large diffs are not rendered by default.

build/lib/crystal_toolkit/apps/examples/Si_dos.json

+1-1
Large diffs are not rendered by default.

build/lib/crystal_toolkit/apps/examples/bandstructure.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# standard Dash imports
22
import dash
3-
import dash_html_components as html
4-
import dash_core_components as dcc
53

64
# standard Crystal Toolkit import
75
import crystal_toolkit.components as ctc
86
from crystal_toolkit.settings import SETTINGS
9-
from crystal_toolkit.helpers.layouts import H1, H2, Container
7+
from crystal_toolkit.helpers.layouts import Container, H1
108

119
# dos and bs data from local jsons
1210
from monty.serialization import loadfn
@@ -35,7 +33,10 @@
3533

3634
# example layout to demonstrate capabilities of component
3735
my_layout = Container(
38-
[H1("Band Structure and Density of States Example"), bsdos_component.layout(),]
36+
[
37+
H1("Band Structure and Density of States Example"),
38+
bsdos_component.layout(),
39+
]
3940
)
4041

4142
# wrap your app.layout with crystal_toolkit_layout()

build/lib/crystal_toolkit/apps/examples/basic_hello_structure.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# as explained in "preamble" section in documentation
22
import dash
33
import dash_html_components as html
4-
import dash_core_components as dcc
54
import crystal_toolkit.components as ctc
65

76
app = dash.Dash()

build/lib/crystal_toolkit/apps/examples/basic_hello_structure_interactive.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# as above
22
import dash
33
import dash_html_components as html
4-
import dash_core_components as dcc
54
import crystal_toolkit.components as ctc
65

76
# standard Dash imports for callbacks (interactivity)
8-
from dash.dependencies import Input, Output, State
7+
from dash.dependencies import Input, Output
98
from dash.exceptions import PreventUpdate
109

1110
from pymatgen.core.structure import Structure

build/lib/crystal_toolkit/apps/examples/basic_hello_world.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# standard Dash imports
22
import dash
33
import dash_html_components as html
4-
import dash_core_components as dcc
54

65
# standard Crystal Toolkit import
76
import crystal_toolkit.components as ctc

build/lib/crystal_toolkit/apps/examples/diffraction.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
# standard Dash imports
22
import dash
3-
import dash_html_components as html
4-
import dash_core_components as dcc
53

64
# standard Crystal Toolkit import
75
import crystal_toolkit.components as ctc
86
from crystal_toolkit.settings import SETTINGS
97
from crystal_toolkit.helpers.layouts import H1, H3, Container
108

119
# import for this example
12-
from pymatgen.ext.matproj import MPRester
13-
from pymatgen.analysis.phase_diagram import PhaseDiagram
14-
from pymatgen.analysis.diffraction.xrd import XRDCalculator
1510

1611
# create Dash app as normal
1712
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)

build/lib/crystal_toolkit/apps/examples/diffraction_dynamic.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# standard Dash imports
22
import dash
3-
import dash_html_components as html
4-
import dash_core_components as dcc
53
from dash.dependencies import Input, Output
64

75
# standard Crystal Toolkit import
86
import crystal_toolkit.components as ctc
97
from crystal_toolkit.settings import SETTINGS
10-
from crystal_toolkit.helpers.layouts import H1, H2, Container, Button
8+
from crystal_toolkit.helpers.layouts import Button, Container, H1
119

1210
# create Dash app as normal
1311
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)

build/lib/crystal_toolkit/apps/examples/diffraction_empty.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
# standard Dash imports
22
import dash
3-
import dash_html_components as html
4-
import dash_core_components as dcc
53

64
# standard Crystal Toolkit import
75
import crystal_toolkit.components as ctc
86
from crystal_toolkit.settings import SETTINGS
9-
from crystal_toolkit.helpers.layouts import H1, H2, Container
7+
from crystal_toolkit.helpers.layouts import Container, H1
108

119
# import for this example
1210
from pymatgen.core.structure import Structure
1311
from pymatgen.core.lattice import Lattice
14-
from pymatgen.ext.matproj import MPRester
15-
from pymatgen.analysis.phase_diagram import PhaseDiagram
16-
from pymatgen.analysis.diffraction.xrd import XRDCalculator
1712

1813
# create Dash app as normal
1914
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
@@ -28,7 +23,10 @@
2823

2924
# example layout to demonstrate capabilities of component
3025
my_layout = Container(
31-
[H1("XRDComponent Example (Empty, No Structure Defined)"), xrd_component.layout(),]
26+
[
27+
H1("XRDComponent Example (Empty, No Structure Defined)"),
28+
xrd_component.layout(),
29+
]
3230
)
3331

3432
# as explained in "preamble" section in documentation

build/lib/crystal_toolkit/apps/examples/structure.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# standard Dash imports
22
import dash
3-
import dash_core_components as dcc
43
import dash_html_components as html
54

65
# import for this example

build/lib/crystal_toolkit/apps/examples/tests/test_basic.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_hello_scientist(dash_duo):
1717
time.sleep(1)
1818
dash_duo.percy_snapshot("hello_scientist")
1919

20-
logs = dash_duo.get_logs()
20+
dash_duo.get_logs()
2121
# assert bool(logs) is False, f"Browser console contains an error: {logs}"
2222

2323

@@ -28,7 +28,7 @@ def test_hello_structure(dash_duo):
2828
time.sleep(1)
2929
dash_duo.percy_snapshot("hello_structure")
3030

31-
logs = dash_duo.get_logs()
31+
dash_duo.get_logs()
3232
# assert bool(logs) is False, f"Browser console contains an error: {logs}"
3333

3434

@@ -44,5 +44,5 @@ def test_hello_structure_interactive(dash_duo):
4444
time.sleep(1)
4545
dash_duo.percy_snapshot("hello_structure_interactive_on_click")
4646

47-
logs = dash_duo.get_logs()
47+
dash_duo.get_logs()
4848
# assert bool(logs) is False, f"Browser console contains an error: {logs}"

build/lib/crystal_toolkit/apps/examples/transformations.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# standard Dash imports
22
import dash
33
import dash_html_components as html
4-
import dash_core_components as dcc
5-
from dash.dependencies import Input, Output, State
6-
from dash.exceptions import PreventUpdate
4+
from dash.dependencies import Input, Output
75

86
# standard Crystal Toolkit import
97
import crystal_toolkit.components as ctc

build/lib/crystal_toolkit/apps/examples/transformations_minimal.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import dash
33
import dash_core_components as dcc
44
import dash_html_components as html
5-
from dash.dependencies import Input, Output, State
6-
from dash.exceptions import PreventUpdate
5+
from dash.dependencies import Input, Output
76
from dash_mp_components import JsonView
87

98
# import for this example
@@ -59,7 +58,8 @@
5958

6059

6160
@app.callback(
62-
Output("structure_out", "data"), [Input(transformation_component.id(), "data")],
61+
Output("structure_out", "data"),
62+
[Input(transformation_component.id(), "data")],
6363
)
6464
def update_structure(struct):
6565
return struct

build/lib/crystal_toolkit/apps/main.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
import os
3-
from ast import literal_eval
43
from random import choice
54
from time import time
65
from typing import Optional
@@ -19,7 +18,7 @@
1918
import crystal_toolkit.components as ctc
2019
from crystal_toolkit import __file__ as module_path
2120
from crystal_toolkit.core.mpcomponent import MPComponent
22-
from crystal_toolkit.helpers.layouts import *
21+
from crystal_toolkit.helpers.layouts import Box, Column, Columns, Container, Footer, H3, Loading, MessageBody, MessageContainer, MessageHeader, Reveal, Section, dcc, html, warnings
2322
from crystal_toolkit.settings import SETTINGS
2423

2524
# choose a default structure on load

build/lib/crystal_toolkit/components/bandstructure.py

+28-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import numpy as np
44
import plotly.graph_objs as go
5-
import plotly.subplots as tls
65
from dash.dependencies import Input, Output
76
from dash.exceptions import PreventUpdate
87

@@ -15,13 +14,13 @@
1514
)
1615
from pymatgen.electronic_structure.core import Spin
1716
from pymatgen.electronic_structure.dos import CompleteDos
18-
from pymatgen.electronic_structure.plotter import BSPlotter, fold_point
17+
from pymatgen.electronic_structure.plotter import BSPlotter
1918
from pymatgen.symmetry.bandstructure import HighSymmKpath
2019

2120
from crystal_toolkit.core.scene import Scene, Lines, Spheres, Convex, Cylinders
2221
from crystal_toolkit.core.mpcomponent import MPComponent
2322
from crystal_toolkit.core.panelcomponent import PanelComponent
24-
from crystal_toolkit.helpers.layouts import *
23+
from crystal_toolkit.helpers.layouts import Column, Columns, Label, Loading, MessageBody, MessageContainer, bandstructure_symm_line, bs, bsml, dcc, density_of_states, dos, dos_select, elements, get_bandstructure_traces, get_data_list, get_dos_traces, html, path_convention
2524

2625
# Author: Jason Munro
2726
@@ -62,7 +61,13 @@ def _sub_layouts(self):
6261
fig = BandstructureAndDosComponent.get_figure(bs, dos)
6362
# Main plot
6463
graph = Loading(
65-
[dcc.Graph(figure=fig, config={"displayModeBar": False}, responsive=True,)],
64+
[
65+
dcc.Graph(
66+
figure=fig,
67+
config={"displayModeBar": False},
68+
responsive=True,
69+
)
70+
],
6671
id=self.id("bsdos-div"),
6772
)
6873

@@ -85,7 +90,10 @@ def _sub_layouts(self):
8590
options=[
8691
{"label": "Latimer-Munro", "value": "lm"},
8792
{"label": "Hinuma et al.", "value": "hin"},
88-
{"label": "Setyawan-Curtarolo", "value": "sc",},
93+
{
94+
"label": "Setyawan-Curtarolo",
95+
"value": "sc",
96+
},
8997
],
9098
)
9199
],
@@ -106,7 +114,10 @@ def _sub_layouts(self):
106114
options=[
107115
{"label": "Latimer-Munro", "value": "lm"},
108116
{"label": "Hinuma et al.", "value": "hin"},
109-
{"label": "Setyawan-Curtarolo", "value": "sc",},
117+
{
118+
"label": "Setyawan-Curtarolo",
119+
"value": "sc",
120+
},
110121
],
111122
)
112123
],
@@ -498,8 +509,8 @@ def get_dos_traces(dos, dos_select, energy_window=(-6.0, 10.0)):
498509

499510
dostraces = []
500511

501-
dos_max = np.abs((dos.energies - dos.efermi - energy_window[1])).argmin()
502-
dos_min = np.abs((dos.energies - dos.efermi - energy_window[0])).argmin()
512+
dos_max = np.abs(dos.energies - dos.efermi - energy_window[1]).argmin()
513+
dos_min = np.abs(dos.energies - dos.efermi - energy_window[0]).argmin()
503514

504515
# TODO: pymatgen should have a property here
505516
spin_polarized = len(dos.densities.keys()) == 2
@@ -541,7 +552,7 @@ def get_dos_traces(dos, dos_select, energy_window=(-6.0, 10.0)):
541552
dostraces.append(trace_tdos)
542553

543554
ele_dos = dos.get_element_dos()
544-
elements = [str(entry) for entry in ele_dos.keys()]
555+
[str(entry) for entry in ele_dos.keys()]
545556

546557
if dos_select == "ap":
547558
proj_data = ele_dos
@@ -683,7 +694,10 @@ def get_figure(
683694
ticks="inside",
684695
linewidth=2,
685696
tickwidth=2,
686-
range=[-rmax * 1.1 * int(len(bs_data["energy"].keys()) == 2), rmax * 1.1,],
697+
range=[
698+
-rmax * 1.1 * int(len(bs_data["energy"].keys()) == 2),
699+
rmax * 1.1,
700+
],
687701
linecolor="rgb(71,71,71)",
688702
gridcolor="white",
689703
zerolinecolor="white",
@@ -868,7 +882,10 @@ def update_select(elements, mpid):
868882
],
869883
)
870884
def bs_dos_data(
871-
data, path_convention, dos_select, label_select,
885+
data,
886+
path_convention,
887+
dos_select,
888+
label_select,
872889
):
873890

874891
# Obtain bands to plot over and generate traces for bs data:

0 commit comments

Comments
 (0)