Updated with ruff formatter

这个提交包含在:
Craig Warren
2025-02-04 20:38:27 +00:00
父节点 e2c5a23f28
当前提交 548a0a550c
共有 70 个文件被更改,包括 3601 次插入982 次删除

查看文件

@@ -81,7 +81,9 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False, save=False):
# Check for single output component when doing a FFT
if fft and not len(outputs) == 1:
logger.exception("A single output must be specified when using " + "the -fft option")
logger.exception(
"A single output must be specified when using " + "the -fft option"
)
raise ValueError
# New plot for each receiver
@@ -120,7 +122,11 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False, save=False):
# Set plotting range to -60dB from maximum power or 4 times
# frequency at maximum power
try:
pltrange = np.where(power[freqmaxpower:] < -60)[0][0] + freqmaxpower + 1
pltrange = (
np.where(power[freqmaxpower:] < -60)[0][0]
+ freqmaxpower
+ 1
)
except:
pltrange = freqmaxpower * 4
@@ -160,20 +166,27 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False, save=False):
plt.setp(line2, color="g")
plt.setp(ax1, ylabel=outputtext + " field strength [A/m]")
plt.setp(stemlines, "color", "g")
plt.setp(markerline, "markerfacecolor", "g", "markeredgecolor", "g")
plt.setp(
markerline, "markerfacecolor", "g", "markeredgecolor", "g"
)
elif "I" in outputs[0]:
plt.setp(line1, color="b")
plt.setp(line2, color="b")
plt.setp(ax1, ylabel=outputtext + " current [A]")
plt.setp(stemlines, "color", "b")
plt.setp(markerline, "markerfacecolor", "b", "markeredgecolor", "b")
plt.setp(
markerline, "markerfacecolor", "b", "markeredgecolor", "b"
)
plt.show()
# Plotting if no FFT required
else:
fig, ax = plt.subplots(
subplot_kw=dict(xlabel="Time [s]", ylabel=outputtext + " field strength [V/m]"),
subplot_kw=dict(
xlabel="Time [s]",
ylabel=outputtext + " field strength [V/m]",
),
num=rxpath + " - " + f[rxpath].attrs["Name"],
figsize=(20, 10),
facecolor="w",
@@ -279,7 +292,13 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False, save=False):
if save:
# Save a PDF of the figure
fig.savefig(filename[:-3] + ".pdf", dpi=None, format="pdf", bbox_inches="tight", pad_inches=0.1)
fig.savefig(
filename[:-3] + ".pdf",
dpi=None,
format="pdf",
bbox_inches="tight",
pad_inches=0.1,
)
# Save a PNG of the figure
# fig.savefig(filename[:-3] + '.png', dpi=150, format='png',
# bbox_inches='tight', pad_inches=0.1)
@@ -322,9 +341,17 @@ if __name__ == "__main__":
],
nargs="+",
)
parser.add_argument("-fft", action="store_true", default=False, help="plot FFT (single output must be specified)")
parser.add_argument(
"-save", action="store_true", default=False, help="save plot directly to file, i.e. do not display"
"-fft",
action="store_true",
default=False,
help="plot FFT (single output must be specified)",
)
parser.add_argument(
"-save",
action="store_true",
default=False,
help="save plot directly to file, i.e. do not display",
)
args = parser.parse_args()