本文整理汇总了Python中myTools.deal_with_plot函数的典型用法代码示例。如果您正苦于以下问题:Python deal_with_plot函数的具体用法?Python deal_with_plot怎么用?Python deal_with_plot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deal_with_plot函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plotDataAndFit_S
def plotDataAndFit_S():
"""
Plot \\xi( |s| )
"""
binSize = 4.0
sss = numpy.arange(0.0, 50.0) * 4.0 + 2.0
yyy_dat = numpy.zeros(shape=(50, 2))
yyy_fit = numpy.zeros(shape=(50, 2))
cut = numpy.logical_and((xxx__ != 0.0), (xxx__ < 200.0))
xxx = xxx__[cut]
xi_dat = xi_dat__[cut]
xi_fit = xi_fit__[cut]
xi_err = 1.0 / (xi_err__[cut] ** 2.0)
for i in range(0, xxx.size):
sIdx = int(xxx[i] / binSize)
yyy_dat[sIdx][0] += xi_dat[i] * xi_err[i]
yyy_dat[sIdx][1] += xi_err[i]
yyy_fit[sIdx][0] += xi_fit[i] * xi_err[i]
yyy_fit[sIdx][1] += xi_err[i]
yyy_dat[:, 0] /= yyy_dat[:, 1]
yyy_dat[:, 1] = numpy.sqrt(1.0 / yyy_dat[:, 1])
yyy_fit[:, 0] /= yyy_fit[:, 1]
yyy_fit[:, 1] = numpy.sqrt(1.0 / yyy_fit[:, 1])
### Plot the results
for i in numpy.arange(0, 3):
a = ""
if i == 1:
a += "|s|."
elif i == 2:
a += "|s|^{2}."
coef = numpy.power(sss, 1.0 * i)
plt.errorbar(
sss,
coef * yyy_dat[:, 0],
yerr=coef * yyy_dat[:, 1],
linestyle="",
marker="o",
color="blue",
label=r"$<Simu>$",
)
plt.errorbar(sss, coef * yyy_fit[:, 0], color="red", label=r"$<Fit>$")
plt.xlabel(r"$|s| \, [h^{-1} Mpc]$")
plt.ylabel(r"$" + a + "\\xi(|s|)$")
myTools.deal_with_plot(False, False, True)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:60,代码来源:annalyseAllBAOFIT.py
示例2: compare_each_simu
def compare_each_simu():
pathSimu = '/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v_second_generation/Box_000/Simu_000/Data/'
rawPathSimu = '/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v_second_generation/'
chunckNb = 10
simulNb = 10
## Distribution redshift QSO
nb_qso = numpy.zeros(chunckNb*simulNb)
for i in range(0,chunckNb):
for j in range(0,simulNb):
catSimu = pyfits.open(rawPathSimu+'Box_00'+str(i)+'/Simu_00'+str(j)+'/Data/QSO_withRSD.fits',memmap=True)[1].data
nb_qso[i*10+j] = catSimu.size
print numpy.mean(nb_qso)
###
plt.errorbar(numpy.arange(chunckNb*simulNb),nb_qso,fmt='o')
plt.plot(numpy.arange(chunckNb*simulNb), numpy.ones(chunckNb*simulNb)*numpy.mean(nb_qso),color='red',label='Mean')
plt.xlabel(r'$Mock \, index$', fontsize=40)
plt.ylabel(r'$\# \, nb \, QSO$', fontsize=40)
plt.xlim( [-1,chunckNb*simulNb] )
myTools.deal_with_plot(False,False,True)
plt.show()
###
plt.hist(nb_qso)
plt.xlabel(r'$nb \, QSO$', fontsize=40)
plt.ylabel(r'$\#$', fontsize=40)
myTools.deal_with_plot(False,False,True)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:34,代码来源:compare_Data_Simu.py
示例3: plot
def plot():
if (forest__=='LYA'):
lines = LYA_lines
names = LYA_lines_names
if (forest__=='CIV'):
lines = CIV_lines
names = CIV_lines_names
if (forest__=='MGII'):
lines = MGII_lines
names = MGII_lines_names
if (forest__=='LYB'):
lines = LYB_lines
names = LYB_lines_names
if (forest__=='SIIV'):
lines = SIIV_lines
names = SIIV_lines_names
if (forest__=='LYA_JMC'):
lines = numpy.array([])
names = numpy.array([])
path = path__ +'xi_1DlRF_delta_delta_'+forest__+'.txt'
print path
data = numpy.loadtxt(path)
xxx = data[:,1]
yyy = data[:,1]
yer = data[:,]
### remove empty pixels
xxx = data[:,2][ (data[:,5]!=0.) ]/data[:,4][ (data[:,5]!=0.) ]
yyy = data[:,0][ (data[:,5]!=0.) ]/data[:,4][ (data[:,5]!=0.) ]
yer = numpy.sqrt( (data[:,1][ (data[:,5]!=0.) ]/data[:,4][ (data[:,5]!=0.) ] -yyy**2.)/data[:,5][ (data[:,5]!=0.) ] )
plt.errorbar(xxx, yyy, yerr=yer, marker='o')
### Show lines in the correlation
xMax = numpy.amax(xxx)
yMin = numpy.amin(yyy)
yMax = numpy.amax(yyy)
nbLines = lines.size
for i in range(0,nbLines):
for j in range(0,i):
#if (names[i][:3]!=forest__ and names[j][:3]!=forest__): continue
line = abs(lines[i]-lines[j])
if (line==0. or line>xMax): continue
xLi = [line,line]
yLi = [yMin,yMax]
name = names[i]+' - '+names[j]
plt.plot(xLi,yLi,color='green')
plt.text(line, yMax, name, rotation='vertical', fontsize=20)
plt.title(r'$1D: \, \delta_{'+forest__+'} \, - \, \delta_{'+forest__+'} $', fontsize=40)
plt.xlabel(r'$\Delta \lambda_{R.F.} \, [\AA]$', fontsize=40)
plt.ylabel(r'$\xi(\Delta \lambda_{R.F.})$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.xlim([ numpy.min(xxx)-10., numpy.max(xxx)+10. ])
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:60,代码来源:xi_1DlRF_delta_delta.py
示例4: loadBootMap
def loadBootMap():
'''
'''
path = '/home/gpfs/manip/mnt0607/bao/hdumasde/Results/Txt/map.txt'
data = numpy.loadtxt(path)
re = data[:,0].astype(int)
ra = data[:,1]
de = data[:,2]
for i in range(0,numpy.amax(re)+1):
cut = (re==i)
plt.plot(ra[cut], de[cut], linestyle="", marker="o")
#plt.xlim([0,360.])
#plt.ylim([-90.,90.])
plt.ticklabel_format(style='sci', axis='z', scilimits=(0,0))
plt.grid()
plt.xlabel(r'$R.A. (\degree)$')
plt.ylabel(r'$Dec. (\degree)$')
myTools.deal_with_plot(False,False,True)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:25,代码来源:Tests_diff_regions.py
示例5: plotWe
def plotWe(rescale):
a = ['0.8 < |\mu|', '0.5 < |\mu| \leq 0.8', '|\mu| \leq 0.5']
for i in range(0,3):
###
cut = (xiWe_[:,i,2]!=0.)
if (xiWe_[:,i,0][cut].size==0):
continue
xxx = xiWe_[:,i,0][cut]
yyy = xiWe_[:,i,1][cut]
yer = xiWe_[:,i,2][cut]
coef = numpy.power(xxx,rescale)
plt.errorbar(xxx, coef*yyy, yerr=coef*yer, fmt='o', label=r'$'+a[i]+'$')
if (rescale==0):
plt.ylabel(r'$\xi^{qf} (|s|)$', fontsize=40)
plt.legend(fontsize=30, frameon=False, numpoints=1,ncol=2, loc=4)
if (rescale==1):
plt.ylabel(r'$|s|.\xi^{qf} (|s|) \, [h^{-1}.Mpc]$', fontsize=40)
plt.legend(fontsize=30, frameon=False, numpoints=1,ncol=2, loc=4)
if (rescale==2):
plt.ylabel(r'$|s|^{2}.\xi^{qf} (|s|) \, [(h^{-1}.Mpc)^{2}]$', fontsize=40)
plt.legend(fontsize=30, frameon=False, numpoints=1,ncol=2, loc=2)
plt.title(r'$\delta_{'+forest1__+'} \, - \, '+qso1__+'$', fontsize=40)
plt.xlabel(r'$|s| \, [h^{-1}.Mpc]$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.xlim([ numpy.min(xxx)-10., numpy.max(xxx)+10. ])
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:35,代码来源:xi_delta_QSO_distortionMatrix.py
示例6: plotXi
def plotXi(rescale):
xxx = xi1D_[:,0]
yyy = xi1D_[:,1]
yer = xi1D_[:,2]
cut = (yer!=0.)
xxx = xxx[ cut ]
yyy = yyy[ cut ]
yer = yer[ cut ]
if (rescale==0):
plt.errorbar(xxx, yyy, yerr=yer, fmt='o')
plt.ylabel(r'$\xi^{qf} (|s|)$', fontsize=40)
if (rescale==1):
plt.errorbar(xxx, xxx*yyy, yerr=xxx*yer, fmt='o')
plt.ylabel(r'$|s|.\xi^{qf} (|s|) \, [h^{-1}.Mpc]$', fontsize=40)
if (rescale==2):
plt.errorbar(xxx, xxx*xxx*yyy, yerr=xxx*xxx*yer, fmt='o')
plt.ylabel(r'$|s|^{2}.\xi^{qf} (|s|) \, [(h^{-1}.Mpc)^{2}]$', fontsize=40)
plt.title(r'$\delta_{'+forest1__+'} \, - \, '+qso1__+'$', fontsize=40)
plt.xlabel(r'$|s| \, [h^{-1}.Mpc]$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.xlim([ numpy.min(xxx)-10., numpy.max(xxx)+10. ])
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:28,代码来源:xi_delta_QSO_distortionMatrix.py
示例7: plotXi
def plotXi():
xxx = xi1D_[:,0]
yyy = xi1D_[:,1]
yer = xi1D_[:,2]
cut = (yer!=0.)
xxx = xxx[ cut ]
yyy = yyy[ cut ]
yer = yer[ cut ]
yMin = numpy.min(yyy)
yMax = numpy.max(yyy)
nbLines = lines.size
for i in range(0,nbLines):
for j in range(0,i):
if ( lines[i]!=lambdaRFLine and lines[j]!=lambdaRFLine ): continue
line = max( lines[i]/lines[j], lines[j]/lines[i])
if (line<min1D__ or line>max1D__): continue
xLi = [line,line]
yLi = [yMin,yMax]
name = names[i] + ' - ' + names[j]
plt.plot(xLi,yLi,color='green',linewidth=2)
plt.text(line, yMax, name, rotation='vertical', fontsize=20)
plt.errorbar(xxx, yyy, yerr=yer, fmt='o')
plt.ylabel(r'$\xi^{ff}$', fontsize=40)
plt.xlabel(r'$\lambda_{Obs.,2}/\lambda_{Obs.,1}$', fontsize=40)
plt.xlim([ min1D__-0.01, max1D__+0.01 ])
myTools.deal_with_plot(False,False,False)
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:32,代码来源:xi_A_delta_delta_lambda.py
示例8: plot_1d
def plot_1d(self,x_power=0):
xxx = self._xi0[:,0]
yyy = self._xi0[:,1]
coef = numpy.power(xxx,x_power)
plt.errorbar(xxx,coef*yyy,fmt='o')
xxx = self._xi2[:,0]
yyy = self._xi2[:,1]
coef = numpy.power(xxx,x_power)
plt.errorbar(xxx,coef*yyy,fmt='o')
xxx = self._xi4[:,0]
yyy = self._xi4[:,1]
coef = numpy.power(xxx,x_power)
plt.errorbar(xxx,coef*yyy,fmt='o')
if (x_power==0):
plt.ylabel(r'$ \xi (|s|)$', fontsize=40)
if (x_power==1):
plt.ylabel(r'$|s|.\xi (|s|) \, [h^{-1}.Mpc]$', fontsize=40)
if (x_power==2):
plt.ylabel(r'$|s|^{2}.\xi (|s|) \, [(h^{-1}.Mpc)^{2}]$', fontsize=40)
plt.xlabel(r'$|s| \, [h^{-1}.Mpc]$', fontsize=40)
plt.xlim([ numpy.amin(xxx)-10., numpy.amax(self._xi0[:,0])+10. ])
myTools.deal_with_plot(False,False,False)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:29,代码来源:CAMB.py
示例9: fit_CAMB
def fit_CAMB(self,distortion=False,dic=None):
### Get the data
xxx = self._xi[:,0]
yyy = self._xi[:,1]
yer = self._xi[:,2]
xMin = numpy.amin(xxx)
xMax = numpy.amax(xxx)
### Get CAMB
camb = CAMB.CAMB(dic)._xi0
xxx_Camb = copy.deepcopy(xxx)
yyy_Camb = numpy.interp(xxx,camb[:,0],camb[:,1])
if (distortion):
path = self._path_to_txt_file_folder + self._prefix + '_distortionMatrix_'+ self._middlefix + '.txt'
matrix = numpy.loadtxt(path)
xxx_Camb = numpy.append(xxx_Camb,numpy.zeros(2100-xxx.size) )
yyy_Camb = numpy.append(yyy_Camb,numpy.zeros(2100-yyy_Camb.size) )
yyy_Camb = numpy.dot(matrix,yyy_Camb)
yyy_Camb = yyy_Camb[(xxx_Camb!=0.)]
xxx_Camb = xxx_Camb[(xxx_Camb!=0.)]
b = 0.15
#b = 0.05
'''
### Chi^{2}
def chi2(b):
model = yyy_Camb*b
return numpy.sum( numpy.power( (yyy-model)/yer ,2.) )
### Init and perform the fit
m = Minuit(chi2, b=1.,error_b=0.1,print_level=-1, errordef=0.01)
m.migrad()
b = m.values['b']
#b = 0.01
print b
'''
for i in numpy.arange(1):
coef = numpy.power(xxx,i)
plt.errorbar(xxx, coef*yyy, yerr=coef*yer, fmt='o',color='blue')
coef = numpy.power(xxx_Camb,i)
plt.errorbar(xxx_Camb,coef*b*yyy_Camb,color='red')
plt.title(r'$'+self._title+'$', fontsize=40)
plt.xlabel(r'$'+self._xTitle+'$', fontsize=40)
plt.ylabel(r'$'+self._yTitle+'$', fontsize=40)
if (self._correlation=='f_f_r' or self._correlation=='f_f2_r' or self._correlation=='f_f_lRF' or self._correlation=='f_f_lRF'):
plt.xlim([ numpy.min(xxx)-10., numpy.max(xxx)+10. ])
if (self._correlation=='f_f_lRF_devide' or self._correlation=='f_f2_lRF_devide'):
plt.xlim([ 0.99*xMin, 1.01*xMax ])
myTools.deal_with_plot(False,False,False)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:60,代码来源:correlation_1D.py
示例10: plotXi
def plotXi(rescale):
cut = (xi1D_[:,2] != 0.)
xxx = xi1D_[:,0][cut]
yyy = xi1D_[:,1][cut]
yer = xi1D_[:,2][cut]
#yyy -= yyy[-1]
if (rescale==0):
plt.errorbar(xxx, yyy, yerr=yer, fmt='o')
plt.ylabel(r'$\xi^{ff} (|s|)$', fontsize=40)
if (rescale==1):
plt.errorbar(xxx, xxx*yyy, yerr=xxx*yer, fmt='o')
plt.ylabel(r'$|s|.\xi^{ff} (|s|) \, [h^{-1}.Mpc]$', fontsize=40)
if (rescale==2):
plt.errorbar(xxx, xxx*xxx*yyy, yerr=xxx*xxx*yer, fmt='o')
plt.ylabel(r'$|s|^{2}.\xi^{ff} (|s|) \, [(h^{-1}.Mpc)^{2}]$', fontsize=40)
plt.title(r'$\delta_{'+forest__+'} \, - \, \delta_{'+forest__+'}$', fontsize=40)
plt.xlabel(r'$|s| \, [h^{-1}.Mpc]$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.xlim([ numpy.min(xxx)-10., numpy.max(xxx)+10. ])
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:27,代码来源:xi_A_delta_delta.py
示例11: difTemplate
def difTemplate():
'''
Look at the differences between the templates
'''
path = "/home/gpfs/manip/mnt0607/bao/hdumasde/Results/Txt/chain_annalys_delta/"
data1 = numpy.loadtxt(path + 'template_0_0.txt')
templateData1 = interpolate.interp1d(data1[:,0],data1[:,1],bounds_error=False,fill_value=0)
plt.errorbar(data1[:,0], data1[:,1]/templateData1(1150.), fmt='o', label=r'$Simu$',color='red')
data = numpy.loadtxt(path + 'template.txt')
templateData = interpolate.interp1d(data[:,0],data[:,1],bounds_error=False,fill_value=0)
plt.errorbar(data[:,0], data[:,1]/templateData(1150.), fmt='o', label=r'$Data$',color='blue')
data3 = numpy.loadtxt(path + 'template_0_0_MocksColab.txt')
templateData3 = interpolate.interp1d(data3[:,0],data3[:,1],bounds_error=False,fill_value=0)
plt.errorbar(data3[:,0], data3[:,1]/templateData3(1150.), fmt='o', label=r'$Mock \, colab$',color='green')
plt.title(r'$Template$', fontsize=40)
plt.xlabel(r'$\lambda_{R.F.} \, [\AA]$', fontsize=40)
plt.ylabel(r'$f(\lambda_{R.F.}) / f(1150.)$', fontsize=40)
myTools.deal_with_plot(False,False,True)
plt.show()
plt.errorbar(data[:,0], (data1[:,1]/templateData1(1150.)-data[:,1]/templateData(1150.))/(data1[:,1]/templateData1(1150.)) , fmt='o')
plt.xlabel(r'$\lambda_{R.F.} \, [\AA]$', fontsize=40)
plt.ylabel(r'$( (f(\lambda_{R.F.}) / f(1150.))_{Data} - (f(\lambda_{R.F.}) / f(1150.))_{Simu} ) / (f(\lambda_{R.F.}) / f(1150.))_{Data})$', fontsize=40)
myTools.deal_with_plot(False,False,True)
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:34,代码来源:testThings.py
示例12: getQsoCatalogueAllObjects
def getQsoCatalogueAllObjects():
'''
'''
path = '/home/gpfs/manip/mnt0607/bao/hdumasde/Data/Catalogue/'
listPAth = [path+'QSO_DR7_DR12_EBOSS_2016_01_08.fits',
path+'DLA_all.fits',
path+'all_Britt.fits',
path+'VIPERS.fits',
path+'QSO_3DHST.fits',
path+'LOWZ_all.fits',
path+'CMASS_all.fits']
name = ['QSO','DLA','Britt','VIPERS','3DHST','LOWZ','CMASS']
## Distribution redshift
for i in numpy.arange(len(listPAth)):
cat = pyfits.open(listPAth[i], memmap=True )[1].data
cat = cat[ (cat['Z']>0.1) ]
cat = cat[ (cat['Z']<7.) ]
if (cat.size==0): continue
plt.hist(cat['Z'], bins=100,histtype='step',label=name[i])
plt.xlabel("Z")
plt.ylabel("#")
myTools.deal_with_plot(False,False,True)
plt.show()
### Merge everyThing
cat = pyfits.open(listPAth[0], memmap=True )[1].data
ra = cat['RA']
de = cat['DEC']
zz = cat['Z']
for i in numpy.arange(1,len(listPAth)):
cat = pyfits.open(listPAth[i], memmap=True )[1].data
ra = numpy.append(ra, cat['RA'])
de = numpy.append(de, cat['DEC'])
zz = numpy.append(zz, cat['Z'])
## Map
plt.ticklabel_format(style='sci', axis='z', scilimits=(0,0))
plt.grid()
plt.plot(ra, de, linestyle="", marker="o")
plt.xlabel("Right Ascension (degree)")
plt.ylabel("Declination (degree)")
plt.show()
## Distribution redshift
plt.ticklabel_format(style='sci', axis='z', scilimits=(0,0))
plt.grid()
plt.hist(zz, bins=200)
plt.xlabel("Z")
plt.ylabel("#")
plt.show()
### Save
col_ra = pyfits.Column(name='RA', format='D', array=ra, unit='deg')
col_de = pyfits.Column(name='DEC', format='D', array=de, unit='deg')
col_zz = pyfits.Column(name='Z', format='D', array=zz)
tbhdu = pyfits.BinTableHDU.from_columns([col_ra, col_de, col_zz])
tbhdu.writeto('/home/gpfs/manip/mnt0607/bao/hdumasde/Data/Catalogue/ALL_EVERY_OBJECTS_2016_01_08.fits', clobber=True)
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:60,代码来源:main.py
示例13: plotXi
def plotXi():
xxx = xi1D_[:,0]
yyy = xi1D_[:,1]
yer = xi1D_[:,2]
cut = (yer!=0.)
xxx = xxx[ cut ]
yyy = yyy[ cut ]
yer = yer[ cut ]
yMin = numpy.min(yyy)
yMax = numpy.max(yyy)
nbLines = lines.size
for i in range(0,nbLines):
line = lines[i]/lambdaRFLine
if (line<min1D__ or line>max1D__): continue
#print ' || QSO - ', names[i], ' || ', line, ' || ', lambdaRFLine, ' || ', lines[i], ' || '
xLi = [line,line]
yLi = [yMin,yMax]
name = 'QSO - ' + names[i]
plt.plot(xLi,yLi,color='green',linewidth=2)
plt.text(line, 0.7*yMin, name, rotation='vertical', fontsize=20)
plt.errorbar(xxx, yyy, yerr=yer, fmt='o')
plt.ylabel(r'$\xi^{qf} \, (\theta<'+str(maxTheta_)+' \, rad)$', fontsize=40)
plt.xlabel(r'$\lambda_{Obs., pix}/\lambda_{Obs., QSO}$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:31,代码来源:xi_delta_QSO_lambda.py
示例14: plot_histo_residuals
def plot_histo_residuals(self, other=[]):
### Constants
nbBins=100
list_of_fit = numpy.append( [self],other )
### histo
fig = plt.figure()
ax = fig.add_subplot(111)
for el in list_of_fit:
yyy = numpy.array([])
for el in self._listFit:
xi2D = el.get_residuals()
tmp_yyy = (xi2D[:,:,1][ (xi2D[:,:,2]>0.) ]).flatten()
yyy = numpy.append(yyy,tmp_yyy)
ax.hist(yyy, bins=nbBins, histtype='step', linewidth=2,alpha=0.6)
plt.xlabel(r'$\frac{data-fit}{\sigma_{data}}$')
plt.ylabel(r'$\#$')
myTools.deal_with_plot(False,False,False)
mng = plt.get_current_fig_manager()
textstr = '$nb=%u$\n$\mu=%.5e$\n$\sigma=%.5e$'%(yyy.size, numpy.mean(yyy), numpy.std(yyy))
props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
ax.text(0.05, 0.95, textstr, transform=ax.transAxes, fontsize=30, verticalalignment='top', bbox=props)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:32,代码来源:annalyse_many_BAOFIT.py
示例15: plotDataAndFit_1D
def plotDataAndFit_1D():
"""
"""
if type__ == "1D":
xxx = numpy.arange(0.0, nbBin__) * 4.0 + 2.0
xxx[(xxx__ != 0.0)] = xxx__[(xxx__ != 0.0)]
b = "|s|"
elif type__ == "2D":
xxx = numpy.arange(0.0, nbBin__)
b = "s"
for i in numpy.arange(0, 3):
if i == 0:
a = ""
c = ""
elif i == 1:
a = "|s|."
c = " \, [h^{-1}.Mpc]"
else:
a = "|s|^{2}."
c = " \, [(h^{-1}.Mpc)^{2}]"
coef = numpy.power(xxx__, 1.0 * i)
plt.errorbar(xxx, coef * xi_dat__, yerr=coef * xi_err__, linestyle="", marker="o", color="blue")
plt.errorbar(xxx, coef * xi_fit__, color="red")
plt.xlabel(r"$" + b + " \, [h^{-1}.Mpc] $")
plt.ylabel(r"$" + a + "\\xi(" + b + ") " + c + "$")
myTools.deal_with_plot(False, False, True)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:34,代码来源:annalyseAllBAOFIT.py
示例16: seePowerSpectrum
def seePowerSpectrum():
'''
'''
### Constants
pathToPk = '/home/gpfs/manip/mnt0607/bao/hdumasde/Code/Python/CreateRandomField/DR9LyaMocks_matterpower.dat'
### Get the power spectra
pk = scipy.loadtxt(pathToPk)
pkInterpolate = interpolate.interp1d(pk[:,0],pk[:,1],bounds_error=False,fill_value=0)
for i in numpy.arange(3):
coef = numpy.power(pk[:,0],i)
yLabel = 'P(k)'
if (i==1):
yLabel = 'k.' + yLabel + '\, [h/Mpc]'
elif (i==2):
yLabel = 'k^{2}.' + yLabel + '\, [(h/Mpc)^{2}]'
plt.plot(pk[:,0],coef*pk[:,1],marker='o')
plt.xlabel(r'$k \, [h/Mpc]$', fontsize=40)
plt.ylabel(r'$'+yLabel+'$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:25,代码来源:test.py
示例17: plot
def plot(xi1D):
if (forest__=='LYA'):
lines = LYA_lines
names = LYA_lines_names
if (forest__=='CIV'):
lines = CIV_lines
names = CIV_lines_names
if (forest__=='MGII'):
lines = MGII_lines
names = MGII_lines_names
if (forest__=='LYB'):
lines = LYB_lines
names = LYB_lines_names
if (forest__=='SIIV'):
lines = SIIV_lines
names = SIIV_lines_names
xxx = xi1D[:,0]
yyy = xi1D[:,1]
yer = xi1D[:,2]
### Show lines in the correlation
xMax = numpy.amax(xxx)
yMin = numpy.amin(yyy)
yMax = numpy.amax(yyy)
nbLines = lines.size
for i in range(0,nbLines):
for j in range(0,i):
#if (names[i][:3]!=forest__ and names[j][:3]!=forest__): continue
line = lines[j]/lines[i]
#isPresent = False
#for k in strongLines_CIV:
# if (abs(line-k)<=0.00005): isPresent = True
#if (not isPresent): continue
line = numpy.abs( find_dist_correlation_lines(meanZ__,lines[j],lines[i]) )
if (line>xMax): continue
#print line
xLi = [line,line]
yLi = [yMin,yMax]
name = names[i]+' - '+names[j]
plt.plot(xLi,yLi,color='green')
plt.text(line, yMax, name, rotation='vertical', fontsize=20)
plt.errorbar(xxx,yyy, yerr=yer, fmt='o')
plt.title(r'$1D: \, \delta_{'+forest__+'} \, - \, \delta_{'+forest__+'} $', fontsize=40)
plt.xlabel(r'$s \, [h^{-1}.Mpc]$', fontsize=40)
plt.ylabel(r'$\xi (s)$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.xlim([ numpy.min(xxx)-10., numpy.max(xxx)+10. ])
plt.show()
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:59,代码来源:xi_1D_delta_delta.py
示例18: plotCovarDifferentMethod
def plotCovarDifferentMethod():
'''
'''
dim = '1D'
path = '/home/gpfs/manip/mnt0607/bao/hdumasde/Results/Txt/FitsFile_DR12_Guy/'
listPath = [ path+'subSampling_LYA_QSO_cov_'+dim+'.npy',
path+'shuffleQSO_LYA_QSO_cov_'+dim+'.npy',
path+'randomQSO_LYA_QSO_cov_'+dim+'.npy',
path+'shuffleForest_LYA_QSO_cov_'+dim+'.npy',
'/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v1547/Results_RandomPosInCell/xi_delta_QSO_result_cov_'+dim+'.npy',
'/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v1547/Results_RandomPosInCell/xi_delta_QSO_result_cov_'+dim+'_meanSubSampling.npy',
]
listPath2 = [ path+'subSampling_LYA_QSO_'+dim+'.npy',
path+'shuffleQSO_LYA_QSO_'+dim+'.npy',
path+'randomQSO_LYA_QSO_'+dim+'.npy',
path+'shuffleForest_LYA_QSO_'+dim+'.npy',
'/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMLG/v1547/Results_RandomPosInCell/xi_delta_QSO_result_'+dim+'.npy',
]
listName = ['Data \, subsampling',
'Data \, shuffle \, QSO',
'Data \, random \, QSO',
'Data \, shuffle \, forest',
'Mocks',
'< Mock \, subsampling >',
]
real = [ numpy.load(i) for i in listPath2 ]
cov = [ numpy.load(i) for i in listPath ]
### Plot the realisation
for i in numpy.arange(len(real)):
print listName[i]
for j in numpy.arange(real[i][0,:].size):
plt.errorbar(numpy.arange(real[i][:,j].size), real[i][:,j],fmt='o',color='blue',alpha=0.1)
plt.errorbar(numpy.arange(real[i][:,j].size), numpy.mean(real[i],axis=1),fmt='o',color='red',label=r'$Mean$')
plt.xlabel(r'$bin \, index$', fontsize=40)
plt.ylabel(r'$\xi(|s|)$', fontsize=40)
plt.title(r'$'+listName[i]+'$', fontsize=40)
myTools.deal_with_plot(False,False,True)
plt.xlim([ -1., cov[i][0,:].size+1 ])
plt.show()
### Plot diagonal
for i in numpy.arange(len(cov)):
plt.errorbar(numpy.arange(cov[i][0,:].size), numpy.diag(cov[i]),fmt='o',label=r'$'+listName[i]+'$')
plt.xlabel(r'$bin \, index$', fontsize=40)
plt.ylabel(r'$Var(|s|)$', fontsize=40)
myTools.deal_with_plot(False,False,True)
plt.xlim([ -1., cov[i][0,:].size+1 ])
plt.show()
myTools.plotCovar(cov,listName)
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:58,代码来源:xi_delta_QSO.py
示例19: plot_given_2d
def plot_given_2d(self, x_power=0, xi2D=None, label=None):
if xi2D is None:
print " annalyseBAOFIT::plot_2d:: xi2D==None"
xi2D = self._xi2D
if label is None:
label = self._label
origin = "lower"
extent = [self._minX2D, self._maxX2D, self._minY2D, self._maxY2D]
if self._correlation == "q_f" or self._correlation == "f_f2":
origin = "upper"
extent = [self._minX2D, self._maxX2D, self._maxY2D, self._minY2D]
xxx = numpy.transpose(xi2D[:, :, 0])
yyy = numpy.transpose(xi2D[:, :, 1])
yer = numpy.transpose(xi2D[:, :, 2])
cut = yer == 0
if xxx[cut].size == xxx.size:
return
yyy[cut] = float("nan")
coef = numpy.power(xxx, x_power)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xticks([i for i in numpy.arange(self._minX2D - 50.0, self._maxX2D + 50.0, 50.0)])
ax.set_yticks([i for i in numpy.arange(self._minY2D - 50.0, self._maxY2D + 50.0, 50.0)])
plt.imshow(coef * yyy, origin=origin, extent=extent, interpolation="None")
cbar = plt.colorbar()
if x_power == 0:
cbar.set_label(r"$" + label + "(r_{\parallel},r_{\perp})$", size=40)
if x_power == 1:
cbar.set_label(r"$r \cdot " + label + "(r_{\parallel},r_{\perp}) \, [\\rm{h}^{-1} \, \\rm{Mpc}]$", size=40)
if x_power == 2:
cbar.set_label(
r"$r^{2} \cdot " + label + "(r_{\parallel},r_{\perp}) \, [(\\rm{h}^{-1} \, \\rm{Mpc})^{2}]$", size=40
)
# plt.plot( [0.,200.],[0.,4*200.],color='white',linewidth=2 )
# plt.plot( [0.,200.],[0.,-4*200.],color='white',linewidth=2 )
# plt.plot( [0.,200.],[0.,200.],color='white',linewidth=2 )
# plt.plot( [0.,200.],[0.,-200.],color='white',linewidth=2 )
# plt.title(r'$'+self._title+'$', fontsize=40)
plt.xlabel(r"$r_{\perp} \, [\rm{h}^{-1} \, \rm{Mpc}]$", fontsize=40)
plt.ylabel(r"$r_{\parallel} \, [\rm{h}^{-1} \, \rm{Mpc}]$", fontsize=40)
plt.grid(True)
cbar.formatter.set_powerlimits((0, 0))
cbar.update_ticks()
myTools.deal_with_plot(False, False, False)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:57,代码来源:annalyse_pyLyA.py
示例20: haveAlookForest
def haveAlookForest():
cat = pyfits.open('/home/gpfs/manip/mnt0607/bao/hdumasde/Mock_JMc/new_mock_1280_0_0.fits', memmap=True)[1].data
print cat.size
print numpy.amin(cat['RA']), numpy.amax(cat['RA'])
print numpy.amin(cat['DEC']), numpy.amax(cat['DEC'])
print numpy.amin(cat['Z_VI']), numpy.amax(cat['Z_VI'])
ar_cut = (cat['NORM_FLUX_IVAR']>0.)
ar_lambdaObs = cat['LAMBDA_OBS'][ ar_cut ]
ar_lambdaRF = cat['LAMBDA_RF'][ ar_cut ]
ar_flux = cat['NORM_FLUX'][ ar_cut ]
ar_zi = cat['LAMBDA_OBS'][ ar_cut ]/(lambdaRFLine__) -1.
ar_weight = cat['DELTA_WEIGHT'][ ar_cut ] #numpy.ones(shape=(cat.size,cat['NORM_FLUX'][0].size))[ ar_cut ]
print numpy.amin(ar_zi), numpy.amax(ar_zi)
### deltaLoglambda (mock_JMc) = 0.00023025850929947467
### deltaLoglambda (data) = 0.00023002222870971423
### deltaLoglambda (mock Julian) = 0.00023002222870971423,
### delta vs. lambda_RF
xxx, yyy, eyyy, nyyy = myTools.Get_TProfile(ar_lambdaRF,ar_flux, lambdaRFTemplateBinEdges__, ar_weight)
plt.errorbar(xxx, yyy, yerr=eyyy, marker="o")
plt.xlabel(r'$\lambda_{R.F.} \, [\AA]$', fontsize=40)
plt.ylabel(r'$flux$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.show()
### delta vs. lambda_RF
xxx, yyy, eyyy, nyyy = myTools.Get_TProfile(ar_lambdaObs,ar_flux, lambdaObsBinEdges__, ar_weight)
plt.errorbar(xxx, yyy, yerr=eyyy, marker="o")
plt.xlabel(r'$\lambda_{R.F.} \, [\AA]$', fontsize=40)
plt.ylabel(r'$flux$', fontsize=40)
myTools.deal_with_plot(False,False,False)
plt.show()
### Distribution redshift
plt.hist(ar_zi, bins=50)
plt.xlabel(r'$z_{pixel}$')
plt.ylabel(r'$\#$')
myTools.deal_with_plot(False,False,False)
plt.show()
### Map
plt.plot(cat['RA'],cat['DEC'], linestyle="", marker="o")
plt.xlabel(r'$X [Mpc]$')
plt.ylabel(r'$Y [Mpc]$')
myTools.deal_with_plot(False,False,False)
plt.show()
### Distribution redshift
plt.hist(cat['Z_VI'], bins=50)
plt.xlabel(r'$z_{qso}$')
plt.ylabel(r'$\#$')
myTools.deal_with_plot(False,False,False)
plt.show()
return
开发者ID:londumas,项目名称:CrossCorrelation,代码行数:55,代码来源:test_JMc.py
注:本文中的myTools.deal_with_plot函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论