Skip to content

Commit

Permalink
NEED CONFIRM: fix number of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Aug 9, 2024
1 parent e2ff5fa commit eb7978d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/pymatgen/electronic_structure/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3348,11 +3348,11 @@ def plot_eff_mass_temp(self, doping="all", output: Literal["average", "eigs"] =
else:
eff_mass = self._bz.get_average_eff_mass(output="eigs")

ax_main = pretty_plot(22, 14)
ax = pretty_plot(22, 14)
temperatures = sorted(eff_mass["n"])
doping = self._bz.doping["n"] if doping == "all" else doping
for idx, dop_type in enumerate("np"):
ax = plt.subplot(121 + idx)
plt.subplot(121 + idx)
for dop in doping:
dop_idx = self._bz.doping[dop_type].index(dop)
em_temp = [eff_mass[dop_type][temp][dop_idx] for temp in temperatures]
Expand All @@ -3371,7 +3371,7 @@ def plot_eff_mass_temp(self, doping="all", output: Literal["average", "eigs"] =
ax.tick_params(labelsize=25)

plt.tight_layout()
return ax_main
return ax

def plot_seebeck_dop(self, temps="all", output: Literal["average", "eigs"] = "average"):
"""Plot the Seebeck in function of doping levels for different temperatures.
Expand Down
20 changes: 10 additions & 10 deletions tests/electronic_structure/test_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def test_plot_complexity_factor_mu(self):

def test_plot_conductivity_dop(self):
ax = self.plotter.plot_conductivity_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 1000000000000000.0, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 0.3801957596666667, "wrong 1 data in line 0"
plt.close()
Expand All @@ -331,7 +331,7 @@ def test_plot_conductivity_mu(self):

def test_plot_conductivity_temp(self):
ax = self.plotter.plot_conductivity_temp()
assert len(ax.get_lines()) == 6, "wrong number of lines"
assert len(ax.get_lines()) == 12, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 100, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 0.3801957596666667, "wrong 1 data in line 0"
plt.close()
Expand All @@ -345,14 +345,14 @@ def test_plot_dos(self):

def test_plot_eff_mass_dop(self):
ax = self.plotter.plot_eff_mass_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 1000000000000000.0, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 1.4231240011719886, "wrong 1 data in line 0"
plt.close()

def test_plot_eff_mass_temp(self):
ax = self.plotter.plot_eff_mass_temp()
assert len(ax.get_lines()) == 6, "wrong number of lines"
assert len(ax.get_lines()) == 12, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 100, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 1.4231240011719886, "wrong 1 data in line 0"
plt.close()
Expand All @@ -366,7 +366,7 @@ def test_plot_hall_carriers(self):

def test_plot_power_factor_dop(self):
ax = self.plotter.plot_power_factor_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 1000000000000000.0, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 0.40606868935796925, "wrong 1 data in line 0"
plt.close()
Expand All @@ -380,14 +380,14 @@ def test_plot_power_factor_mu(self):

def test_plot_power_factor_temp(self):
ax = self.plotter.plot_power_factor_temp()
assert len(ax.get_lines()) == 6, "wrong number of lines"
assert len(ax.get_lines()) == 12, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 100, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 0.40606868935796925, "wrong 1 data in line 0"
plt.close()

def test_plot_seebeck_dop(self):
ax = self.plotter.plot_seebeck_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 1000000000000000.0, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 1050.8197666666667, "wrong 1 data in line 0"
plt.close()
Expand All @@ -408,14 +408,14 @@ def test_plot_seebeck_mu(self):

def test_plot_seebeck_temp(self):
ax = self.plotter.plot_seebeck_temp()
assert len(ax.get_lines()) == 6, "wrong number of lines"
assert len(ax.get_lines()) == 12, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 100, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 1050.8197666666667, "wrong 1 data in line 0"
plt.close()

def test_plot_zt_dop(self):
ax = self.plotter.plot_zt_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 1000000000000000.0, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 4.060682863129955e-05, "wrong 1 data in line 0"
plt.close()
Expand All @@ -429,7 +429,7 @@ def test_plot_zt_mu(self):

def test_plot_zt_temp(self):
ax = self.plotter.plot_zt_temp()
assert len(ax.get_lines()) == 6, "wrong number of lines"
assert len(ax.get_lines()) == 12, f"wrong number of lines, got {len(ax.get_lines())}"
assert ax.get_lines()[0].get_data()[0][0] == 100, "wrong 0 data in line 0"
assert ax.get_lines()[0].get_data()[1][0] == 4.060682863129955e-05, "wrong 1 data in line 0"
plt.close()
Expand Down

0 comments on commit eb7978d

Please sign in to comment.