import matplotlib.pyplot as plt from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from funciones_analisis import * from scipy.fft import fft, fftfreq class Ploteador_VI(FigureCanvas): def __init__(self, t, V, I, Titulo = False, parent=None): fig, self.ax = plt.subplots(figsize=(6,4)) super().__init__(fig) self.setParent(parent) self.x = t self.y1 = V self.y2 = I self.linea_V, self.linea_I = plot_VI(self.ax, self.x, self.y1, self.y2, Titulo=Titulo) def actualizar_plot(self, t, V, I): self.linea_V.set_xdata(t) self.linea_I.set_xdata(t) self.linea_V.set_ydata(V) self.linea_I.set_ydata(I) self.ax.relim() self.ax.autoscale() self.draw() class Ploteador_Termico(FigureCanvas): def __init__(self, t, Temperatura1, Temperatura2, parent=None): fig, self.ax = plt.subplots(figsize=(6,4)) super().__init__(fig) self.setParent(parent) self.x = t self.y1 = Temperatura1 self.y2 = Temperatura2 self.linea_1 = plot_termico(self.ax, self.x, self.y1, tags = "Cobre, ",Titulo='Termico') self.linea_2 = plot_termico(self.ax, self.x, self.y2, tags = "Hierro", reset_plot=False) def actualizar_plot(self, t, Temperatura1, Temperatura2): self.linea_1.set_xdata(t) self.linea_2.set_xdata(t) self.linea_1.set_ydata(Temperatura1) self.linea_2.set_ydata(Temperatura2) self.ax.relim() self.ax.autoscale() self.draw() class Ploteador_fft(FigureCanvas): def __init__(self, t, onda, fs, param, parent=None): fig, self.ax = plt.subplots(figsize=(6,4)) super().__init__(fig) self.setParent(parent) self.linea = plot_fft(self.ax, t, onda, fs, Titulo = f"FFT de {param}") def actualizar_plot(self, t, onda, fs, param): x = fftfreq(len(t), 1/fs)[:len(t)//2] y = 1/len(x) * np.abs(fft(onda)[0:len(t)//2]) self.linea.set_ydata(y) self.linea.set_xdata(x) self.ax.set_title(f"FFT de {param}") self.ax.relim() self.ax.autoscale() self.draw()