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


Python RamanSpectrum.index方法代碼示例

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


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

示例1: n

# 需要導入模塊: from ramanTools import RamanSpectrum [as 別名]
# 或者: from ramanTools.RamanSpectrum import index [as 別名]
def n():  ########### remove interference noise from 4_light

    width = 100
    r = RamanSpectrum('/home/chris/Documents/DataWeiss/150304/4_light.SPE')

    lambdaa = 10**7 / (10**7 / 514.5 - array(r.index))
    r.index = pandas.Float64Index(lambdaa)
    r = r.iloc[90:900]

    for i in range(5):
        r = smooth(r)

    fit = polyfit(array(r.index), r.values, 4)
    r /= polyeval(fit, array(r.index))

    xs = array(r.index) / 1000

    def funct(x, A, m, b, phase):
        return (1 + (A) * cos((x + m * x**2) * pi / b + phase))**2

    guess = [0.005, 1, 0.005, 0.1]

    plot(xs, funct(xs, *guess), 'k')
    plot(xs, r.values)
    x = scipy.optimize.curve_fit(funct, xs, r.values, guess)
    print x[0]
    plot(xs, funct(xs, *x[0]))

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

示例2: n2

# 需要導入模塊: from ramanTools import RamanSpectrum [as 別名]
# 或者: from ramanTools.RamanSpectrum import index [as 別名]
def n2(name):  ########### remove interference noise from 3_light

    r = RamanSpectrum(name)

    lambdaa = 10**7 / (10**7 / 514.5 - array(r.index))
    r.index = pandas.Float64Index(lambdaa)
    r = r.iloc[300:800]

    weights = zeros(r.size)

    for i in range(5):
        r = smooth(r)

    fit = polyfit(array(r.index), r.values, 5)
    r /= polyeval(fit, array(r.index))

    xs = array(r.index) / 1000

    plot(xs, r.values)

    def funct(p):
        return sum((r.values - 0.0017 * cos(700 / (xs + 4 * xs**2) + p) - 1)
                   **2)

    bnds = ((0, 2 * pi), )
    pguess = float(scipy.optimize.minimize(funct, pi, bounds=bnds)['x'])

    pguess = 0

    #plot(xs,0.0017*cos(600/(xs+1*xs**2) +pguess)+1 ,'r')

    #def funct(x,A,m,b):return (A/1000.0)*cos(d*100/(a*x**2+b*x**2+c)+pguess)+1   #def funct(x,A,b,phase):return (1+(A)*cos(x*pi/b+phase))**2
    #guess = [1.7,4,6.0]#

    def funct(x, A, a, b, c):
        return (A / 1000.0) * cos(
            1000 / (a * x**2 + b * x + c)
        ) + 1  #def funct(x,A,b,phase):return (1+(A)*cos(x*pi/b+phase))**2

    guess = [1.7, 3, 1, 0]  #

    # plot(xs,funct(xs, *guess),'k')

    x = scipy.optimize.curve_fit(funct, xs, r.values, guess)
    print x[0]
    plot(
        xs,
        funct(xs, *x[0]),
        label=os.path.basename(name),
        color=gca().lines[-1].get_color())
    print sum((r.values - funct(xs, *x[0]))**2)

    legend()

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

示例3: RhodBonRaman

# 需要導入模塊: from ramanTools import RamanSpectrum [as 別名]
# 或者: from ramanTools.RamanSpectrum import index [as 別名]
def RhodBonRaman():
    
    
    os.chdir('/home/chris/Documents/DataWeiss/150228')
    RB1=RamanSpectrum('RhB 500sec 0_01_filter.SPE')
    RB2= RamanSpectrum('RhB 500sec 0_1_filter.SPE')
    RB3=RamanSpectrum('RhB 500sec full power_filter.SPE')
    RBref = RamanSpectrum(pandas.Series.from_csv('/home/chris/Documents/DataWeiss/RhodamineB.csv'))
    RBref.index=pandas.Float64Index(10**7/514.5-10**7/array(RBref.index))
    dark = mean(RamanSpectrum('dark 50 s.SPE'))*10
    
    
    

    RB1/=max(RB1)
    RB1.plot()
    RBref.plot()
    return RBref
    
開發者ID:cmthompson,項目名稱:data,代碼行數:20,代碼來源:Feb24.py


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