for j in numpy.arange(nbPixel):
		data2[i][j] -= cov[j][i]
data2[ data2==0. ] = numpy.float('nan')
myTools.plot2D(data2)


#plt.hist(data[data!=0.],bins=100)
#plt.hist(numpy.diag(data),bins=100)
#plt.show()



if (nbPixel==nbBin1D__):
	xi1D = xi1D_[:,1]
else:
	xi1D = myTools.convert2DTo1D(xi2D_[:,:,1], 50,100)

xi1D_2 = numpy.dot(data,xi1D)

plt.errorbar(numpy.arange(nbPixel),xi1D,fmt='o',label='Before correction')
plt.errorbar(numpy.arange(nbPixel),xi1D_2,fmt='o',label='After correction')
myTools.deal_with_plot(False,False,True)
plt.show()

if (nbPixel==nbBin1D__):
	xi1D_[:,1] = xi1D_2
	plotXi(0)
	plotXi(1)
	plotXi(2)
	pathToCamb = '/home/gpfs/manip/mnt0607/bao/hdumasde/Results/Txt/CAMB_2_4/xi-z2.4.dat'
	fitCamb(xi1D_,pathToCamb,0)
Пример #2
0
def saveListRealMocks(ni,nj,distortion=False):
	'''
		- ni: Box
		- nj: Simu
		- distortion: Flag to use or not the distortion matrix (defalut=False)

		Usage example:
			cov = numpy.load('/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v1547/Results_NicolasDistortion/xi_delta_QSO_result_cov_1D.npy')
			cor = myTools.getCorrelationMatrix(cov)
			myTools.plot2D(cor)
			a = myTools.plotCovar([cor],['a'])

	'''

	### Where to get correlation
	path       = '/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v1547/Box_00'
	### Where to save the results
	pathToSave = '/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v1547/Results_NicolasDistortionWithDistortion/xi_delta_QSO_result_'

	list1D       = numpy.zeros( shape=(nbBin1D__,ni*nj) )
	list2D       = numpy.zeros( shape=(nbBin2D__,ni*nj) )
	listMu       = numpy.zeros( shape=(nbBin1D__*nbBinM__,ni*nj) )
	listWe       = numpy.zeros( shape=(nbBin1D__,3,ni*nj) )
	listMultipol = numpy.zeros( shape=(nbBin1D__,5,ni*nj) )

	for i in numpy.arange(ni):
		for j in numpy.arange(nj):
			tmpPath =  path + str(i)+'/Simu_00'+str(j)+'/Results_NicolasDistortion/xi_delta_QSO_'

			try:
				xi1D, xi2D, xiMu, xiWe = loadData(tmpPath+'Mu_LYA_QSO.txt',tmpPath+'2D_LYA_QSO.txt')
				list1D[:,i*10+j]         = xi1D[:,1]
				list2D[:,i*10+j]         = xi2D[:,:,1].flatten()
				listMu[:,i*10+j]         = xiMu[:,:,2].flatten()
				listWe[:,:,i*10+j]       = xiWe[:,:,1]
				listMultipol[:,:,i*10+j] = plotMultipol(xiMu)[:,:,1]
			except:
				print '   ERROR:: ', tmpPath

			if (distortion):
				tmp_command = " echo " + str(i) + " " + str(j)
				subprocess.call(tmp_command, shell=True)

				### distortion matrix 1D
				data = numpy.loadtxt(tmpPath+'distortionMatrix_1D_LYA_QSO.txt')
				list1D[:,i*10+j] = numpy.dot(data,xi1D[:,1])
				#myTools.plot2D(data)
				#myTools.plot1D([xi1D[:,1],list1D[:,i*10+j]],'-','-','-',['before','after'])
				### distortion matrix 2D
				data = numpy.loadtxt(tmpPath+'distortionMatrix_2D_LYA_QSO.txt')
				xi1D = myTools.convert2DTo1D(xi2D[:,:,1], nbBinX2D__,nbBinY2D__)
				list2D[:,i*10+j] = numpy.dot(data,xi1D)

				

	numpy.save(pathToSave+'1D',list1D)
	numpy.save(pathToSave+'2D',list2D)
	numpy.save(pathToSave+'Mu',listMu)
	numpy.save(pathToSave+'We',listWe)
	numpy.save(pathToSave+'Multipol',listMultipol)

	
	cov1D = numpy.cov(list1D)
	cov2D = numpy.cov(list2D)
	covMu = numpy.cov(listMu)
	numpy.save(pathToSave+'cov_1D',cov1D)
	numpy.save(pathToSave+'cov_2D',cov2D)
	numpy.save(pathToSave+'cov_Mu',covMu)
	

	return