def plot(self, precision=1, title=False, saving=False): """ Displays the data from the CSV file as a graph. :param precision: Allows to take only a part of the data in the file. This value MUST BE positive :type precision: int :param title: Know of the plot must have a title or not :type title: bool :return: Create a plot """ # Create the arguments of plotSignals function (see plotsTest.py > plotSignal) x, signals = self.makeSignals(precision)[:-2] x_axis_name = self.getAxisNames()[0] + " [" + self.getAxisUnits( )[0] + "]" y_axis_name = self.getAxisNames()[1] + " [" + self.getAxisUnits( )[1] + "]" # Use of plot function plot_signals(x, signals, self.getSignalsNames(), x_label=x_axis_name, y_label=y_axis_name, title=title, saving=saving)
def compareSignals(self, *args, title=False, saving=False): """ :param args: :type args: Signal :return: """ signals_names = [self.getName()] signals = [self.getY()] for arg in args: if len(arg.getY()) == len(self.getX()): signals_names.append(arg.getName()) signals.append(arg.getY()) else: msg = "Signal {} have not a length of {}, comparaison can not be done. This signal is ignored". \ format(arg.getName(), len(self.getX())) print(warningText(msg)) continue plot_signals(self.getX(), signals, signals_names, x_label=self.getAxisLabels()[0], y_label=self.getAxisLabels()[1], title=title, saving=saving)
def autoCompareSignal(self): msg = "An equation and a value of y have been given. Here is the comparison of the 2." plot_signals(self.getX(), [self.getY(), self.getF(self.getX())], ['Y list', 'Function'], x_label=self.getAxisLabels()[0], y_label=self.getAxisLabels()[1]) print(warningText(msg))
def plot(self, title=False, saving=False): plot_signals(self.getX(), [self.getY()], [self.getName()], x_label=self.getAxisLabels()[0], y_label=self.getAxisLabels()[1], title=title, saving=saving)
import numpy as np from main.model.functions import * from main.plots import plot_signals if __name__ == '__main__': # Détection VL = detection_b_const(time, -1 / 4, 100) VL_list = [] VL_list.append(VL[0]) plot_signals(time, VL_list, ['$V_L$'], x_label="Temps [s]", y_label="Tension [mV]") # Amplificateur VL = VL[0] / 1000 VAMP = amplification(time, VL) plot_signals(time, VAMP, ['$V_{amp}$', '$V_L$'], x_label="Temps [ms]", y_label="Tension [V]") sin1 = lambda t: 0.2 * np.sin(20 * t) VAMP_bis = amplification(time, sin1(time)) plot_signals(time, VAMP_bis, ['$V_{amp}$', '$V_L$'], x_label="Temps [ms]", y_label="Tension [V]") # Filter VF = filter(np.linspace(0, 0.1, steps),