def condense_node(self,index):
        qnode=self.qlist[index]
        print qnode.q
        #print qnode.th

        a3=[]
        counts=[]
        counts_err=[]
        monlist=[]
        for mydataitem in qnode.th:
            mydata=mydataitem.data
            monlist.append(mydata.metadata['count_info']['monitor'])
            counts_err.append(N.array(mydata.data['counts_err']))
            counts.append(N.array(mydata.data['counts']))
            a3.append(N.array(mydata.data['a3']))
        a3_out,counts_out,counts_err_out=simple_combine(a3,counts,counts_err,monlist)

        #print a3_out.shape
        #print counts_out.shape
        #print counts_err_out.shape
        qnode.th_condensed={}
        qnode.th_condensed['a3']=a3_out
        qnode.th_condensed['counts']=counts_out
        qnode.th_condensed['counts_err']=counts_err_out

        print qnode.th_condensed['counts'].std()
        print qnode.th_condensed['counts'].mean()
        print qnode.th_condensed['counts'].max()
        print qnode.th_condensed['counts'].min()
        if 0:
            pylab.errorbar(a3_out,counts_out,counts_err_out,marker='s',linestyle='None',mfc='black',mec='black',ecolor='black')
            pylab.show()
        return
    def condense_node(self,index):
        qnode=self.qlist[index]
        print qnode.q
        #print qnode.th

        a3=[]
        counts=[]
        counts_err=[]
        monlist=[]
        for mydataitem in qnode.th:
            mydata=mydataitem.data
            monlist.append(mydata.metadata['count_info']['monitor'])
            counts_err.append(N.array(mydata.data['counts_err']))
            counts.append(N.array(mydata.data['counts']))
            a3.append(N.array(mydata.data['a3']))
        a3_out,counts_out,counts_err_out=simple_combine(a3,counts,counts_err,monlist)

        #print a3_out.shape
        #print counts_out.shape
        #print counts_err_out.shape
        qnode.th_condensed={}
        qnode.th_condensed['a3']=a3_out
        qnode.th_condensed['counts']=counts_out
        qnode.th_condensed['counts_err']=counts_err_out

        print qnode.th_condensed['counts'].std()
        print qnode.th_condensed['counts'].mean()
        print qnode.th_condensed['counts'].max()
        print qnode.th_condensed['counts'].min()
        if 0:
            pylab.errorbar(a3_out,counts_out,counts_err_out,marker='s',linestyle='None',mfc='black',mec='black',ecolor='black')
            pylab.show()       
        return 
Beispiel #3
0
    Icalc=orderparameter(p,T)
    residual=(I-Icalc)/Ierr
    return residual

if __name__=='__main__':
    mydirectory=r'c:\camn2sb2\bt9\Feb5_2008'
    myfilebase='order*'
    myend='bt9'
    temp,I,Ierr,monlist=read_order_files(mydirectory,myfilebase,myend)
##    print 'read '
##    print 'temp ',temp
##    print 'I',I
##    print Ierr
##    print 'monlist ' ,monlist
##    print len(I),len(monlist)
    T,I,Ierr=simple_combine.simple_combine(temp,I,Ierr,monlist)
    #print temp.shape, I.shape, Ierr.shape
    #pylab.errorbar(temp,I,Ierr,marker='s',linestyle='None',mfc='red',mec='red',ecolor=None)
    p0=[copy.deepcopy(I[0]),84.0,.33333,copy.deepcopy(I[-1])]
    tmin=30
    tmax=100
    Trange=N.intersect1d(N.where(T>tmin)[0],N.where(T<tmax)[0])
    oparam=scipy.odr.Model(orderparameter)
    mydata=scipy.odr.RealData(T[Trange],I[Trange],sx=None,sy=Ierr)
    myodr = scipy.odr.ODR(mydata, oparam, beta0=p0)
    myoutput=myodr.run()
    myoutput.pprint()
    pfit=myoutput.beta
    #pfit = leastsq(residuals, p0, args=(T[Trange],I[Trange],Ierr[Trange]))
    print 'pfit=',pfit
    print 'chisq=',chisq_calc(pfit,T[Trange],I[Trange],Ierr[Trange]).sum()
Beispiel #4
0
 print 'delta= ',delta
 a4_high,I_high,Ierr_high,Tstiched_high,mon_stiched_high=get_highT_file()
 a4_low,I_low,Ierr_low,Tstiched_low,mon_stiched_low=get_lowT_file()
 a4_high_max=max(a4_high)
 a4_high_min=min(a4_high)
 a4_low_max=max(a4_low)
 a4_low_min=min(a4_low)
 a4min=max(a4_low_min,a4_high_min)
 a4max=min(a4_low_max,a4_high_max)
 a4range_high=N.intersect1d(N.where(a4_high>a4min)[0],N.where(a4_high<a4max)[0])
 a4range_low=N.intersect1d(N.where(a4_low>a4min)[0],N.where(a4_low<a4max)[0])
 a4list=[a4_low,a4_high+delta]
 Ilist=[I_low,-I_high]
 Ierrlist=[Ierr_low,Ierr_high]
 monlist=[mon_stiched_low,mon_stiched_high]
 a4out,Iout,Ierrout=simple_combine.simple_combine(a4list,Ilist,Ierrlist,monlist,method='interpolate',step=0.1)
 print 'done'
 background=300.0
 Iout=Iout+background
 myfilestr=mydirectory+'\\'+'subtracted.txt'
 output(a4out,Iout,Ierrout,outputfile=myfilestr)
 #exit()
 pylab.subplot(3,1,1)
 pylab.errorbar(a4_low,I_low,Ierr_low,linestyle='None',marker='s',mfc='blue',markersize=1.0)
 pylab.subplot(3,1,2)
 pylab.errorbar(a4_high,I_high,Ierr_high,linestyle='None',marker='s',mfc='red',markersize=2.0)
 pylab.subplot(3,1,3)
 #for delta in N.arange(-.1,.1,.01):
 #    print delta
 pylab.errorbar(a4out,Iout-background,Ierrout,linestyle='None',marker='s',mfc='green',markersize=1.0)
 pylab.ylim((-30,30))
    residual = (I - Icalc) / Ierr
    return residual


if __name__ == '__main__':
    mydirectory = r'c:\camn2sb2\bt9\Feb5_2008'
    myfilebase = 'order*'
    myend = 'bt9'
    temp, I, Ierr, monlist = read_order_files(mydirectory, myfilebase, myend)
    ##    print 'read '
    ##    print 'temp ',temp
    ##    print 'I',I
    ##    print Ierr
    ##    print 'monlist ' ,monlist
    ##    print len(I),len(monlist)
    T, I, Ierr = simple_combine.simple_combine(temp, I, Ierr, monlist)
    #print temp.shape, I.shape, Ierr.shape
    #pylab.errorbar(temp,I,Ierr,marker='s',linestyle='None',mfc='red',mec='red',ecolor=None)
    p0 = [copy.deepcopy(I[0]), 84.0, .33333, copy.deepcopy(I[-1])]
    tmin = 5
    tmax = 100
    #p=[Tn Jt Nf Bk]
    p0 = [88.85, .9844, 1975.0, 4068.0]
    if 0:
        Icalc1 = meanfield.orderparameter(p0, T)
        pylab.plot(T, Icalc1, marker='s', linestyle='None')
        pylab.show()

    Trange = N.intersect1d(N.where(T > tmin)[0], N.where(T < tmax)[0])
    oparam = scipy.odr.Model(meanfield.orderparameter)
    mydata = scipy.odr.RealData(T[Trange], I[Trange], sx=None, sy=Ierr)
Beispiel #6
0
 a4_low_min = min(a4_low)
 a4min = max(a4_low_min, a4_high_min)
 a4max = min(a4_low_max, a4_high_max)
 a4range_high = N.intersect1d(
     N.where(a4_high > a4min)[0],
     N.where(a4_high < a4max)[0])
 a4range_low = N.intersect1d(
     N.where(a4_low > a4min)[0],
     N.where(a4_low < a4max)[0])
 a4list = [a4_low, a4_high + delta]
 Ilist = [I_low, -I_high]
 Ierrlist = [Ierr_low, Ierr_high]
 monlist = [mon_stiched_low, mon_stiched_high]
 a4out, Iout, Ierrout = simple_combine.simple_combine(a4list,
                                                      Ilist,
                                                      Ierrlist,
                                                      monlist,
                                                      method='interpolate',
                                                      step=0.1)
 print 'done'
 background = 300.0
 Iout = Iout + background
 myfilestr = mydirectory + '\\' + 'subtracted.txt'
 output(a4out, Iout, Ierrout, outputfile=myfilestr)
 #exit()
 pylab.subplot(3, 1, 1)
 pylab.errorbar(a4_low,
                I_low,
                Ierr_low,
                linestyle='None',
                marker='s',
                mfc='blue',