Skip to content

Commit 1d19a0b

Browse files
authored
Merge branch 'main' into pourbaix
2 parents 9c75f82 + 8dd2f34 commit 1d19a0b

File tree

15 files changed

+984
-2820
lines changed

15 files changed

+984
-2820
lines changed

.github/workflows/issue-metrics.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Monthly issue metrics
22
on:
33
workflow_dispatch:
4-
schedule:
5-
- cron: '3 2 1 * *'
64

75
permissions:
86
contents: read

.github/workflows/pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python-version: ["3.10"]
21+
python-version: ["3.11"]
2222

2323
steps:
2424
- uses: actions/checkout@v4
@@ -46,7 +46,7 @@ jobs:
4646
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
4747
run: python${{ matrix.python-version }} -m pytest --cov=crystal_toolkit --cov-report=xml --color=yes --webdriver Chrome --headless crystal_toolkit/apps/examples/tests/
4848
- uses: codecov/codecov-action@v1
49-
if: matrix.python-version == 3.10
49+
if: matrix.python-version == 3.11
5050
with:
5151
token: ${{ secrets.CODECOV_TOKEN }}
5252
file: ./coverage.xml

.github/workflows/pytest-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ["3.10"]
20+
python-version: ["3.11"]
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 0
2626
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2828
with:
2929
python-version: ${{ matrix.python-version }}
3030
cache: 'pip'

.github/workflows/upgrade-dependencies.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ name: upgrade dependencies
33

44
on:
55
workflow_dispatch: # Allow running on-demand
6-
schedule:
7-
# Runs every Monday at 8:00 UTC (4:00 Eastern)
8-
- cron: "0 8 * * 1"
96

107
jobs:
118
upgrade:
@@ -71,6 +68,8 @@ jobs:
7168
git checkout -b auto-dependency-upgrades
7269
git branch -r | grep auto-dependency-upgrades- | xargs -I {} git merge {}
7370
git rebase ${GITHUB_REF##*/}
71+
git reset $(git merge-base ${GITHUB_REF##*/} HEAD)
72+
git commit -a -m "auto dependency upgrades"
7473
git push -f origin auto-dependency-upgrades
7574
git branch -r | grep auto-dependency-upgrades- | cut -d/ -f2 | xargs -I {} git push origin :{}
7675
- name: Open pull request if needed

.github/workflows/url-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v3
1515

1616
- name: Check for broken links
17-
uses: lycheeverse/lychee-action@v1
17+
uses: lycheeverse/lychee-action@v2.0.2
1818
with:
1919
# --exclude-loopback ensures we don't check localhost URLs
2020
args: --exclude-loopback './**/*.md' './**/*.rst'

crystal_toolkit/components/diffraction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,26 @@ def __init__(
5656
# Default XRD plot style settings
5757
default_xrd_plot_style = frozendict(
5858
xaxis={
59-
"title": "2𝜃 / º",
59+
"title": {"text": "2θ (°)", "font": {"size": 16}},
6060
"anchor": "y",
6161
"nticks": 8,
6262
"showgrid": True,
6363
"showline": True,
6464
"side": "bottom",
6565
"tickfont": {"size": 16.0},
6666
"ticks": "inside",
67-
"titlefont": {"size": 16.0},
6867
"type": "linear",
6968
"zeroline": False,
7069
},
7170
yaxis={
72-
"title": "Intensity / arb. units",
71+
"title": {"text": "Intensity / arb. units", "font": {"size": 16}},
7372
"anchor": "x",
7473
"nticks": 7,
7574
"showgrid": True,
7675
"showline": True,
7776
"side": "left",
7877
"tickfont": {"size": 16.0},
7978
"ticks": "inside",
80-
"titlefont": {"size": 16.0},
8179
"type": "linear",
8280
"zeroline": False,
8381
},

crystal_toolkit/core/scene.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def merge(cls, sphere_list):
214214
visible=sphere_list[0].visible,
215215
clickable=sphere_list[0].clickable,
216216
tooltip=sphere_list[0].tooltip,
217+
_meta=sphere_list[0]._meta,
217218
)
218219

219220

@@ -320,13 +321,18 @@ def merge(cls, cylinder_list):
320321
chain.from_iterable([cylinder.positionPairs for cylinder in cylinder_list])
321322
)
322323

324+
new_meta_list = list(
325+
chain.from_iterable([[cylinder._meta] for cylinder in cylinder_list])
326+
)
327+
323328
return cls(
324329
positionPairs=new_positionPairs,
325330
color=cylinder_list[0].color,
326331
radius=cylinder_list[0].radius,
327332
visible=cylinder_list[0].visible,
328333
clickable=cylinder_list[0].clickable,
329334
tooltip=cylinder_list[0].tooltip,
335+
_meta=new_meta_list,
330336
)
331337

332338
@property

crystal_toolkit/renderables/site.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def get_site_scene(
4747
visualize_bond_orders: bool = False,
4848
magmom_scale: float = 1.0,
4949
legend: Legend | None = None,
50+
retain_atom_idx: bool = False,
5051
) -> Scene:
5152
"""Get a Scene object for a Site.
5253
@@ -70,6 +71,7 @@ def get_site_scene(
7071
visualize_bond_orders (bool, optional): Defaults to False.
7172
magmom_scale (float, optional): Defaults to 1.0.
7273
legend (Legend | None, optional): Defaults to None.
74+
retain_atom_idx (bool, optional): Defaults to False.
7375
7476
Returns:
7577
Scene: The scene object containing atoms, bonds, polyhedra, magmoms.
@@ -135,6 +137,7 @@ def get_site_scene(
135137
phiEnd=phiEnd,
136138
clickable=True,
137139
tooltip=name,
140+
_meta=[site_idx] if retain_atom_idx else None,
138141
)
139142
atoms.append(sphere)
140143

@@ -207,6 +210,9 @@ def get_site_scene(
207210
radius=bond_radius / 2,
208211
clickable=True,
209212
tooltip=name_cyl,
213+
_meta=[site_idx, connected_site.index]
214+
if retain_atom_idx
215+
else None,
210216
)
211217
)
212218
trans_vector = trans_vector + 0.25 * max_radius
@@ -218,6 +224,9 @@ def get_site_scene(
218224
radius=bond_radius,
219225
clickable=True,
220226
tooltip=name_cyl,
227+
_meta=[site_idx, connected_site.index]
228+
if retain_atom_idx
229+
else None,
221230
)
222231
bonds.append(cylinder)
223232

@@ -228,6 +237,7 @@ def get_site_scene(
228237
radius=bond_radius,
229238
clickable=True,
230239
tooltip=name_cyl,
240+
_meta=[site_idx, connected_site.index] if retain_atom_idx else None,
231241
)
232242
bonds.append(cylinder)
233243
all_positions.append(connected_position.tolist())
@@ -251,6 +261,7 @@ def get_site_scene(
251261
positionPairs=[[position, bond_midpoint.tolist()]],
252262
color=color,
253263
radius=bond_radius,
264+
_meta=[site_idx, connected_site.index] if retain_atom_idx else None,
254265
)
255266
bonds.append(cylinder)
256267
all_positions.append(connected_position.tolist())

crystal_toolkit/renderables/structuregraph.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ def get_weight_color(weight):
197197
explicitly_calculate_polyhedra_hull=explicitly_calculate_polyhedra_hull,
198198
legend=legend,
199199
bond_radius=bond_radius,
200+
site_idx=idx,
201+
show_atom_idx=True,
200202
**(site_get_scene_kwargs or {}),
201203
)
202204

0 commit comments

Comments
 (0)