Skip to content

Commit e9c4371

Browse files
committed
Cleanup some bad code.
1 parent 499f54d commit e9c4371

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ exclude_also = [
301301
ignore_missing_imports = true
302302
namespace_packages = true
303303
no_implicit_optional = false
304-
disable_error_code = ["annotation-unchecked", "override", "operator", "attr-defined", "union-attr", "misc", "call-overload", "call-arg", "var-annotated"] #, "operator", "arg-type", "index", "call-arg", "return-value", "assignment", "attr-defined"]
304+
disable_error_code = ["annotation-unchecked", "override", "operator", "attr-defined", "union-attr", "misc", "call-overload"]
305305
exclude = ['src/pymatgen/analysis', 'src/pymatgen/phonon', 'src/pymatgen/io/lobster', 'src/pymatgen/io/cp2k', 'src/pymatgen/io/lammps']
306306
plugins = ["numpy.typing.mypy_plugin"]
307307

src/pymatgen/electronic_structure/plotter.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,8 +2941,8 @@ def plot_seebeck_eff_mass_mu(self, temps=(300,), output="average", Lambda=0.5):
29412941

29422942
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
29432943
ax.set_ylabel("Seebeck effective mass", fontsize=30)
2944-
ax.set_xticks(fontsize=25)
2945-
ax.set_yticks(fontsize=25)
2944+
ax.set_xticks(ax.get_xticks(), fontsize=25)
2945+
ax.set_xticks(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")],
@@ -3000,8 +3000,8 @@ def plot_complexity_factor_mu(self, temps=(300,), output="average", Lambda=0.5):
30003000

30013001
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
30023002
ax.set_ylabel("Complexity Factor", fontsize=30)
3003-
ax.set_xticks(fontsize=25)
3004-
ax.set_yticks(fontsize=25)
3003+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3004+
ax.set_xticks(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")],
@@ -3042,8 +3042,8 @@ def plot_seebeck_mu(
30423042
ax.set_xlim(xlim[0], xlim[1])
30433043
ax.set_ylabel("Seebeck \n coefficient ($\\mu$V/K)", fontsize=30.0)
30443044
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
3045-
ax.set_xticks(fontsize=25)
3046-
ax.set_yticks(fontsize=25)
3045+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3046+
ax.set_yticks(ax.get_yticks(), fontsize=25)
30473047
plt.tight_layout()
30483048
return ax
30493049

@@ -3080,8 +3080,8 @@ def plot_conductivity_mu(
30803080
ax.set_ylim((1e13 * relaxation_time, 1e20 * relaxation_time))
30813081
ax.set_ylabel("conductivity,\n $\\Sigma$ (1/($\\Omega$ m))", fontsize=30.0)
30823082
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30.0)
3083-
ax.set_xticks(fontsize=25)
3084-
ax.set_yticks(fontsize=25)
3083+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3084+
ax.set_yticks(ax.get_yticks(), fontsize=25)
30853085
plt.tight_layout()
30863086
return ax
30873087

@@ -3119,8 +3119,8 @@ def plot_power_factor_mu(
31193119
ax.set_xlim(xlim)
31203120
ax.set_ylabel("Power factor, ($\\mu$W/(mK$^2$))", fontsize=30.0)
31213121
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30.0)
3122-
ax.set_xticks(fontsize=25)
3123-
ax.set_yticks(fontsize=25)
3122+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3123+
ax.set_xticks(ax.get_yticks(), fontsize=25)
31243124
plt.tight_layout()
31253125
return ax
31263126

@@ -3156,8 +3156,8 @@ def plot_zt_mu(
31563156
ax.set_xlim(xlim)
31573157
ax.set_ylabel("ZT", fontsize=30.0)
31583158
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30.0)
3159-
ax.set_xticks(fontsize=25)
3160-
ax.set_yticks(fontsize=25)
3159+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3160+
ax.set_xticks(ax.get_yticks(), fontsize=25)
31613161
plt.tight_layout()
31623162
return ax
31633163

@@ -3203,8 +3203,8 @@ def plot_seebeck_temp(self, doping="all", output: Literal["average", "eigs"] = "
32033203

32043204
ax.legend(loc="best", fontsize=15)
32053205
ax.grid()
3206-
ax.set_xticks(fontsize=25)
3207-
ax.set_yticks(fontsize=25)
3206+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3207+
ax.set_xticks(ax.get_yticks(), fontsize=25)
32083208

32093209
plt.tight_layout()
32103210

@@ -3260,8 +3260,8 @@ def plot_conductivity_temp(
32603260

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

32673267
plt.tight_layout()
@@ -3318,8 +3318,8 @@ def plot_power_factor_temp(
33183318

33193319
ax.legend(loc="best", fontsize=15)
33203320
ax.grid()
3321-
ax.set_xticks(fontsize=25)
3322-
ax.set_yticks(fontsize=25)
3321+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3322+
ax.set_xticks(ax.get_yticks(), fontsize=25)
33233323
ax.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
33243324

33253325
plt.tight_layout()
@@ -3377,8 +3377,8 @@ def plot_zt_temp(
33773377

33783378
ax.legend(loc="best", fontsize=15)
33793379
ax.grid()
3380-
ax.set_xticks(fontsize=25)
3381-
ax.set_yticks(fontsize=25)
3380+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3381+
ax.set_xticks(ax.get_yticks(), fontsize=25)
33823382

33833383
plt.tight_layout()
33843384
return ax
@@ -3473,8 +3473,8 @@ def plot_seebeck_dop(self, temps="all", output: Literal["average", "eigs"] = "av
34733473
p = "lower right" if idx == 0 else "best"
34743474
ax.legend(loc=p, fontsize=15)
34753475
ax.grid()
3476-
ax.set_xticks(fontsize=25)
3477-
ax.set_yticks(fontsize=25)
3476+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3477+
ax.set_xticks(ax.get_yticks(), fontsize=25)
34783478

34793479
plt.tight_layout()
34803480

@@ -3531,8 +3531,8 @@ def plot_conductivity_dop(
35313531
ax.ticklabel_format(style="sci", axis="y", scilimits=(0, 0))
35323532
ax.legend(fontsize=15)
35333533
ax.grid()
3534-
ax.set_xticks(fontsize=25)
3535-
ax.set_yticks(fontsize=25)
3534+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3535+
ax.set_xticks(ax.get_yticks(), fontsize=25)
35363536

35373537
plt.tight_layout()
35383538

@@ -3589,8 +3589,8 @@ def plot_power_factor_dop(
35893589
p = "best" # 'lower right' if i == 0 else ''
35903590
ax.legend(loc=p, fontsize=15)
35913591
ax.grid()
3592-
ax.set_xticks(fontsize=25)
3593-
ax.set_yticks(fontsize=25)
3592+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3593+
ax.set_xticks(ax.get_yticks(), fontsize=25)
35943594

35953595
plt.tight_layout()
35963596

@@ -3648,8 +3648,8 @@ def plot_zt_dop(
36483648
p = "lower right" if idx == 0 else "best"
36493649
ax.legend(loc=p, fontsize=15)
36503650
ax.grid()
3651-
ax.set_xticks(fontsize=25)
3652-
ax.set_yticks(fontsize=25)
3651+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3652+
ax.set_xticks(ax.get_yticks(), fontsize=25)
36533653

36543654
plt.tight_layout()
36553655

@@ -3702,8 +3702,8 @@ def plot_eff_mass_dop(self, temps="all", output: Literal["average", "eigs"] = "a
37023702
p = "lower right" if idx == 0 else "best"
37033703
ax.legend(loc=p, fontsize=15)
37043704
ax.grid()
3705-
ax.set_xticks(fontsize=25)
3706-
ax.set_yticks(fontsize=25)
3705+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3706+
ax.set_xticks(ax.get_yticks(), fontsize=25)
37073707

37083708
plt.tight_layout()
37093709

@@ -3740,8 +3740,8 @@ def plot_carriers(self, temp=300):
37403740
ax.set_ylim(1e14, 1e22)
37413741
ax.set_ylabel("carrier concentration (cm-3)", fontsize=30.0)
37423742
ax.set_xlabel("E-E$_f$ (eV)", fontsize=30)
3743-
ax.set_xticks(fontsize=25)
3744-
ax.set_yticks(fontsize=25)
3743+
ax.set_xticks(ax.get_xticks(), fontsize=25)
3744+
ax.set_xticks(ax.get_yticks(), fontsize=25)
37453745
plt.tight_layout()
37463746
return ax
37473747

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

src/pymatgen/io/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ def __init__(
8585
# convert data to numpy arrays in case they were jsanitized as lists
8686
self.data = {k: np.array(v) for k, v in data.items()}
8787
self.dim = self.data["total"].shape
88-
self.data_aug = data_aug or {}
88+
self.data_aug = data_aug
8989
self.ngridpts = self.dim[0] * self.dim[1] * self.dim[2]
9090
# lazy init the spin data since this is not always needed.
9191
self._spin_data: dict[Spin, float] = {}
92-
self._distance_matrix = distance_matrix or {}
92+
self._distance_matrix = distance_matrix
9393
self.xpoints = np.linspace(0.0, 1.0, num=self.dim[0])
9494
self.ypoints = np.linspace(0.0, 1.0, num=self.dim[1])
9595
self.zpoints = np.linspace(0.0, 1.0, num=self.dim[2])
@@ -168,7 +168,7 @@ def linear_add(self, other, scale_factor=1.0) -> VolumetricData:
168168

169169
new = deepcopy(self)
170170
new.data = data
171-
new.data_aug = {}
171+
new.data_aug = None
172172
return new
173173

174174
def scale(self, factor):

src/pymatgen/io/vasp/outputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: dict = {}
3947+
self._distance_matrix = None
39483948

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

0 commit comments

Comments
 (0)