From 1211aa2be70fdfb96f48bce1fa6809de74ff5d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Thu, 21 Feb 2019 11:10:11 -0300 Subject: [PATCH] Updating the documentation --- docs/build/doctrees/environment.pickle | Bin 2233540 -> 2233540 bytes pyFTS/data/artificial.py | 98 +++++++++++++++---------- 2 files changed, 58 insertions(+), 40 deletions(-) diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index 78a55bc92794fb237566098c167d526d925014e5..31382325c229584184f1a8795dedea37a6811e88 100644 GIT binary patch delta 4700 zcmZ`-YgAKL7G?)R9^?rmB!t|X@DP0P(12BI5e86E5ET2ewva+Jv5-I#w05SNtQp5X zvRd%aIkTo6Tl!}@)v2`|n_q2hr=8W-R&A#p$9Ac-U0qdC@qsu#inGtTMAYT{*z9w@ zv)^amyKngDuTQ~8NN);?3Po3-qqox&8i=KLZ(O*trKH;(4Ew^qfZr2DP|m@Dn7XIe z*Zx>2jE4iUY|{UdjTn_KO-wB*b-2TBGN>?_HPXI4(A5?2qq@)E;dy+3wAGo(hl)(Y z#4-BxbfR?=8T^fjihIERcCC_tDYB^gkZotf9~aemqtf!LyU5$8R4G70X)ba^uZH<# zw|W+_X*J|$y^9>xsL2|gi@c&q<9wA?;)isVCl#wHjQ>7s#Q7-dZ=Qt8dp}=*F8|uy>Xz=`^@tLMX|+X&|XfAMl)$Q zE|J9=`St^Y4d!A(g`~-tk=o~d7A470#%yxJs8P1I`ux6dYb$xtJ`Vw_vd3c zP`Zvho1p^9&``RKykf5)3=L*JKvHpCmSN$XVTUpvfaN#zv?hZrHo5&%x`EhD%~-4& zS?pd6r%{=m@wLE!Y!wO#4y;cR; zpRI*O3?=(*CQ_&^A$zR`vPNWFLAGRP;x+Mg%DrJ*CZr|VH{S+B2~^jJ7V z47Qq-aM0sPn4T=@QCl?z(9Z%`f@P^rl^PaHy@>40S%tN1!h5P9FXw2rz7WnF`YE$RP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>e=1gT!(jK0;G>Oi2QIz6m;D4Tr^sJtauhu;O4Pfcbz)B8AuXkT`Gw`09fk7EualQYRo0*cEf%|R- z9+E+tqF1C(zhP_OVU^tg24qmG)hoU}4lyZvSYcE`^qJyI3M3^`B2p4kGLi~Ojif=+ zBI%IyNCqS$k_pL-l!BCsl!la!WI@V6vLa<7*^ul=4kV{ke94s+S4QJG)O3Q+h$prP zPF%Zb*9q`CqH#+_D7elSWIvdiTG=nF@z;g)(-z@Q_SzZf5(IW-7jG4umT25`g9E!E zEGSyWx&^lrAK3pN^FLdKkJ%;d?iC!!3NL!Bspz1)#}`=TkN8?}11w&7uV7^<2YUsV zH5yNuq`tPltk;AAHm*!N1Xo5hZe9`g1zRRrvOqiD5IRB zFjG90HVr{K8f@Mt@K;&ymqHdxg$m+?hYQYM-h+O<^7r0!}_qYbpQg#y6{ zJDkR9k$ts1Q6|o2y|_ho`MFwTZA8>b`^&_{iP-=KrGw(M5Sei%Jv$1Sym7fq#BnK4 zhN2~+o0^xPUu~s4Q_kEevdx^dt!V7pgUhV*%rMlh=Z0b6EzqzM_#e_|0Ly^tH6}gUv5`;=_kuX z-B`$%pI4+Io-gkMXMlw{;hkfZUN;hY7mEBo^7uAB1klk+;Wp9Arjqo};GPpr it: @@ -78,21 +79,21 @@ def generate_linear_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_m return ret -def generate_senoidal_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max, it=100, num=10, vmin=None, vmax=None): +def generate_sinoidal_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max, it=100, num=10, vmin=None, vmax=None): """ + Generates a periodic sinoidal variation on mean and variance - :param period: - :param mu_min: - :param sigma_min: - :param mu_max: - :param sigma_max: - :param it: - :param num: - :param vmin: - :param vmax: - :return: + :param period: the period of recurrence + :param mu_min: initial (and minimum) mean of each period + :param sigma_min: initial (and minimum) variance of each period + :param mu_max: final (and maximum) mean of each period + :param sigma_max: final (and maximum) variance of each period + :param it: Number of iterations + :param num: Number of samples generated on each iteration + :param vmin: Lower bound value of generated data + :param vmax: Upper bound value of generated data + :return: A list of it*num float values """ - mu_range = mu_max - mu_min sigma_range = sigma_max - sigma_min mu = mu_min @@ -145,10 +146,21 @@ def generate_uniform_linear(min_ini, max_ini, min_inc, max_inc, it=100, num=10, def white_noise(n=500): + """ + Simple Gaussian noise signal + :param n: number of samples + :return: + """ return np.random.normal(0, 1, n) def random_walk(n=500, type='gaussian'): + """ + Simple random walk + :param n: number of samples + :param type: 'gaussian' or 'uniform' + :return: + """ if type == 'gaussian': tmp = generate_gaussian_linear(0, 1, 0, 0, it=1, num=n) else: @@ -185,6 +197,9 @@ def _append(additive, start, before, new): class SignalEmulator(object): + """ + Emulate a complex signal built from several additive and non-additive components + """ def __init__(self, **kwargs): super(SignalEmulator, self).__init__() @@ -196,14 +211,14 @@ class SignalEmulator(object): Creates a continuous Gaussian signal with mean mu and variance sigma. :param mu: mean :param sigma: variance - :keyword cummulative: If False it cancels the previous signal and start this one, if True - this signal is added to the previous one + :keyword additive: If False it cancels the previous signal and start this one, if True + this signal is added to the previous one :keyword start: lag index to start this signal, the default value is 0 :keyword it: Number of iterations, the default value is 1 :keyword length: Number of samples generated on each iteration, the default value is 100 :keyword vmin: Lower bound value of generated data, the default value is None :keyword vmax: Upper bound value of generated data, the default value is None - :return: A list of it*num float values + :return: the current SignalEmulator instance, for method chaining """ parameters = {'mu': mu, 'sigma': sigma} self.components.append({'dist': 'gaussian', 'type': 'constant', @@ -213,16 +228,14 @@ class SignalEmulator(object): def incremental_gaussian(self, mu, sigma, **kwargs): """ Creates an additive gaussian interference on a previous signal - :param mu: - :param sigma: - :keyword cummulative: If False it cancels the previous signal and start this one, if True - this signal is added to the previous one + :param mu: increment on mean + :param sigma: increment on variance :keyword start: lag index to start this signal, the default value is 0 :keyword it: Number of iterations, the default value is 1 :keyword length: Number of samples generated on each iteration, the default value is 100 :keyword vmin: Lower bound value of generated data, the default value is None :keyword vmax: Upper bound value of generated data, the default value is None - :return: A list of it*num float values + :return: the current SignalEmulator instance, for method chaining """ parameters = {'mu': mu, 'sigma': sigma} self.components.append({'dist': 'gaussian', 'type': 'incremental', @@ -232,16 +245,16 @@ class SignalEmulator(object): def periodic_gaussian(self, type, period, mu_min, sigma_min, mu_max, sigma_max, **kwargs): """ Creates an additive periodic gaussian interference on a previous signal - :param mu: - :param sigma: - :keyword additive: If False it cancels the previous signal and start this one, if True - this signal is added to the previous one + :param type: 'linear' or 'sinoidal' + :param period: the period of recurrence + :param mu: increment on mean + :param sigma: increment on variance :keyword start: lag index to start this signal, the default value is 0 :keyword it: Number of iterations, the default value is 1 :keyword length: Number of samples generated on each iteration, the default value is 100 :keyword vmin: Lower bound value of generated data, the default value is None :keyword vmax: Upper bound value of generated data, the default value is None - :return: A list of it*num float values + :return: the current SignalEmulator instance, for method chaining """ parameters = {'type':type, 'period':period, 'mu_min': mu_min, 'sigma_min': sigma_min, 'mu_max': mu_max, 'sigma_max': sigma_max} @@ -251,10 +264,10 @@ class SignalEmulator(object): def blip(self, **kwargs): """ + Creates an outlier greater than the maximum or lower then the minimum previous values of the signal, + and insert it on a random location of the signal. - :param intensity: - :param kwargs: - :return: + :return: the current SignalEmulator instance, for method chaining """ parameters = {} self.components.append({'dist': 'blip', 'type': 'blip', @@ -262,6 +275,11 @@ class SignalEmulator(object): return self def run(self): + """ + Render the signal + + :return: a list of float values + """ signal = [] last_it = 10 last_num = 10 @@ -286,8 +304,8 @@ class SignalEmulator(object): mu_max, sigma_max = parameters['mu_max'],parameters['sigma_max'] if parameters['type'] == 'sinoidal': - tmp = generate_senoidal_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max, - it=num, num=1, vmin=vmin, vmax=vmax) + tmp = generate_sinoidal_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max, + it=num, num=1, vmin=vmin, vmax=vmax) else: tmp = generate_linear_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max, it=num, num=1, vmin=vmin, vmax=vmax)