*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 6325f78d authored by Patrick Kappl's avatar Patrick Kappl
Browse files

Add plotting function for covariances

parent 886381de
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
import h5py
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import matplotlib.colors as colors
import colorcet as cc
import numpy as np
import os
......@@ -31,13 +33,13 @@ file_names = []
# file_names.append("jackknife_U4_b2_w16_n1e4_n4iwf20_2019-07-05_12-58-01.hdf5")
# file_names.append("jackknife_U4_b2_w16_n1e4_n4iwf20_2019-07-05_14-20-41.hdf5")
file_names.append("U4_b2_w4_n64e3_n4iwf20_2019-07-11_14-49-57.hdf5")
file_names.append("U4_b2_w8_n32e3_n4iwf20_2019-07-11_14-50-20.hdf5")
file_names.append("U4_b2_w16_n16e3_n4iwf20_2019-07-11_10-50-56.hdf5")
file_names.append("U4_b2_w32_n8e3_n4iwf20_2019-07-11_10-51-25.hdf5")
file_names.append("U4_b2_w50_n5120_n4iwf20_2019-07-18_17-13-41.hdf5")
file_names.append("U4_b2_w64_n4e3_n4iwf20_2019-07-11_10-51-47.hdf5")
file_names.append("U4_b2_w80_n3200_n4iwf20_2019-07-18_17-13-12.hdf5")
# file_names.append("U4_b2_w4_n64e3_n4iwf20_2019-07-11_14-49-57.hdf5")
# file_names.append("U4_b2_w8_n32e3_n4iwf20_2019-07-11_14-50-20.hdf5")
# file_names.append("U4_b2_w16_n16e3_n4iwf20_2019-07-11_10-50-56.hdf5")
# file_names.append("U4_b2_w32_n8e3_n4iwf20_2019-07-11_10-51-25.hdf5")
# file_names.append("U4_b2_w50_n5120_n4iwf20_2019-07-18_17-13-41.hdf5")
# file_names.append("U4_b2_w64_n4e3_n4iwf20_2019-07-11_10-51-47.hdf5")
# file_names.append("U4_b2_w80_n3200_n4iwf20_2019-07-18_17-13-12.hdf5")
# file_names.append("susc_U4_b2_w16_n1e3_n4iwf20_2019-07-16_08-23-11.hdf5")
......@@ -46,7 +48,9 @@ file_names.append("U4_b2_w80_n3200_n4iwf20_2019-07-18_17-13-12.hdf5")
# file_names.append("U4_b2_w16_n1e5_n4iwf20_self_2019-07-18_16-13-47.hdf5")
# file_names.append("U4_b2_w64_n4e3_n4iwf20_self_2019-07-18_16-08-24.hdf5")
# file_names.append(".hdf5")
file_names.append("U4_b2_w16_n1e5_n4iwf20_self_2019-07-23_08-51-44.hdf5")
file_names.append("U4_b2_w64_n4e3_n4iwf20_self_2019-07-23_12-27-26.hdf5")
# %%
# Read data from multiple files
......@@ -83,6 +87,11 @@ try:
except Exception as e:
print("Could not read samples")
print(e)
try:
covariances = np.array([np.array(f["covariance"][...]) for f in files])
except Exception as e:
print("Could not read covariances")
print(e)
n_nus = means[0].shape[-1]
n_ks = means[0].shape[-2]
print("n_ks=" + str(n_ks))
......@@ -310,7 +319,7 @@ def plot_bias_correction(k=[[0, 0]], file_indexes=[0], i_channel=None,
ax = plt.gca()
ax.yaxis.set_major_formatter(mtick.FormatStrFormatter("%.2e"))
plt.xlabel("\"$\\nu$\"", fontsize=12)
plt.ylabel(r"$|f(\hat{x})-\hat{y}_{\mathrm{jackknife}}|$", fontsize=12)
plt.ylabel(r"$|f(\hat{x})-\hat{y}_{\textrm{jackknife}}|$", fontsize=12)
plt.legend(bbox_to_anchor=(-0.15, -0.15), loc=2, ncol=5)
plt.title("Bias correction of the jackknife")
plt.axhline(linewidth=0.5, color="black")
......@@ -381,6 +390,18 @@ def plot_errors_in_k_plane(i_nu=n_nus//2, i_file=0):
return
def plot_covariances(k_x=0, k_y=0, i_file=0, vmin=None, vmax=None):
plt.pcolormesh(range(-n_nus//2, n_nus//2+1), range(-n_nus//2, n_nus//2+1),
np.abs(covariances[i_file, k_x, k_y]), vmin=vmin, vmax=vmax,
cmap=cc.m_kbc_r)
plt.xlabel("\"$\\nu$\"")
plt.ylabel("\"$\\nu$\"")
plt.title("abs(covariance), kx={}, ky={}".format(k_x, k_y))
plt.colorbar()
plt.show()
return
def plot_siw():
x_values = np.arange(-siw.shape[2] // 2, siw.shape[2] // 2) + 0.5
plt.plot(x_values, np.imag(siw[0, 0]), label="imag(siw[0])", linewidth=0.5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment