huaxian_ssa.plot_wcorr(max=11) plt.title("W-Correlation for the monthly Runoff of Huaxian", fontsize=10) plt.subplots_adjust(left=0.12, bottom=0.06, right=0.9, top=0.98, hspace=0.4, wspace=0.25) # plt.savefig(root_path+'/Huaxian_ssa/graphs/w_correlation.eps',format='EPS',dpi=2000) # plt.savefig(root_path+'/Huaxian_ssa/graphs/w_correlation.tif',format='TIFF',dpi=1000) plt.show() print("@@@@") #%% plt.figure() huaxian_ssa.reconstruct(0).plot() huaxian_ssa.reconstruct([1, 2]).plot() huaxian_ssa.reconstruct([3, 4]).plot() huaxian_ssa.orig_TS.plot(alpha=0.4) plt.title("Monthly Runoff of Huaxian: First Three groups") plt.xlabel(r"$t$(month)") plt.ylabel(r"Runoff($m^3/s$)") legend = [r"$\tilde{{F}}^{{({0})}}$".format(i) for i in range(3)] + ["Original TS"] plt.legend(legend) #%% plt.figure() huaxian_ssa.reconstruct(slice(0, 5)).plot() huaxian_ssa.orig_TS.plot(alpha=0.4) plt.title("Monthly Runoff of Huaxian: Low-Frequancy Periodicity")
#%% F_ssa_L5 = SSA(F, 5) F_ssa_L5.components_to_df().plot() F_ssa_L5.orig_TS.plot(alpha=0.4) plt.xlabel("$t$") plt.ylabel(r"$\tilde{F}_i(t)$") plt.title(r"$L=5$ for the Toy Time Series") #%% F_ssa_L20 = SSA(F, 20) F_ssa_L20.plot_wcorr() plt.title("W-Correlation for Toy Time Series, $L=20$") #%% F_ssa_L20.reconstruct(0).plot() F_ssa_L20.reconstruct([1, 2, 3]).plot() F_ssa_L20.reconstruct(slice(4, 20)).plot() F_ssa_L20.reconstruct(3).plot() plt.xlabel("$t$") plt.ylabel(r"$\tilde{F}_i(t)$") plt.title("Component Groupings for Toy Time Series, $L=20$") plt.legend([ r"$\tilde{F}_0$", r"$\tilde{F}_1+\tilde{F}_2+\tilde{F}_3$", r"$\tilde{F}_4+\ldots+\tilde{F}_{19}$", r"$\tilde{F}_3$", ]) #%% F_ssa_L40 = SSA(F, 40)
'Periodic2', #F2 'Periodic3', #F3 'Periodic4', #F4 'Periodic5', #F5 'Periodic6', #F6 'Periodic7', #F7 'Periodic8', #F8 'Periodic9', #F9 'Periodic10', #F10 'Noise', #F11 ] #%% # Decompose the entire monthly runoff of HuaXian HuaXian_ssa = SSA(full, window) F0 = HuaXian_ssa.reconstruct(0) F1 = HuaXian_ssa.reconstruct(1) F2 = HuaXian_ssa.reconstruct(2) F3 = HuaXian_ssa.reconstruct(3) F4 = HuaXian_ssa.reconstruct(4) F5 = HuaXian_ssa.reconstruct(5) F6 = HuaXian_ssa.reconstruct(6) F7 = HuaXian_ssa.reconstruct(7) F8 = HuaXian_ssa.reconstruct(8) F9 = HuaXian_ssa.reconstruct(9) F10 = HuaXian_ssa.reconstruct(10) F11 = HuaXian_ssa.reconstruct(11) orig_TS = HuaXian_ssa.orig_TS df = pd.concat([orig_TS, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11], axis=1) df = pd.DataFrame(df.values, columns=columns)
'Periodic2', #F2 'Periodic3', #F3 'Periodic4', #F4 'Periodic5', #F5 'Periodic6', #F6 'Periodic7', #F7 'Periodic8', #F8 'Periodic9', #F9 'Periodic10', #F10 'Noise', #F11 ] #%% # Decompose the entire monthly runoff of huaxian huaxian_ssa = SSA(full, window) F0 = huaxian_ssa.reconstruct(0) F1 = huaxian_ssa.reconstruct(1) F2 = huaxian_ssa.reconstruct(2) F3 = huaxian_ssa.reconstruct(3) F4 = huaxian_ssa.reconstruct(4) F5 = huaxian_ssa.reconstruct(5) F6 = huaxian_ssa.reconstruct(6) F7 = huaxian_ssa.reconstruct(7) F8 = huaxian_ssa.reconstruct(8) F9 = huaxian_ssa.reconstruct(9) F10 = huaxian_ssa.reconstruct(10) F11 = huaxian_ssa.reconstruct(11) orig_TS = huaxian_ssa.orig_TS df = pd.concat([orig_TS, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11], axis=1) df = pd.DataFrame(df.values, columns=columns)