Calculate and show the covariance matrix for template noise.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
from pylab import * | |
from glob import glob | |
from scipy.stats import nanmean | |
NN = '088' # change this | |
fileglob = 'Residuals_NN' + NN + '_Index*' | |
print 'Using', fileglob, '\n' | |
filenames = glob(fileglob) | |
filenames.sort() | |
arr = [] | |
for f in filenames: | |
a = loadtxt(f, unpack=True) | |
#print nanmean(a) | |
a = a - nanmean(a) | |
arr.append(a) | |
print len(arr), '"realizations" of', shape(arr)[1], 'variables\n' | |
nr = len(arr) | |
nv = shape(arr)[1] | |
arr_wn = nan_to_num(arr) # replace nan with 0 (should we do this?) | |
R = corrcoef(arr_wn) | |
pcolor(R) | |
cb = colorbar() | |
yticks(arange(0.5,nr+0.5),range(1,nr+1)) | |
xticks(arange(0.5,nr+0.5),range(1,nr+1)) | |
xlim([0,nr]) | |
ylim([0,nr]) | |
show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment