Skip to content

Commit bbcd3d7

Browse files
committed
Fix y ticks.
1 parent d3df2a9 commit bbcd3d7

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ ignore_missing_imports = true
302302
namespace_packages = true
303303
no_implicit_optional = false
304304
disable_error_code = ["annotation-unchecked", "override", "operator", "attr-defined", "union-attr", "misc", "call-overload"]
305-
exclude = ['src/pymatgen/analysis', 'src/pymatgen/phonon', 'src/pymatgen/io/cp2k', 'src/pymatgen/io/lammps']
305+
exclude = ['src/pymatgen/analysis', 'src/pymatgen/io/cp2k', 'src/pymatgen/io/lammps']
306306
plugins = ["numpy.typing.mypy_plugin"]
307307

308308
[[tool.mypy.overrides]]

src/pymatgen/electronic_structure/plotter.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,7 +2942,7 @@ def plot_seebeck_eff_mass_mu(self, temps=(300,), output="average", Lambda=0.5):
29422942
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
29432943
ax.set_ylabel("Seebeck effective mass", fontsize=30)
29442944
ax.set_xticks(ax.get_xticks(), fontsize=25)
2945-
ax.set_xticks(ax.get_yticks(), fontsize=25)
2945+
ax.set_yticks(ax.get_yticks(), fontsize=25)
29462946
if output == "tensor":
29472947
ax.legend(
29482948
[f"{dim}_{T}K" for T in temps for dim in ("x", "y", "z")],
@@ -3001,7 +3001,7 @@ def plot_complexity_factor_mu(self, temps=(300,), output="average", Lambda=0.5):
30013001
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
30023002
ax.set_ylabel("Complexity Factor", fontsize=30)
30033003
ax.set_xticks(ax.get_xticks(), fontsize=25)
3004-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3004+
ax.set_yticks(ax.get_yticks(), fontsize=25)
30053005
if output == "tensor":
30063006
ax.legend(
30073007
[f"{dim}_{T}K" for T in temps for dim in ("x", "y", "z")],
@@ -3120,7 +3120,7 @@ def plot_power_factor_mu(
31203120
ax.set_ylabel("Power factor, ($\\mu$W/(mK$^2$))", fontsize=30.0)
31213121
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30.0)
31223122
ax.set_xticks(ax.get_xticks(), fontsize=25)
3123-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3123+
ax.set_yticks(ax.get_yticks(), fontsize=25)
31243124
plt.tight_layout()
31253125
return ax
31263126

@@ -3157,7 +3157,7 @@ def plot_zt_mu(
31573157
ax.set_ylabel("ZT", fontsize=30.0)
31583158
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30.0)
31593159
ax.set_xticks(ax.get_xticks(), fontsize=25)
3160-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3160+
ax.set_yticks(ax.get_yticks(), fontsize=25)
31613161
plt.tight_layout()
31623162
return ax
31633163

@@ -3204,7 +3204,7 @@ def plot_seebeck_temp(self, doping="all", output: Literal["average", "eigs"] = "
32043204
ax.legend(loc="best", fontsize=15)
32053205
ax.grid()
32063206
ax.set_xticks(ax.get_xticks(), fontsize=25)
3207-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3207+
ax.set_yticks(ax.get_yticks(), fontsize=25)
32083208

32093209
plt.tight_layout()
32103210

@@ -3261,7 +3261,7 @@ def plot_conductivity_temp(
32613261
ax.legend(loc="best", fontsize=15)
32623262
ax.grid()
32633263
ax.set_xticks(ax.get_xticks(), fontsize=25)
3264-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3264+
ax.set_yticks(ax.get_yticks(), fontsize=25)
32653265
ax.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
32663266

32673267
plt.tight_layout()
@@ -3319,7 +3319,7 @@ def plot_power_factor_temp(
33193319
ax.legend(loc="best", fontsize=15)
33203320
ax.grid()
33213321
ax.set_xticks(ax.get_xticks(), fontsize=25)
3322-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3322+
ax.set_yticks(ax.get_yticks(), fontsize=25)
33233323
ax.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
33243324

33253325
plt.tight_layout()
@@ -3378,7 +3378,7 @@ def plot_zt_temp(
33783378
ax.legend(loc="best", fontsize=15)
33793379
ax.grid()
33803380
ax.set_xticks(ax.get_xticks(), fontsize=25)
3381-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3381+
ax.set_yticks(ax.get_yticks(), fontsize=25)
33823382

33833383
plt.tight_layout()
33843384
return ax
@@ -3474,7 +3474,7 @@ def plot_seebeck_dop(self, temps="all", output: Literal["average", "eigs"] = "av
34743474
ax.legend(loc=p, fontsize=15)
34753475
ax.grid()
34763476
ax.set_xticks(ax.get_xticks(), fontsize=25)
3477-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3477+
ax.set_yticks(ax.get_yticks(), fontsize=25)
34783478

34793479
plt.tight_layout()
34803480

@@ -3532,7 +3532,7 @@ def plot_conductivity_dop(
35323532
ax.legend(fontsize=15)
35333533
ax.grid()
35343534
ax.set_xticks(ax.get_xticks(), fontsize=25)
3535-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3535+
ax.set_yticks(ax.get_yticks(), fontsize=25)
35363536

35373537
plt.tight_layout()
35383538

@@ -3590,7 +3590,7 @@ def plot_power_factor_dop(
35903590
ax.legend(loc=p, fontsize=15)
35913591
ax.grid()
35923592
ax.set_xticks(ax.get_xticks(), fontsize=25)
3593-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3593+
ax.set_yticks(ax.get_yticks(), fontsize=25)
35943594

35953595
plt.tight_layout()
35963596

@@ -3649,7 +3649,7 @@ def plot_zt_dop(
36493649
ax.legend(loc=p, fontsize=15)
36503650
ax.grid()
36513651
ax.set_xticks(ax.get_xticks(), fontsize=25)
3652-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3652+
ax.set_yticks(ax.get_yticks(), fontsize=25)
36533653

36543654
plt.tight_layout()
36553655

@@ -3703,7 +3703,7 @@ def plot_eff_mass_dop(self, temps="all", output: Literal["average", "eigs"] = "a
37033703
ax.legend(loc=p, fontsize=15)
37043704
ax.grid()
37053705
ax.set_xticks(ax.get_xticks(), fontsize=25)
3706-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3706+
ax.set_yticks(ax.get_yticks(), fontsize=25)
37073707

37083708
plt.tight_layout()
37093709

@@ -3741,7 +3741,7 @@ def plot_carriers(self, temp=300):
37413741
ax.set_ylabel("carrier concentration (cm-3)", fontsize=30.0)
37423742
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
37433743
ax.set_xticks(ax.get_xticks(), fontsize=25)
3744-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3744+
ax.set_yticks(ax.get_yticks(), fontsize=25)
37453745
plt.tight_layout()
37463746
return ax
37473747

@@ -3764,7 +3764,7 @@ def plot_hall_carriers(self, temp=300):
37643764
ax.set_ylabel("Hall carrier concentration (cm-3)", fontsize=30.0)
37653765
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
37663766
ax.set_xticks(ax.get_xticks(), fontsize=25)
3767-
ax.set_xticks(ax.get_yticks(), fontsize=25)
3767+
ax.set_yticks(ax.get_yticks(), fontsize=25)
37683768
plt.tight_layout()
37693769
return ax
37703770

src/pymatgen/io/vasp/outputs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3855,7 +3855,7 @@ def write_spin(data_type: str) -> None:
38553855
if count % 5 != 0:
38563856
file.write(" " + "".join(lines) + " \n") # type:ignore[arg-type]
38573857

3858-
data = self.data_aug.get(data_type, []) if self.data_aug is not None else []
3858+
data: list | NDArray = self.data_aug.get(data_type, []) if self.data_aug is not None else []
38593859
if isinstance(data, Iterable):
38603860
file.write("".join(data)) # type:ignore[arg-type]
38613861

@@ -3923,7 +3923,7 @@ def __init__(
39233923
self,
39243924
poscar: Poscar | Structure,
39253925
data: dict[str, NDArray],
3926-
data_aug: NDArray | None = None,
3926+
data_aug: dict[str, NDArray] | None = None,
39273927
) -> None:
39283928
"""
39293929
Args:
@@ -3944,7 +3944,7 @@ def __init__(
39443944
raise TypeError("Unsupported POSCAR type.")
39453945

39463946
super().__init__(struct, data, data_aug=data_aug)
3947-
self._distance_matrix = None
3947+
self._distance_matrix = {}
39483948

39493949
@classmethod
39503950
def from_file(cls, filename: str) -> Self:

src/pymatgen/phonon/thermal_displacements.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from os import PathLike
2525
from typing import Literal
2626

27-
from numpy.typing import ArrayLike
27+
from numpy.typing import ArrayLike, NDArray
2828
from typing_extensions import Self
2929

3030
__author__ = "J. George"
@@ -69,11 +69,11 @@ def __init__(
6969
U11, U22, U33, U23, U13, U12 (xx, yy, zz, yz, xz, xy)
7070
convention similar to "thermal_displacement_matrices.yaml" in phonopy.
7171
"""
72-
self.thermal_displacement_matrix_cart = np.array(thermal_displacement_matrix_cart)
72+
self.thermal_displacement_matrix_cart = np.asarray(thermal_displacement_matrix_cart)
7373
self.structure = structure
7474
self.temperature = temperature
7575
if thermal_displacement_matrix_cif is not None:
76-
self.thermal_displacement_matrix_cif = np.array(thermal_displacement_matrix_cif)
76+
self.thermal_displacement_matrix_cif: None | NDArray = np.asarray(thermal_displacement_matrix_cif)
7777
else:
7878
self.thermal_displacement_matrix_cif = None
7979

@@ -99,8 +99,9 @@ def get_full_matrix(
9999
Returns:
100100
3d numpy array including thermal displacements, first dimensions are the atoms
101101
"""
102-
matrix_form = np.zeros((len(thermal_displacement), 3, 3))
103-
for idx, mat in enumerate(thermal_displacement):
102+
td = np.array(thermal_displacement)
103+
matrix_form = np.zeros((len(td), 3, 3))
104+
for idx, mat in enumerate(td):
104105
# xx, yy, zz, yz, xz, xy
105106
matrix_form[idx][0][0] = mat[0]
106107
matrix_form[idx][1][1] = mat[1]
@@ -125,8 +126,9 @@ def get_reduced_matrix(
125126
Returns:
126127
3d numpy array including thermal displacements, first dimensions are the atoms
127128
"""
128-
reduced_matrix = np.zeros((len(thermal_displacement), 6))
129-
for idx, mat in enumerate(thermal_displacement):
129+
td = np.array(thermal_displacement)
130+
reduced_matrix = np.zeros((len(td), 6))
131+
for idx, mat in enumerate(td):
130132
# xx, yy, zz, yz, xz, xy
131133
reduced_matrix[idx][0] = mat[0][0]
132134
reduced_matrix[idx][1] = mat[1][1]

0 commit comments

Comments
 (0)