Example #1
0
def plotSkew(dgps):
    global FII
    cls=['$c_l$','$b$','$c_l$','$c_l$','$c_l$','$c_l$']
    figure(size=3,aspect=0.6)
    for h in range(len(dgps)):
        try:D=dgps[h].loadData(i=2,j=2)
        except FileNotFoundError: continue
        x=dgps[h].cl
        for g in range(3):
            ax=subplot(3,len(dgps),1+h+g*len(dgps))
            plt.grid(axis='x')
            if g==0: 
                plt.title(DLBLS[h])
                y=np.median(D[:,:,6],axis=1)*[1,0.1][dgps[h].suf=='BE']
            elif g==1: y=np.median(D[:,:,7],axis=1)
            elif g==2: y=np.median(D[:,:,23],axis=1)
            plt.plot(x,y,CLRS[-1],lw=LWS[1])
            if g==0: plt.ylim([0,1])
            elif g==1: plt.ylim([[0,10],[0,0.01],[0,3],[0,6],[0,0.1],[0,0.06]][h])
            elif g==2: plt.ylim([[0,3],[0,3],[0,8],[0,3],[0,3],[-3,3]][h])
            if g<2: ax.set_xticklabels([])
            else: plt.xlabel(cls[h])
            plt.xlim([x[0],x[-1]])
            ax.locator_params(axis='x', nbins=4,min_n_ticks=3)
            if not h: plt.ylabel(['Mean','Variance','Skewness'][g])
            elif g==0: ax.set_yticklabels([])
            elif g==1:
                lm=[0,-3,0,0,-2,-2][h]
                if lm!=0: ax.ticklabel_format(axis='y',style='sci',scilimits=(lm,lm))
    if FII>=0:
        fn='fig%02d.%s'%(FII,FIGFMT)
        FII+=1
    else: fn=FIGLBLS[0]+'png'            
    plt.savefig(FIGDIR+fn,bbox_inches='tight',dpi=DPI,format=FIGFMT)
    plt.clf();plt.close()
Example #2
0
def plotPDF(A,B,C,pdf,xmax=1,albls=['','','test']):
    C=np.linspace(C[0],C[-1],6)
    x=np.linspace(0,xmax,101)
    figure(size=3,aspect=1)
    def _hlp(A,i):
        if A.size>1 and xmax>0: return '%.2f'%A[i]
        else: return ''
    for i in range(A.size):
        for j in range(B.size):
            for h in range(C.size):
                ax=subplot(A.size,B.size,B.size*i+1+j)
                try:
                    if xmax>0: y=pdf(x,A[i],B[j],C[h])
                    else: y,x=pdf(A[i],B[j],C[h])
                except AssertionError: continue
                plt.plot(x,y,'k',alpha=0.2)
                plt.ylim([0,1])
                ax.set_yticks([0,1])
                if j>0: ax.set_yticklabels([])
                else: plt.ylabel(albls[0]+_hlp(A,i))
                if i+1<A.size: ax.set_xticklabels([])
                else: plt.xlabel(albls[1]+_hlp(B,j))
                plt.grid(False)
    plt.savefig(SUPDIR+albls[-1]+'prob',format=FIGFMT,     
        bbox_inches='tight',dpi=DPI)
    plt.clf();plt.close()
Example #3
0
def plotXtypes(S):
    global FII
    figure(size=2,aspect=0.4)
    lbls=['No X','Ballanced','Uncrossed','Crossed','Double-crossed']
    for i in range(5):
        s=S[i+2]
        ax=subplot(1,5,i+1)
        plt.plot([0,1],s[:2],'-o')
        plt.plot([0,1],s[2:],'-o')
        ax.set_xticks([0,1])
        ax.set_xticklabels(['G1','G2'])
        plt.ylim([-4.5,0.5])
        plt.xlim([-0.25,1.25])
        if i>0: ax.set_yticklabels([])
        else: 
            #plt.legend(['F1','F2'])
            plt.ylabel('$d$')
        plt.xlabel(lbls[i])
    if FII>=0:
        fn='fig%02d.%s'%(FII,FIGFMT)
        FII+=1
    else: fn='xtypes.png'
    plt.savefig(FIGDIR+fn,bbox_inches='tight',dpi=DPI,format=FIGFMT)
    plt.clf()
    plt.close()
Example #4
0
 def makeSupplement(self):
     print(self.suf+'creating supplement')
     #plotPDF(self.np1,self.np2,self.cl,self.pdf,xmax=self.xmax,
     #    albls=['$c_l^\Delta=$','$%s=$'%self.np2lbl,self.suf])
     #tref=(self.cld[0,1]-self.cld[0,0])*np.ones(self.cl.shape)
     n1=self.np1.size;n2=self.np2.size
     for f in range(1,7):
         plt.close('all')
         figure(num=f+1,size=3,aspect=1)
         for i in range(n1):
             for j in range(n2):
                 R=self.loadData(i=i,j=j)
                 ax=subplot(n1,n2,i*n2+j+1)
                 #plt.title(getTitle(i,j))
                 plt.grid(axis='x')
                 plt.ylim([-0.05,1.05])
                 x=np.load(DPATH+'cl_'+self.suf+'.npy')
                 legon= (i==0 and j==0)
                 if f==1:
                     plotCI(x,R)
                     tref=(self.cld[0,1]-self.cld[0,0])*self.np1[i]
                     plt.plot(x,tref*np.ones(x.size),'c')
                     plt.ylim(self.cil[i])
                 elif f==2:  
                     plotCohendCI(x,R,ylim=self.cil[i+5])
                 elif f==3:plotNHST(x,R[:,:,8:12],legon)
                 elif f==4:plotANOVA1F(x,R[:,:,18:22],legon)
                 elif f==5:plotTOST(x,R[:,:,12:16],legon)
                 elif f==6:plotBFT(x,R[:,:,16:18],legon)
                 plt.xlim([x[0],x[-1]])
                 if j!=0:ax.set_yticklabels([])
                 else:plt.ylabel('$c_l^\Delta=%.2f$'%self.np1[i])
                 if i!=n1-1: ax.set_xticklabels([])
                 else:
                     temp=(self.np2lbl,self.np2[j])
                     plt.xlabel('$%s=%.2f$'%temp)
         plt.savefig(SUPDIR+self.suf+FIGLBLS[f],
             dpi=DPI,bbox_inches='tight',format=FIGFMT)
         plt.clf();plt.close()
Example #5
0
def plotFcfe():
    global FII
    figure(size=1,aspect=0.6)
    x=np.linspace(0,1,101)[1:-1]
    fl=[-np.log(x),-np.log(x/(1-x))]
    fu=[-np.log(1-x),-np.log((1-x)/x)]
    for i in range(2):
        ax=subplot(1,2,1+i)
        plt.plot(x,fl[i])
        plt.plot(x,fu[i])
        plt.xlabel('$g[\phi]$')
        #if not i:plt.ylabel('$f(\phi)$')
        plt.text(0.25,3,'$f_l(g)$',horizontalalignment='center')
        plt.text(0.65,4.1,'$f_u(1-g)$',horizontalalignment='center')
        ttl=['$-\log x$','$-\log(x/(1-x))$'][i]
        #plt.legend(['$f_l(\phi)$','$f_u(1-\phi)$'])
        plt.title(ttl,fontsize=10) 
    if FII>=0:
        fn='fig%02d.%s'%(FII,FIGFMT)
        FII+=1
    else: fn='fcfe.png'
    plt.savefig(FIGDIR+fn,bbox_inches='tight',dpi=DPI)
    plt.clf();plt.close()