In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.interpolate as s
In [2]:
new_probability = np.loadtxt('./Model/fit_results.csv', delimiter=',', dtype=str)
results = np.loadtxt('./Model/model_prob.csv', delimiter=',', dtype=str)
In [3]:
my_probability = {}
for i in range(len(new_probability[0, :])): # Converting numpy array into dictionary
my_probability[new_probability[0, i]] = np.array(new_probability[0 + 1:, i], dtype=str)
In [4]:
my_results = {}
for i in range(len(results[0, :])): # Converting numpy array into dictionary
my_results[results[0, i]] = np.array(results[0 + 1:, i], dtype=str)
In [5]:
parameter = my_probability['parameter'].astype(str)
quartile_1st = my_probability['25%'].astype(float)
quartile_2st = my_probability['75%'].astype(float)
quantile_25 = my_probability['2.5%'].astype(float)
quantile_97 = my_probability['97.5%'].astype(float)
mean = my_probability['mean'].astype(float)
In [6]:
probability = my_results['pnew'].astype(float)
redshift = my_results['redshift'].astype(float)
In [7]:
print mean.size
print probability.size
print redshift.size
In [8]:
print parameter[5449]
In [9]:
idx_beg = []
idx_end = []
for i in range(parameter.size):
if (parameter[i]=='pnew[0]'):
idx_beg = int(i)
print idx_beg
print 'ok'
elif (parameter[i]=='pnew[999]'):
idx_end = int(i)
print idx_end
print 'ok'
else:
continue
In [10]:
new_q1 = quartile_1st[idx_beg:idx_end+1]
new_q2 = quartile_2st[idx_beg:idx_end+1]
new_25 = quantile_25[idx_beg:idx_end+1]
new_97 = quantile_97[idx_beg:idx_end+1]
new_param = parameter[idx_beg:idx_end+1]
new_mean = mean[idx_beg:idx_end+1]
In [11]:
# interp_function_01 = s.interp1d(redshift, mean)
# new_redshift = np.linspace(redshift.min(), redshift.max(), 200)
# new_probability = interp_function_01(new_redshift)
# print mean.size
In [12]:
print new_mean.size
In [13]:
print redshift.size
In [ ]:
plt.fill_between??
In [ ]:
plot01 = plt.plot(redshift, new_mean, '.', color='#e34a33', alpha=0.4, label='Mean Probability')
plot02 = plt.plot(redshift, new_q1, '.', color='#fdbb84', alpha=0.4, label='25%')
plot03 = plt.plot(redshift, new_q2, '.', color='#fdbb84', alpha=0.4, label='75%')
plot04 = plt.plot(redshift, new_25, '.', color='#fdbb84', alpha=0.2, label='2.5%')
plot05 = plt.plot(redshift, new_97, '.', color='#fdbb84', alpha=0.2, label='97.5%' )
plt.fill_between(redshift, new_mean, new_q1, color='#fdbb84', alpha=0.4)
plt.fill_between(redshift, new_mean, new_q2, color='#fdbb84', alpha=0.4)
plt.fill_between(redshift, new_mean, new_25, color='#fdbb84', alpha=0.2)
plt.fill_between(redshift, new_mean, new_97, color='#fdbb84', alpha=0.2)
plt.ylabel(r"Probability", fontsize=20)
plt.xlabel(r"Redshift", fontsize=20)
plt.tick_params('both', labelsize='15')
plt.legend(loc='best', fontsize='20')
plt.savefig('./Model/results.pdf', dpi=100)
plt.show()
In [ ]:
my_probability['mean'].size
In [ ]:
my_results['redshift'].size
In [ ]: