In [1]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
execfile ("_ImportScript.py")
In [2]:
execfile ("_ExploreMockManyNoise.py")
In [ ]:
execfile ("_Alpharobustness.py")
print mu.reshape(-1)[max_ind]
print sigma.reshape(-1)[max_ind]
In [3]:
execfile ('_SigmaDevPlot.py')
In [ ]:
In [4]:
execfile('_CalcEvidence.py')
In [5]:
execfile ('_FigofMerit.py')
In [7]:
execfile ('_PlotMostProbVals.py')
In [ ]:
execfile ('_PlotMargPost.py')
In [10]:
print beatbox.You.all_simulated_universes[0].fn
print beatbox.You.all_simulated_universes[-1].fn
In [9]:
np.round(100.0*(beatbox.You.all_reconstructed_universes[-1].fn.T-beatbox.You.all_simulated_universes[0].fn)/beatbox.You.all_simulated_universes[0].fn)
Out[9]:
In [11]:
print 100.*np.mean(np.sqrt(np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]/PS[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]))
print 100.*np.mean(np.sqrt(np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]/PS[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]))
print 100.*np.mean(np.sqrt(np.diag(beatbox.You.inv_A)/PS))
In [12]:
print 100*np.sqrt(np.mean(realbias**2/PS[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]) )
print 100*np.sqrt(np.mean(imagbias**2/PS[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]) )
In [13]:
print 100*np.sqrt(np.mean(realbias**2/np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]) )
print 100*np.sqrt(np.mean(imagbias**2/np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]) )
In [ ]:
len(beatbox.Universe.lms)
In [ ]:
len(beatbox.You.all_simulated_universes[0].fn)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
np.log (np.linalg.det(beatbox.You.A))/2.
In [ ]:
beatbox.You.all_reconstructed_universes[0].fn[num]
In [ ]:
np.sqrt(0.000178766944898)
In [ ]:
np.linalg.det(beatbox.You.A)**0.5/(2.*np.pi)**(0.5*len(beatbox.You.all_reconstructed_universes[0].fn))
In [ ]:
beatbox.You.all_reconstructed_universes= np.append(beatbox.You.all_reconstructed_universes, beatbox.Universe())
In [ ]:
beatbox.You.solve_for_3D_potential(beatbox.You.all_simulated_universes[0].ay2ayreal_for_inference(beatbox.You.all_simulated_universes[0].ay), print_alpha = 0)
beatbox.You.all_reconstructed_universes[-1].fn=beatbox.You.reconstrunct_fn
beatbox.You.all_reconstructed_universes[-1].transform_3D_potential_into_alm( usedefault=1, fn=1)
In [ ]:
n=-1
beatbox.You.all_reconstructed_universes[n].rearrange_fn_from_vector_to_grid()
beatbox.You.all_reconstructed_universes[n].evaluate_potential_given_fourier_coefficients()
import matplotlib.pyplot as plt
imgplot = plt.imshow(beatbox.You.all_simulated_universes[-1].phi[:,:,20])
plt.colorbar()
In [ ]:
plt.imshow(beatbox.You.all_reconstructed_universes[n].phi[:,:,20])
plt.colorbar()
In [ ]:
plt.imshow(beatbox.You.all_reconstructed_universes[0].phi[:,:,20]-beatbox.You.all_simulated_universes[0].phi[:,:,20])
plt.colorbar()
In [ ]:
print (beatbox.You.all_reconstructed_universes[-1].fn-beatbox.You.all_simulated_universes[0].fn)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]
print (beatbox.You.all_reconstructed_universes[-1].fn-beatbox.You.all_simulated_universes[0].fn)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]
In [ ]:
realbias = (beatbox.You.all_reconstructed_universes[-1].fn-beatbox.You.all_simulated_universes[0].fn)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]
imagbias = (beatbox.You.all_reconstructed_universes[-1].fn-beatbox.You.all_simulated_universes[0].fn)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]
In [ ]:
print np.mean(realbias), np.std(realbias), np.max(realbias), np.min(realbias)
print np.mean(imagbias), np.std(imagbias), np.max(imagbias), np.min(imagbias)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
n, bins, patches = plt.hist(np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)], 20, normed=0, facecolor='green', alpha=0.75)
n, bins, patches = plt.hist(np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):], 20, normed=0, facecolor='yellow', alpha=0.75)
plt.savefig('RobustnessAnalysis/rob_plt_lmax'+str(beatbox.Universe.truncated_lmax)+'_lmin'+str(beatbox.Universe.truncated_lmin)+'_nmax'+str(beatbox.Universe.truncated_nmax)+'_nmin'+str(beatbox.Universe.truncated_nmin)+'/A_histogram.png')
#plt.axis([0, 52, 0, 0.2])
plt.show()
In [ ]:
#print np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]
#print np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]
print np.mean(np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]), np.std(np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]), np.max(np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)]), np.min(np.diag(beatbox.You.inv_A)[:(len(beatbox.You.all_reconstructed_universes[-1].fn)/2)])
print np.mean(np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]), np.std(np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]), np.max(np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):]), np.min(np.diag(beatbox.You.inv_A)[(len(beatbox.You.all_reconstructed_universes[-1].fn)/2):])
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
n=2
hp.mollview(hp.alm2map(MockUniverse[n].alm-beatbox.You.all_simulated_universes[0].alm,256), rot=(-90,0,0), title="CMB graviational potential fluctuations as seen from inside the LSS, l_max=%d, Tmap diff" % beatbox.You.truncated_lmax)
hp.mollview(hp.alm2map(beatbox.You.all_reconstructed_universes[n].alm-beatbox.You.all_simulated_universes[0].alm,256), rot=(-90,0,0), title="CMB graviational potential fluctuations as seen from inside the LSS, l_max=%d, Tmap diff" % beatbox.You.truncated_lmax)
In [ ]:
beatbox.You.all_simulated_universes[0].show_CMB_T_map(from_perspective_of="observer")
MockUniverse[n].show_CMB_T_map(from_perspective_of="observer")
beatbox.You.all_reconstructed_universes[n].show_CMB_T_map(from_perspective_of="observer")
In [ ]:
In [ ]:
n=3
np.savetxt( "scratch/foryashar/true_alm.txt", beatbox.You.all_simulated_universes[0].alm)
np.savetxt( "scratch/foryashar/Mock_alm.txt", MockUniverse[n].alm)
np.savetxt( "scratch/foryashar/rec_alm.txt", beatbox.You.all_reconstructed_universes[n].alm)
np.savetxt( "scratch/foryashar/true_ay.txt", beatbox.You.all_simulated_universes[0].ay2ayreal_for_inference(beatbox.You.all_simulated_universes[0].ay))
np.savetxt( "scratch/foryashar/Mock_ay.txt", MockUniverse[n].ay2ayreal_for_inference(MockUniverse[n].ay))
np.savetxt( "scratch/foryashar/rec_ay.txt", beatbox.You.all_reconstructed_universes[n].ay2ayreal_for_inference(beatbox.You.all_reconstructed_universes[n].ay))
np.savetxt( "scratch/foryashar/A.txt",beatbox.You.A)
np.savetxt( "scratch/foryashar/invA.txt",beatbox.You.inv_A)
np.savetxt( "scratch/foryashar/C_yy.txt",beatbox.You.C_yy)
np.savetxt( "scratch/foryashar/invC_yy.txt",beatbox.You.inv_Cyy)
ind = np.where(beatbox.Universe.kfilter>0)
PS = np.zeros(2*len(ind[1]))
PS[:len(ind[1])] = (beatbox.You.all_simulated_universes[-1].Power_Spectrum[ind])
PS[len(ind[1]):] = (beatbox.You.all_simulated_universes[-1].Power_Spectrum[ind])
inv_Cf=np.diag(1./PS)
np.savetxt( "scratch/foryashar/prior_inv_Cf.txt",inv_Cf)
np.savetxt( "scratch/foryashar/true_fn.txt", beatbox.You.all_simulated_universes[0].fn)
np.savetxt( "scratch/foryashar/rec_fn.txt", beatbox.You.all_reconstructed_universes[n].fn)
np.savetxt( "scratch/foryashar/R.txt", beatbox.You.R_real)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: