In [21]:
%load_ext autoreload
%autoreload 2
In [22]:
from pearce.emulator import OriginalRecipe, ExtraCrispy
from pearce.emulator import parameter, DEFAULT_PARAMS as PARAMS
In [23]:
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
from itertools import cycle
colors = cycle(sns.color_palette())
In [24]:
log_frac_errors = np.abs(np.loadtxt('zd_frac_dev.npy') )
#log_frac_errors = np.abs(np.loadtxt('zd_rmfsd.npy'))
In [32]:
print log_frac_errors.shape
In [25]:
rms = np.sqrt(np.mean((log_frac_errors)**2, axis = 0))
In [26]:
top_percentile, bottom_percentile = np.percentile(log_frac_errors, [84, 16], axis = 0)
In [27]:
print top_percentile
print bottom_percentile
In [28]:
from os import path
data_dir = '/u/ki/swmclau2/des/emulator_tarfile/wp_data/'
e1 = np.loadtxt(path.join(data_dir, 'Cosmo_err.dat'))
e2 = np.loadtxt(path.join(data_dir, 'Cosmo_pure_err.dat'))
yerr_1bin = np.sqrt(e2 ** 2.0 + (e1 ** 2.0 - e2 ** 2.0) / 9.0)
In [29]:
bin_centers = np.loadtxt('rbins.npy')
In [31]:
fig = plt.figure(figsize= (17,10))
c = colors.next()
for sample in log_frac_errors:
plt.plot(bin_centers, sample, color = c,alpha = 0.2 )
plt.plot(bin_centers, log_frac_errors.mean(axis =0), color = colors.next(), lw = 5, label = 'Mean')
plt.plot(bin_centers, rms, color = colors.next(), lw = 5, label = 'RMS')
plt.plot(bin_centers, (top_percentile-bottom_percentile)/2, color = colors.next(), lw = 5, label = '68%')
plt.plot(bin_centers, yerr_1bin, color = colors.next(), lw = 5, label = 'Uncertanties/Sample Variance')
plt.title('GBDT Model Fractional Error', fontsize =20)
plt.plot(bin_centers, np.ones(len(bin_centers))*0.01, color = 'k')
plt.xlim(xmin = bin_centers.min()-0.05, xmax = bin_centers.max()+1)
#plt.ylim(ymin = 0, ymax = 0.25)
#plt.loglog()
plt.xscale('log')
plt.xlabel(r'$r $ $\rm{[Mpc]}$', fontsize=25)
#plt.ylabel(r'$|\hat{w_p}(r_p) - w_p(r_p)|/w_p(r_p) $', fontsize=25)
plt.legend(loc = 'best', fontsize = 25)
plt.ylabel(r'Percent Error', fontsize = 25)
#plt.suptitle('Errors and GOF of various Emulators, Log Space', fontsize = 20)
plt.show()
In [ ]: