plt.ylim(0, 3e10) plt.xticks([fs / (24 * 7), fs / (24), fs / (12), fs / (8)], labels=['weekly', 'daily', '12-hours', '8-hours']) plt.xlabel(r'Periodicity ($\frac{1}{f}$)') plt.ylabel(r'PSD of PM$_{10}$ at Station 1') plt.tight_layout() plt.axes([.65, .6, .2, .2]) plt.plot(f, psd_pm10, 'k') plt.xlim(0, 1 / (3600 * 24 * 7 * 25)) plt.xticks([fs / (24 * 365)], labels=['annually']) plt.savefig("psd_pm10.pdf", format='pdf') # ============================================================================= # Covariance matrix # ============================================================================= Sigma_no2 = functions.covmat(acf_no2, time[0:24 * 7]) plt.figure(figsize=(5, 4)) plt.imshow(Sigma_no2, cmap='gray') plt.colorbar() plt.xticks(np.arange(0, 24 * 7, 24)) plt.yticks(np.arange(0, 24 * 7, 24)) plt.xlabel(r'Time (hours)') plt.ylabel(r'Time (hours)') Sigma_pm10 = functions.covmat(acf_pm10, time[0:24 * 7]) plt.figure(figsize=(5, 4)) plt.imshow(Sigma_pm10, cmap='gray') plt.colorbar() plt.xticks(np.arange(0, 24 * 7, 24))
mu_test_prior = mean_busday else: mu_test_prior = mean_holiday meteo_test = meteo[:, index_test[0] - 24:index_test[0]] feature_test = np.empty((6, 24)) feature_test[0:4, :] = meteo_test[[0, 1, 2, 4], :] feature_test[4, :] = np.sin(np.deg2rad(meteo_test[3, :])) feature_test[5, :] = np.cos(np.deg2rad(meteo_test[3, :])) # mu_test_prior = NN_model.predict(np.concatenate(feature_test).reshape(1, 144)) # mu_test_prior = mu_test_prior.reshape(5, 24) cov_test_prior = np.zeros((5, 24, 24)) for i in range(5): cov_test_prior[i, :, :] = functions.covmat(acf[i, :], time_test) # fig, axs = plt.subplots(1, 5, figsize=(20, 4), sharey=True) # for i in range(5): # axs[i].plot(np.exp(mu_test_prior[i, :]), 'k') # axs[i].plot(no2[i, index_test], 'k:') # axs[i].set_xlim([0, 23]) # axs[i].set_xlabel(r'Time (hour)') # axs[i].set_ylim([0, .8*np.max(no2)]) # axs[0].set_ylabel(r'NO$_2$ ($\mu g/m^3$)') # # fig, axes = plt.subplots(nrows=1, ncols=5, figsize=(24,4), sharey=True) # i = 0 # for ax in axes.flat: # print(i) # im = ax.imshow(cov_test_prior[i, :, :], cmap = 'binary', vmin = 0, vmax = np.max(cov_test_prior))