Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data = [yaml.load(f, Loader=yaml.SafeLoader) for f in args.infiles]
# actually plot it
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
for d in data:
temperature_data = d["temperature"]
if args.delta_t:
temperature_data = []
zip_object = zip(d["temperature"], d["ambient"])
for d["temperature"], d["ambient"] in zip_object:
temperature_data.append(d["temperature"] - d["ambient"])
plt.plot(d["time"], temperature_data, label=d["name"])
dufte.legend()
if args.delta_t:
plot_yaxis_label = "Δ temperature [°C over ambient]"
else:
plot_yaxis_label = "temperature [°C]"
plt.xlabel("time [s]")
plt.ylabel(plot_yaxis_label)
if args.temp_lims:
ax1.set_ylim(*args.temp_lims)
# Only plot frequencies when using a single input file
if len(data) == 1 and args.frequency:
ax2 = plt.twinx()
ax2.set_ylabel("core frequency (MHz)")
if args.freq_lims:
def plot(argv=None):
import dufte
import matplotlib.pyplot as plt
plt.style.use(dufte.style)
parser = _get_parser_plot()
args = parser.parse_args(argv)
data = [yaml.load(f, Loader=yaml.SafeLoader) for f in args.infiles]
# actually plot it
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
for d in data:
temperature_data = d["temperature"]
if args.delta_t:
temperature_data = []
zip_object = zip(d["temperature"], d["ambient"])
for d["temperature"], d["ambient"] in zip_object:
temperature_data.append(d["temperature"] - d["ambient"])