當前位置: 首頁>>代碼示例>>Python>>正文


Python RamanSpectrum.reindex方法代碼示例

本文整理匯總了Python中ramanTools.RamanSpectrum.reindex方法的典型用法代碼示例。如果您正苦於以下問題:Python RamanSpectrum.reindex方法的具體用法?Python RamanSpectrum.reindex怎麽用?Python RamanSpectrum.reindex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ramanTools.RamanSpectrum的用法示例。


在下文中一共展示了RamanSpectrum.reindex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: calibration3

# 需要導入模塊: from ramanTools import RamanSpectrum [as 別名]
# 或者: from ramanTools.RamanSpectrum import reindex [as 別名]
def calibration3(save_it= False):
    global correctionVis1
    ax1=subplot(221)
    ax2=subplot(222)
    ax3=subplot(223)
    os.chdir('/home/chris/Documents/DataWeiss/150228')
    spec1=RamanSpectrum('RhB 500sec full power_filter.SPE')-1320
    spec1.plot(axes =ax3)
    names = ['/home/chris/Documents/DataWeiss/150227/1 Rhb.SPE',
             '/home/chris/Documents/DataWeiss/150227/10 Rhb 1100 grating.SPE',
             'dark 50 s.SPE',
             'RhB 500sec 0_01_filter.SPE',#,
             'RhB 500sec 0_1_filter.SPE',
             'RhB 500sec full power_filter.SPE',
             '/home/chris/Documents/DataWeiss/150227/1 Rhb.SPE']
    clf()
    #spec1 = NA.remove_dust(spec1,blind=True)           
    sum_array = zeros((1024,1))         
    ax1=subplot(221)
    ax2=subplot(222)
    ax3=subplot(223)
    r = spec1.size-1
    
    
    darksignal = 500*12
    spec1-=darksignal-1
 
    xs = array(spec1.index)
    ys= spec1.values
  
    average = SGsmooth(xs,ys)
    fit = polyfit(xs,ys,6)
    dust = polyeval(fit,xs)
    noise1=transpose([(average)/(ys)])
    dustnoise = dust/average
    if save_it == True:
        savetxt('/home/chris/Documents/DataWeiss/CCD Pixel-to-Pixel Correction Factor.txt', noise1)
       
    
    fullnoise = dustnoise*noise1.flatten()
   
   
    sumnoise = sum((noise1-1)**2)
    
    
    for name in names:
        
        spectrum = RamanSpectrum(name)-1320
        spectrum = spectrum.reindex(spec1.index,fill='backfill')
       
        xs = array(spectrum.index)
        ys= spectrum.values
        average = SGsmooth(xs, ys)
        noise = transpose([(average)/(ys)])
        fullnoise = (noise.flatten())*(dustnoise)
        print name,correlate(noise[:,0]-1, noise1[:,0]-1)/sqrt(sum((noise-1)**2)*sumnoise)
        
        sum_array = append(sum_array,noise,axis=1)
        
    
        ax2.plot(noise)
        ax3.plot(xs, ys)
        #ax3.plot(xs,average)
   
    ax3.legend(['a','b','c','d','e','f'])
    ax2.legend(list(x[-14:-9] for x in names))
    ax1.legend(list(x[-14:-9] for x in names))
    subplot(224)
    
    sum_array = sum_array[:,1:]
    CCDcorrectionfactor = 1+mean(sum_array,axis=1)
    
    errorbar(range(1024), CCDcorrectionfactor, yerr=std(sum_array,axis=1)/sqrt(len(names)))

    
    return 0
開發者ID:cmthompson,項目名稱:data,代碼行數:78,代碼來源:Feb24.py


注:本文中的ramanTools.RamanSpectrum.reindex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。