Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Paniagua <[email protected]>
  • Loading branch information
kmilo9999 and cpaniaguam authored Mar 13, 2024
1 parent fa6adcc commit d37e93c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/icesat2waves/local_modules/m_general_ph3.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(
viewscale = view_scale if view_scale is not None else 0.5
fig_scale = fig_scale if fig_scale is not None else 1

self.label_letters = iter([i + ") " for i in list(string.ascii_lowercase)])
self.label_letters = iter(f"{i}) " for i in string.ascii_lowercase)

if container:
self.fig = plt.figure(
Expand Down Expand Up @@ -187,14 +187,14 @@ def linear(self, Color="b", fig_scale=2, fax="f"):
self.F = FigureAxisXY(fig_scale=fig_scale)
if fax == "f":
xax = self.fs
xlabelstr = "f (" + self.sample_unit + ")"
xlabelstr = f"f ({self.sample_unit})"
elif fax == "w":
xax = 2 * np.pi * self.fs
xlabelstr = "w (rad " + self.sample_unit + ")"
xlabelstr = f"w (rad {self.sample_unit})"

self.line = plt.plot(xax[1:], (self.Xdata[1:]), Color=Color)

plt.ylabel(("|X|^2/f (" + self.data_unit + "^2/" + self.sample_unit + ")"))
plt.ylabel(f"|X|^2/f ({self.data_unit}^2/{self.sample_unit})")
plt.xlabel(xlabelstr)
plt.xlim(xax[1], xax[-1])

Expand All @@ -213,7 +213,7 @@ def power_linear(self, Color="b", fax="f"):

self.line = plt.plot(xax[1:], 10 * np.log10(self.Xdata[1:]), Color=Color)

plt.ylabel(("Power db(" + self.data_unit + "^2/" + self.sample_unit + ")"))
plt.ylabel(f"Power db({self.data_unit}^2/{self.sample_unit})")
plt.xlabel(xlabelstr)
plt.xlim(xax[1], xax[-1])
self.F.make_clear()
Expand Down Expand Up @@ -241,10 +241,10 @@ def power(self, Color="b", fig_scale=2, fax="f"):
self.F = FigureAxisXY(fig_scale=fig_scale)
if fax == "f":
xax = self.fs
xlabelstr = "f (" + self.sample_unit + ")"
xlabelstr = f"f ({self.sample_unit})"
elif fax == "w":
xax = 2 * np.pi * self.fs
xlabelstr = "w (rad " + self.sample_unit + ")"
xlabelstr = f"w (rad {self.sample_unit})"

self.line = plt.semilogx(xax[1:], 10 * np.log10(self.Xdata[1:]), Color=Color)

Expand Down Expand Up @@ -285,8 +285,8 @@ def loglog(self):

plt.loglog(self.fs[1:], (self.Xdata[1:]))

plt.ylabel(("|X|^2/f (" + self.data_unit + "^2/" + self.sample_unit + ")"))
plt.xlabel(("f (" + self.sample_unit + ")"))
plt.ylabel(f"|X|^2/f ({self.data_unit}^2/{self.sample_unit})")
plt.xlabel(f"f ({self.sample_unit})")
plt.xlim(self.fs[1], self.fs[-1])

self.F.make_clear()
Expand All @@ -300,12 +300,12 @@ def linear(self):
tt = self.time.astype(DT.datetime)
self.cs = plt.contourf(tt[:-2], self.fs[:], dd, self.clevs, cmap=self.cmap)
print(self.clevs)
plt.ylabel(("Power db(" + self.data_unit + "^2/" + self.sample_unit + ")"))
plt.xlabel(("f (" + self.sample_unit + ")"))
plt.ylabel(f"Power db({self.data_unit}^2/{self.sample_unit})")
plt.xlabel(f"f ({self.sample_unit})")
self.cbar = plt.colorbar(self.cs, pad=0.01)
self.cbar.ax.aspect = 100
self.cbar.outline.set_linewidth(0)
self.cbar.set_label("(" + self.data_unit + ")")
self.cbar.set_label(f"({self.data_unit})")

ax = plt.gca()
ax.set_ylim(self.ylim[0], self.ylim[1])
Expand Down Expand Up @@ -349,11 +349,11 @@ def power(self, anomalie=False):
self.x = np.arange(0, tt[:-1].size)
print(self.clevs)
plt.xlabel("Time")
plt.ylabel(("f (" + self.sample_unit + ")"))
plt.ylabel(f"f ({self.sample_unit})")
self.cbar = plt.colorbar(self.cs, pad=0.01)
self.cbar.ax.aspect = 100
self.cbar.outline.set_linewidth(0)
self.cbar.set_label("Power db(" + self.data_unit + "^2/f ")
self.cbar.set_label(f"Power db({self.data_unit}^2/f )")

ax = plt.gca()
# Set y-lim
Expand Down Expand Up @@ -531,7 +531,7 @@ def power_imshow(
ax.xaxis.set_major_formatter(dfmt)
ax.xaxis.set_minor_locator(Day)
else:
plt.xlabel("Time (" + self.time_unit + ")")
plt.xlabel(f"Time ({self.time_unit})")
ax.set_ylim(self.ylim[0], self.ylim[1])
ax.xaxis.set_major_locator(ticker.MultipleLocator(5))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(1))
Expand Down

0 comments on commit d37e93c

Please sign in to comment.