Indices = np.flipud( np.argsort(SIGMA_M)) # find indices for sorting in decreasing order Sorted_Sigmas = SIGMA_M[Indices] # Sort all the sigmas Phi_M = PHI_M[:, Indices] # Sorted Spatial Structures Matrix Psi_M = Psi_M[:, Indices] # Sorted Temporal Structures Matrix Sigma_M = Sorted_Sigmas # Sorted Amplitude Matrix # Show some exemplary modes for mPOD. for j in range(1, 12): plt.close(fig='all') fig, ax3 = plt.subplots(figsize=(5, 7)) ax = plt.subplot(2, 1, 1) V_X = Phi_M[0:nxny, j - 1] V_Y = Phi_M[nxny::, j - 1] Plot_Field(X_S, Y_S, V_X, V_Y, True, 1, 1.5) ax.set_aspect('equal') # Set equal aspect ratio ax.set_xticks(np.arange(0, 40, 10)) ax.set_yticks(np.arange(10, 30, 5)) ax.set_xlim([0, 35]) ax.set_ylim([10, 29]) ax.invert_yaxis() # Invert Axis for plotting purpose String_y = '$\phi_{\mathcal{M}' + str(j) + '}$' plt.title(String_y, fontsize=18) # plt.tight_layout(pad=1, w_pad=0.5, h_pad=1.0) ax = plt.subplot(2, 1, 2) Signal = Psi_M[:, j - 1] s_h = np.abs((np.fft.fft(Signal - Signal.mean()))) Freqs = np.fft.fftfreq(int(n_t)) * Fs plt.plot(Freqs * (4 / 1000) / 6.5, s_h, '-', linewidth=1.5)