コード例 #1
0
def Plot(fname1='run/out_chip2_nmos2_drain1_5v_vddat1_5v_gnadtgrounded_rad0Krad.txt',
         fname2='run/beforeIrradiation/test_chip2_pmos5_drain1_5v_vddat1_5v_gnadtfloating.txt'):
    # Process
    info = Parse(fname1)
    #info = Parse('run/out_chip1_pmos8_drain1_5v_vddat1_5v_gnadtgrounded_rad0Kradproper.txt')
    info2 = Parse(fname2)
    #info = Parse('run/beforeIrradiation/test_chip3_pmos5_drain1_5v_vddat1_5v_gnadtfloating.txt')
    #setPlotDefaults(ROOT)
    Style()
    c1 = ROOT.TCanvas("c1","testbeam efficiency",50,50,600,600);
    mg = ROOT.TMultiGraph();
    
    gr1,gr1sq = GetTGraph(info,color=1)
    gr2,gr2sq = GetTGraph(info2,'gr2',color=2)
    gr1sq.Draw();
    #gr2.Draw('same')
    
    leg = ROOT.TLegend(0.45, 0.2, 0.85, 0.4);
    leg.SetBorderSize(0);
    leg.SetFillStyle(0);
    #leg.AddEntry(gr3, "60V Bias");        
    #leg.AddEntry(gr2, "90V Bias");    
    leg.AddEntry(gr1, "PMOS");
    leg.Draw();
    
    c1.Update();
    c1.WaitPrimitive();
    
    data=[]
    for i in info:
        d = DataPoint(i[0],i[1],i[2],i[3])
        data+=[d]
    dset = DataSet(data,'data')
    dset.set_transistor_dimensions(4.0, 0.18)
    dset.calc_characteristics()
    
    print 'Vthr: ',dset._vthr
    print dset.get_characteristics()
    
    vis = Visualizer('title', '2 1')    
    vis.add_plot(dset, ty='rawData', ind='0 0')
    vis.add_plot(dset, ty='sqData', ind='1 0')
    vis.get_plot()
    #raw_input('wait')   
    my_type='NMOS'
    if PMOS:
        my_type = 'PMOS'
    #ta.max_slope(dset)
    dataa=np.loadtxt(fname1,unpack=True, skiprows=2)
    #print dataa
    if NSAMPLE>0:
        ths=[]
        rand = ROOT.TRandom3()
        rand.SetSeed(4)
        for i in range(0,NSAMPLE):
            sampled_data = copy.deepcopy(dataa)
            for n in range(0,len(sampled_data[1])):
                sampled_data[1][n] += rand.Gaus(0.0,sampled_data[1][3]/3.0)
                #print sampled_data[1][n],' ',dataa[1][n]
            ths += [ta.global_plot_single(sampled_data, transistor= my_type, no_show=NSAMPLE>0)]

        mean_ths = np.mean(ths)
        print 'mean: ',mean_ths
        print ths
        rms_ths = []
        for m in ths:
            rms_ths += [m-mean_ths]
        rms_th = math.sqrt(np.sum(np.square(rms_ths))/float(len(rms_ths)-1))
        print 'std. dev.:',rms_th
    else:
        th = ta.global_plot_single(dataa, transistor= my_type, no_show=(NSAMPLE>0))
        print th    
コード例 #2
0
dev_hv.enable_output()

data, number = dev_hv.sweep(dev_hv)

for d in data:
    print 'Vg, Id, Id,errV,errI,   Vd, Ig, Id,errVd,errIg'
    print(d.x, d.y,d.x_err, d.y_err,d.w, d.z,d.w_err, d.z_err)

dset = DataSet(data,'data')
dset.set_transistor_dimensions(4.0, 0.18)
dset.calc_characteristics()

vis = Visualizer('title', '2 1')    
vis.add_plot(dset, ty='rawData', ind='0 0')
vis.add_plot(dset, ty='sqData', ind='1 0')
vis.get_plot()

output_file = 'run/out_hv_iv_chip%s.txt' %(chip_number)
f=time.strftime(output_file)
f=open(f,'w+')
print >> f, time.strftime("[%Y-%m-%d %H:%M:%S]\n"), "<V>,  <Id>,  sd_V,  sd_I, <Vd>,  <Ig>,  sd_Vd,  sd_Ig\n",
for d in data:
    print >> f,d.x, d.y, d.x_err, d.y_err,d.w, d.z,d.w_err, d.z_err
   
f.close()
   
dev_hv.disable_output()
print 'end'
print 'Plots not validated...'
#dataa=np.loadtxt(output_file,unpack=True, skiprows=2) 
#global_plot_single(dataa, transistor= 'PMOS')