diff --git a/functions.py b/functions.py deleted file mode 100644 index f6c9bad..0000000 --- a/functions.py +++ /dev/null @@ -1,51 +0,0 @@ -import numpy as np - - -def fun_Sine(t, f=1, a=1): - w = 2 * np.pi * f - return a * np.sin(w * t) - - -def fun_Dimmer(t, tInt_perc, f=1, a=1): - periode = 1 / f - tInt = 0.5 * periode * (tInt_perc / 100) - vt = fun_Sine(t, f, a) - vd = 0 - if (0 <= t and t < tInt): - vd = 0 - elif (tInt <= t and t < 0.5 * periode): - vd = vt - elif (0.5*periode <= t and t < 0.5*periode + tInt): - vd = 0 - elif (0.5*periode + tInt <= t and t < periode): - vd = vt - return vd - - -def fun_rms_numeric(data_y): - sum_y = 0 - for i in data_y: - sum_y = sum_y + i**2 - rms = np.sqrt(sum_y / len(data_y)) - return rms - - -def fun_rms_simbolic(tInt_perc, frec=1, amp=1): - periode = 1 / frec - tInt = 0.5 * periode * (tInt_perc / 100) - T1, T2 = 0, periode - - def sine_integrate(t): - w = 2 * np.pi * frec - int_a = amp ** 2 - int_b = t / 2 - int_c = (np.sin(2*t*w) / (4*w)) - sine_int = int_a * (int_b - int_c) - return sine_int - - rms_a = 1 / (T2 - T1) - rms_b1 = sine_integrate(T2 / 2) - rms_b2 = sine_integrate(tInt) - rms_b = (rms_b1 - rms_b2) * 2 - rms = np.sqrt(rms_a * rms_b) - return rms \ No newline at end of file diff --git a/test_properties.py b/test_properties.py deleted file mode 100644 index f72cd75..0000000 --- a/test_properties.py +++ /dev/null @@ -1,42 +0,0 @@ -class Onda: - def __init__(self, frec): - self.__frec = frec - self.__per = 1 / frec - - @property - def frec(self): - print(f"getter fre: {self.__frec}") - return self.__frec - - @property - def per(self): - print(f"getter per: {self.__per}") - return self.__per - - - @frec.setter - def frec(self, frec): - self.__frec = frec - self.__per = 1 / frec - print(f"setter fre: {self.frec}") - - @per.setter - def per(self, per): - self.__per = per - self.__frec = 1 / per - print(f"setter per: {self.per}") - - @frec.deleter - def frec(self): - del self.__frec - print("deletter frec") - -sine = Onda(1) -print(f"sine.frec ; {sine.frec}\n") -print(f"sine.per ; {sine.per}\n") -sine.frec = 10 -print(f"sine.frec = 10 ; {sine.frec}\n") -print(f"sine.per ; {sine.per}\n") -sine.per = 0.1 -print(f"sine.per = 0.1 ; {sine.per}\n") -print(f"sine.frec ; {sine.frec}\n") \ No newline at end of file