Skip to content

Commit ee296bc

Browse files
committed
delete unused enums Model + ElemColorMode
1 parent 3a0e734 commit ee296bc

File tree

9 files changed

+27
-56
lines changed

9 files changed

+27
-56
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default_install_hook_types: [pre-commit, commit-msg]
88

99
repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.11.2
11+
rev: v0.11.4
1212
hooks:
1313
- id: ruff
1414
args: [--fix]
@@ -67,7 +67,7 @@ repos:
6767
exclude: ^(site/src/figs/.+\.svelte|data/wbm/20.+\..+|site/src/(routes|figs).+\.(yaml|json)|changelog.md)$
6868

6969
- repo: https://github.com/pre-commit/mirrors-eslint
70-
rev: v9.23.0
70+
rev: v9.24.0
7171
hooks:
7272
- id: eslint
7373
types: [file]
@@ -82,12 +82,12 @@ repos:
8282
- "@stylistic/eslint-plugin"
8383

8484
- repo: https://github.com/RobertCraigie/pyright-python
85-
rev: v1.1.397
85+
rev: v1.1.398
8686
hooks:
8787
- id: pyright
8888

8989
- repo: https://github.com/python-jsonschema/check-jsonschema
90-
rev: 0.31.3
90+
rev: 0.32.1
9191
hooks:
9292
- id: check-jsonschema
9393
files: ^pymatviz/keys\.yml$

examples/compare_elastic_constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from ase.units import GPa
1919
from emmet.core.elasticity import ElasticityDoc
2020
from mace.calculators import mace_mp
21-
from matcalc.elasticity import ElasticityCalc
21+
from matcalc.benchmark import ElasticityCalc
2222
from tqdm import tqdm
2323

2424
import pymatviz as pmv
@@ -30,7 +30,7 @@
3030
raise SystemExit(0) from None
3131

3232
pmv.set_plotly_template("pymatviz_white")
33-
checkpoint = "https://github.com/ACEsuit/mace-mp/releases/download/mace_matpes_0/MACE-matpes-pbe-omat-ft.model"
33+
checkpoint = "https://github.com/ACEsuit/mace-foundations/releases/download/mace_matpes_0/MACE-matpes-pbe-omat-ft.model"
3434

3535

3636
# %%

examples/diatomics/calc_mlip_diatomic_curves.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def calc_diatomic_curve(
100100

101101

102102
if __name__ == "__main__":
103-
mace_chkpt_url = "https://github.com/ACEsuit/mace-mp/releases/download"
103+
mace_chkpt_url = "https://github.com/ACEsuit/mace-foundations/releases/download"
104104
checkpoints = {
105105
# "mace-mpa-0-medium": f"{mace_chkpt_url}/mace_mpa_0/mace-mpa-0-medium.model",
106106
"mace-omat-0-medium": f"{mace_chkpt_url}/mace_omat_0/mace-omat-0-medium.model",

examples/matpes/eda.py

+14-19
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@
1818
module_dir = os.path.dirname(__file__)
1919

2020

21-
# %% 20240214-MatPES-178070-r2SCAN generated in collaboration with Shyue Ping Ong's
22-
# group and Aaron Kaplan is unpublished data as of 2024-07-10, to be shared
23-
# MIT-licensed in late 2024 at the earliest
24-
with gzip.open(
25-
f"{module_dir}/20240214-MatPES-178070-r2SCAN.json.gz", mode="rt"
26-
) as file:
21+
# %%
22+
r2scan_path = f"{module_dir}/20240214-MatPES-178070-r2SCAN.json.gz"
23+
pbe_path = f"{module_dir}/20240214-MatPES-183027-PBE.json.gz"
24+
with gzip.open(r2scan_path, mode="rt") as file:
2725
r2scan_data = json.load(file)
28-
# examples/matpes/20240214-MatPES-183027-PBE.json.gz
29-
with gzip.open(f"{module_dir}/20240214-MatPES-183027-PBE.json.gz", mode="rt") as file:
26+
with gzip.open(pbe_path, mode="rt") as file:
3027
pbe_data = json.load(file)
3128

3229
n_r2scan, n_pbe = 178_070, 183_027
@@ -59,14 +56,12 @@
5956
fig.show()
6057
# pmv.save_fig(fig, "energy-hist.pdf")
6158

62-
# @janosh 2024-05-15: initially surprised by the difference in r2scan/pbe energy distros
63-
# how could energy differences between two similar chemistries always be similar across
64-
# r2SCAN and PBE if the distribution for r2SCAN is so much wider
65-
66-
67-
# %% seems fine. parity plot reveals this nice collection of bands which looks like
68-
# within each chemical system, you indeed get consistent energy differences. just across
69-
# different systems, the zero-level energies differ wildly
59+
# @janosh 2024-05-15: initially surprised by the difference in r2SCAN and PBE energy
60+
# distributions. how could energy differences between two similar chemistries always be
61+
# similar across r2SCAN and PBE if the distribution for r2SCAN is much wider?
62+
# Update: Seems fine actually. Parity plot reveals this nice collection of bands which
63+
# looks like within each chemical system, you indeed get consistent energy differences.
64+
# just across different systems, the zero-level energies differ wildly
7065
fig = go.Figure()
7166

7267
fig.add_scatter(
@@ -144,7 +139,7 @@
144139
df_per_elem[pbe_col] = (df_pbe_frac_comp * df_pbe[col_name].to_numpy()[:, None]).mean()
145140

146141

147-
# %% cohesive energies should (and do) look nearly identical between r2scan and pbe
142+
# %% cohesive energies should (and do) look nearly identical between r2SCAN and PBE
148143
per_elem_cohesive_energy = {
149144
key: list(dct.values()) for key, dct in df_per_elem.to_dict(orient="index").items()
150145
}
@@ -156,7 +151,7 @@
156151
fig.show()
157152

158153

159-
# %% which elements have a higher share of missing r2scan data
154+
# %% which elements have a higher share of missing r2SCAN data
160155
fig = pmv.ptable_heatmap_plotly(
161156
(pbe_elem_counts - r2scan_elem_counts) / pbe_elem_counts,
162157
colorbar=dict(
@@ -208,7 +203,7 @@
208203
# pmv.save_fig(fig, "r2scan-spacegroup-hist.pdf")
209204

210205

211-
# %% most calcs missing r2SCAN results have 4 sites, almost all 2 or 3-site r2scan calcs
206+
# %% most calcs missing r2SCAN results have 4 sites, almost all 2 or 3-site r2SCAN calcs
212207
# completed
213208
fig = go.Figure()
214209

pymatviz/cluster/composition/plot.py

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def _generate_colorbar_ticks(
4545
) -> tuple[list[float] | None, list[str] | None]:
4646
"""Generate custom tick values and text for color bars.
4747
48+
This function could become redundant if plotly ever adds native support for
49+
arcsinh or symlog colorbar scales. Tracked in https://github.com/plotly/plotly.js/issues/221.
50+
4851
Args:
4952
color_scale: The color scale type ("linear", "log", "arcsinh") or a dictionary
5053
with custom scale configuration.

pymatviz/enums.py

-21
Original file line numberDiff line numberDiff line change
@@ -901,17 +901,6 @@ class Task(LabelEnum):
901901
thermal_transport = "thermal_transport", "Thermal Transport"
902902

903903

904-
@unique
905-
class Model(LabelEnum):
906-
"""Model names."""
907-
908-
# key, label, color
909-
m3gnet_ms = "m3gnet", "M3GNet-MS", "blue"
910-
chgnet_030 = "chgnet-v0.3.0", "CHGNet v0.3.0", "orange"
911-
mace_mp = "mace-mp-0-medium", "MACE-MP", "green"
912-
pbe = "pbe", "PBE", "gray"
913-
914-
915904
@unique
916905
class ElemCountMode(LabelEnum):
917906
"""Mode of counting elements in a chemical formula."""
@@ -939,16 +928,6 @@ class ElemCountMode(LabelEnum):
939928
)
940929

941930

942-
@unique
943-
class ElemColorMode(LabelEnum):
944-
"""Mode of coloring elements in structure visualizations or periodic table
945-
plots.
946-
"""
947-
948-
# key, label, color
949-
element_types = "element-types", "Element Types", "blue"
950-
951-
952931
@unique
953932
class ElemColorScheme(LabelEnum):
954933
"""Names of element color palettes.

tests/keys-schema.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ propertyNames:
2424
additionalProperties:
2525
type: object
2626
propertyNames:
27-
pattern: "^[a-z0-9_]+$" # Allow numbers in key names for r2scan etc.
27+
pattern: "^[a-z0-9_]+$" # Allow numbers in key names for r2SCAN etc.
2828
additionalProperties:
2929
"$ref": "#/definitions/key_entry"
3030
minProperties: 1 # Each category must have at least one key

tests/test_enums.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
from pymatviz.enums import Key, LabelEnum, Model, StrEnum
8+
from pymatviz.enums import Key, LabelEnum, StrEnum
99

1010

1111
# ruff: noqa: RUF001
@@ -29,12 +29,6 @@ def test_str_enum() -> None:
2929
assert StrEnum.__name__ == "StrEnum"
3030

3131

32-
def test_model_enum() -> None:
33-
assert Model.mace_mp == "mace-mp-0-medium"
34-
assert Model.mace_mp.label == "MACE-MP"
35-
assert Model.mace_mp.description == "green"
36-
37-
3832
def test_key_enum() -> None:
3933
# access any attribute to trigger @unique decorator check
4034
assert Key.energy_per_atom == "energy_per_atom"

tests/test_io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_save_fig(
4646

4747
if any(var in os.environ for var in env_disable):
4848
# if CI env var is set, we should not save the figure
49-
assert not os.path.exists(path)
49+
assert not os.path.isfile(path)
5050
return
5151

5252
assert os.path.isfile(path)

0 commit comments

Comments
 (0)