예제 #1
0
def Fig2():  ##### View,filter, and average spectra of PbS dots with Methoxythiophenol in the 2300-3400 cm-1 range
    subplot(121)
    a = RamanTools.RamanSpectrum("/home/chris/Documents/DataWeiss/141125/7_.txt")

    takeout(a)
    a.plot()
    b = RamanTools.RamanSpectrum("/home/chris/Documents/DataWeiss/141126/7_.txt")
    b = RamanTools.FourierFilter(b, width=380)

    takeout(b, centers=(456, 483), demo=True)
    b.plot()
    c = RamanTools.RamanSpectrum("/home/chris/Documents/DataWeiss/141126/8_.txt")
    takeout(c)
    c.plot()
    m = RamanTools.add_RamanSpectra(a, b)
    n = RamanTools.add_RamanSpectra(m, c)

    legend(["1", "2", "3"])
    subplot(122)

    MTP = RamanTools.RamanSpectrum("/home/chris/Documents/DataWeiss/141014/4_methoxythiophenol_1.csv")
    MTP -= min(MTP[0:1000])
    MTP /= max(MTP[0:1000])
    MTP *= 1000
    MTP.plot(color="b", linewidth=3)
    n.autobaseline((2300, 3400))
    n /= 10
    n.plot()
    xlim(2300, 3400)
    ylim(-500, 1500)

    return 0
예제 #2
0
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
예제 #3
0
파일: march24.py 프로젝트: cmthompson/data
def Mar31():
    
    subplot(221)
    a = RamanSpectrum('/home/chris/Documents/DataWeiss/150331/150331_02.txt')
    a = autobaseline(a,(141,1700),order = 4)
    a = smooth(a)+50
    #b = RamanSpectrum('/home/chris/Documents/DataWeiss/150331/150331_03.txt')
    #c =add_RamanSpectra(a,b)
    a.plot(color = 'k')
    

    
    ylim(0,200)
    xlim(140,1700)
    
    subplot(222)
    
    a.plot(color = 'k')
    xlim(2700,3100)
    ylim(50,100)
    
    subplot(223)
    (RamanSpectrum('/home/chris/Documents/DataWeiss/140918/9_CdMeOTP.SPE')/10-1800).plot(color = 'b')
    CdODPARef.plot(color = 'r')
    xlim(100,1700)
    ylim(0,5000)
    
    subplot(224)
    (RamanSpectrum('/home/chris/Documents/DataWeiss/140918/7_CdMeOTP.SPE')-40000).plot(color='b')
    (CdODPARef+10000).plot(color = 'r')
    xlim(2700,3100)
예제 #4
0
파일: Feb9.py 프로젝트: cmthompson/data
def spinning():  ## test of optical damage decreased by spinning

    os.chdir('/home/chris/Documents/DataWeiss/150209')
    figure()
    a =  ['1_sample not moving.SPE', 
        '2_sample not moving.SPE',
        '3_sample not moving 5 min irradiation.SPE',
        '4_sample not moving 5 min irradiation.SPE', 
        '5_spinning.SPE',
        '6_spinning.SPE', 
        '7_spinning 2 min.SPE',
        '8_spinning 3 min.SPE', 
        '9_spinning 4 min.SPE',
        '10_spinning 5 min.SPE',
        '11_spinning 10 min.SPE', '12_stopped spinning 0 min.SPE', '13_ 1min later.SPE', '14_ 2min later.SPE', '15_ 3min later.SPE', '16_ 4min later.SPE', '17_long scan.SPE', '18_red dots.SPE', '19.SPE']
    areas = list()    
    for i in a[0:17]:
        
        r = RamanSpectrum(i)
        
        print r.name
        areas.append(r.calc_area((180,220)))
        
    plot([0,0.5,5,5.5],areas[0:4]/areas[0],'s-')
    plot([0,1,2,3,4,5,10],areas[4:11]/areas[4],'s-')
    plot([0,1,2,3,4],areas[11:16]/areas[11],'s-')
    legend(['not spun','while spinning','stopped spinning'])
    return areas
예제 #5
0
파일: May8.py 프로젝트: cmthompson/data
def May14():
    clf()
    s = RamanSpectrum("/home/chris/Documents/DataWeiss/150514/150514_12.txt")
    a = RamanSpectrum("/home/chris/Documents/DataWeiss/150514/150514_13.txt")
    b = RamanSpectrum("/home/chris/Documents/DataWeiss/150514/150514_14.txt")
    c = add_RamanSpectra(a, b)
    # c = add_RamanSpectra(s,c)

    d = RamanSpectrum("/home/chris/Documents/DataWeiss/150514/150514_15.txt")
    v = RamanSpectrum("/home/chris/Documents/DataWeiss/150514/150514_16.txt")
    z = 0.15

    e = subtract_RamanSpectra(c, d * z)

    # e.smooth()
    l = subtract_RamanSpectra(c, v * z)
    # l.smooth()
    e = RamanSpectrum(e.append(l))
    e = autobaseline(e, (180, 277), order=4)
    e = autobaseline(e, (277, 1700), order=4, join="start")
    # j = subtract_RamanSpectra(c,RamanSpectrum(pandas.Series(f[2],f[1])))
    e.plot()

    # d.plot()
    # v.plot()

    # CdMeOTPRef.index = array(CdMeOTPRef.index)-5
    (CdMeOTPRef / 120).plot()
    (MeOTPRef / 240).plot()

    return 0
예제 #6
0
def m():

    r = RamanSpectrum('/home/chris/Documents/DataWeiss/150304/2_ light.SPE')
    v = smooth(r)
    for i in range(5):
        v = smooth(v)
    v.plot(marker='s')
    r.plot()
    return 0
예제 #7
0
파일: May8.py 프로젝트: cmthompson/data
def today():
    a = "/home/chris/Documents/DataWeiss/150518/"
    for i in range(1, 9):
        r = RamanSpectrum(a + "150517_0" + str(i) + ".txt")
        v = 10 ** 7 / array(r.index) - 10 ** 7 / 785
        r = RamanSpectrum(pandas.Series(r.values, -1 * v))
        r.to_csv(a + "150518_0" + str(i) + "b.txt")

    return 0
예제 #8
0
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
예제 #9
0
def Jan18():### data from trying out the cryostat
    os.chdir('/home/chris/Documents/DataWeiss/150118')
    green = RamanSpectrum('11_phonon long scan.SPE')
    green.plot()
    
    red = RamanSpectrum('12b.SPE')
    s = argmin(abs(red.index-1468))
    print s
    print red.iloc[s-1:s+2]
    red.iloc[s+1:] -= red.iloc[s+1]-red.iloc[s]
   # red = _smooth(red)
    red = autobaseline(red,(131,500),order = 0)
    red = autobaseline(red,(500,950),order= 4)
    red = autobaseline(red,(950,1520),order= 1)
    red.plot()
    
    
    red = RamanSpectrum('13.SPE')
    s = argmin(abs(red.index-942.3))
  
    red.iloc[s+1:] -= red.iloc[s+1]-red.iloc[s]
    #red = _smooth(red)
    red = autobaseline(red,(525,1612),order = 0)
    #red = autobaseline(red,(500,950),order= 4)
    #red = autobaseline(red,(950,1520),order= 1)
    red.plot()
    return 0
예제 #10
0
파일: march24.py 프로젝트: cmthompson/data
def Mar24():  ########### Raman of older red dots.  These have polystyrene or toluene on them. 
    figure()
    j = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_22.txt')
    k = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_23.txt')
    l = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_26.txt')
    m = add_RamanSpectra(j,k)
    m=add_RamanSpectra(m,l)
    m=autobaseline(m,(0,3300),order = 0)
    m=smooth(m)
    m.plot(label='NativeLigands')
    
    j = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_24.txt')
    k = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_25.txt')
    l = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_26.txt')
    m = add_RamanSpectra(j,k)
    m=add_RamanSpectra(m,l)
    m=autobaseline(m,(0,3300),order = 0)
    
    m=smooth(m)
    m.plot(label='NativeLigands')
    
    j = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_28.txt')
    k = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_29.txt')
    
    m = add_RamanSpectra(j,k)
    m=autobaseline(m,(0,3300),order = 0)
    m=smooth(m)
    
    m.plot(label='NativeLigands')
    
    ref = RamanSpectrum('/home/chris/Documents/DataWeiss/141007/Liquid sample corrected-spectrum of toluene.txt')
    ref.plot(label = 'toluene')
    legend()
    title('Native Ligand')
    
    
    figure()
    j = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_34.txt')
    m=smooth(j)
    m.plot(label='MeOTP')
    
    
    j = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_35.txt')
    k = RamanSpectrum('/home/chris/Documents/DataWeiss/150324/NativeLigand_Red_36.txt')
   
    m = add_RamanSpectra(j,k)
   
    m=smooth(m)
    m.plot(label='MeOTP')
    
    title('MeOTP treated')
    
    
    return 0
예제 #11
0
파일: May8.py 프로젝트: cmthompson/data
def May21():
    a = RamanSpectrum("/home/chris/Documents/DataWeiss/150521/150521stoic_dots.CSV")
    a[:] -= 0.2
    n_guess = [
        0.05,
        0.05,
        0.05,
        0.1,
        0.05,
        0.05,
        0.05,
        0.05,
        0.05,
        0.05,
        1015,
        1048,
        1075,
        1100,
        1159,
        1169,
        1184,
        1204,
        1221,
        1246,
        20,
        20,
        20,
        40,
        20,
        40,
        20,
        20,
        20,
        20,
        0,
        0.0,
    ]

    a.plot(color="k")
    print a.nearest(1100)
    print a.nearest(1300)
    b = fitspectrum(a, (1000, 1260), "xGaussian", n_guess)
    print b.params[0]
    plot(b.x, b.y, "r")
    print len(b.x)
    print len(b.peaks)
    # plot(b.x,b.peaks[0])
    for p in b.peaks:
        plot(b.x, p, "b")
        # pass

    b = (RamanSpectrum("/home/chris/Documents/DataWeiss/150520/150520_02.txt") - 500) / 10000
    b.plot()
    return 0
예제 #12
0
파일: Feb9.py 프로젝트: cmthompson/data
def N2():  ## test of optical damage decreased by spinning

    os.chdir('/home/chris/Documents/DataWeiss/150210')
    figure()
    print os.listdir('.')
    
    a = [ '1_under N2 0 min.SPE', '1_under N2 1 min.SPE', '3_under N2 2 min.SPE', 
    '4_under N2 3 min.SPE', '5_under N2 4 min.SPE', '6_under N2 5 min.SPE', 
    '7_under N2 6 min.SPE', '8_under N2 7 min.SPE', '9_under N2 8min.SPE',
    '10_under N2 9min.SPE', '11_under N2 10min.SPE', '12_ spinning under N2 0 min.SPE', 
    '13_ spinning under N2 1min.SPE', '14_ spinning under N2 2min.SPE', '15_ spinning under N2 3min.SPE',
    '16_ spinning under N2 4min.SPE', '17_ spinning under N2 5min.SPE', 
    '18_ spinning under N2 6min.SPE', '19_ spinning under N2 7min.SPE',
    '20_ spinning under N2 8min.SPE', '21_ spinning under N2 9min.SPE',
    '22 spinning under N2 10min.SPE', '23_after dark time.SPE',
    '24_after dark time 1min.SPE', '25_ spinning in air 0 min.SPE', 
    '26_ spinning in air 1 min.SPE', '27_ spinning in air 2 min.SPE',
    '28_ spinning in air3 min.SPE', '29_ spinning in air 4min.SPE', 
    '30_ spinning in air 5min.SPE', '31_ spinning in air 6 min.SPE',
    '32_ spinning in air 7 min.SPE', '33_ spinning in air 8 min.SPE', 
     '34_ spinning in air 9 min.SPE','34_ spinning in air 10min.SPE',
    '35_after 10 min dark.SPE', '36_after 10 min dark plus 1min.SPE',
    '37.SPE', '38_ 30 SEC.SPE', '39_ 60s.SPE',
    '40_90 s.SPE', '41_120s.SPE', '42_150s.SPE']
 
    areas = list()    
    for i in a:
        
        r = RamanSpectrum(i)
        
       
        areas.append(r.calc_area((180,220)))
    N2only = areas[0:11] 
    N2spin = areas[11:24]
    airspin = areas[24:37]
    airstill = areas[37:]
    
    N2only/=N2only[0]
    N2spin/=N2spin[0]
    airspin/=airspin[0]
    airstill/=airstill[0]
    plot(N2only,'s-')
    plot([0,1,2,3,4,5,6,7,8,9,10,20,21],N2spin,'s-')
    plot([0,1,2,3,4,5,6,7,8,9,10,20,21],airspin,'s-')
    plot(arange(0,3,0.5),airstill,'s-')
    fill_between((10,20),(0,0),(1,1),color = 'y')
    annotate('dark', (15,0.4),horizontalalignment = 'center', fontsize=24)
    legend(['n2 only','n2 + spinning','air + spinning','air only'])
    
    
    xlabel('Time (min)')
    ylabel('Phonon Mode Intensity (a.u.)')
    return areas
예제 #13
0
파일: Jan18.py 프로젝트: cmthompson/data
def Feb1():  ## 
    """Resonance Raman of CdSe dots with PPA in water.  February 1"""
    clf()
    a473 =  RamanSpectrum('/home/chris/Dropbox/DataWeiss/160201/160201_07.txt')
    a633 =  RamanSpectrum('/home/chris/Dropbox/DataWeiss/160201/160201_08.txt')
    a633=SPIDcorrect633(a633)
    a473.autobaseline((120,700),order = 3)
    a633.autobaseline((120,700),order = 3)
    a473.plot()
    a633.plot()
    legend(['473','633'])
    return 0
예제 #14
0
def smooth_phonon():
    import RamanTools2
    
    aa = RamanSpectrum('/home/chris/Documents/DataWeiss/141029/4_RubyRed in PS phonon_1.txt')
     
    
    aa-=min(aa)    
    aa/=max(aa)
    aa._smooth(aa.values,window = 'flat')  
    
    aa.plot(color = 'r')
   
    return aa
예제 #15
0
def Oct17NMRfitting():
#    a = loadtxt('/home/chris/Dropbox/DataWeiss/151020/MPAexchange on HCN_1000eq.csv',skiprows = 1, usecols = (0,1), delimiter = ',', unpack = True)
#   `r = RamanSpectrum(pandas.Series(a[1],a[0]))
#    w=1E-5
#    g = [0.05,0.03,0.05,.03,.1,.03,.05,.03,.05,1.38,1.39,1.395,1.405,1.41,1.42,1.425,1.43,1.44,w,w,w,w,w,w,w,w,w,0,0]
#    s = fitspectrum(r,(1.34,1.46), 'xGaussian', g)
#    clf()
#    r.plot()
#    for i in s.peaks: plot(s.x,i)
#    plot(s.x,s.y)
#    print s.areas
#    xlim(1.34,1.49)
#    ylim(-0.01,0.1)
    
 
#    a = loadtxt('/home/chris/Dropbox/DataWeiss/151020/MPAexchange on HCN_100eq.csv',skiprows = 1, usecols = (0,1), delimiter = ',', unpack = True)
#    r = RamanSpectrum(pandas.Series(a[1],a[0]))
#    r.name = ''
#    w=1E-5
#    a = 0.04
#    g = [a,a,a,a,a,a,a,a,a,a,a,1.38,1.385,1.392,1.398,1.405,1.41,1.412,1.42,1.43,1.435,1.44,w,w,w,w,w,w,w,w,w,w,w,0,0]
#   # s =  fitspectrum(r,(1.34,1.46), 'xGaussian', g)
#    
#    r.plot()
#    for i in s.peaks: plot(s.x,i)
#    plot(s.x,s.y)
#    print s.areas
#    xlim(1.34,1.49)
#    ylim(-0.01,0.1)
    
    a = loadtxt('/home/chris/Dropbox/DataWeiss/151020/MPAexchange on HCN_100eq.csv',skiprows = 1, usecols = (0,1), delimiter = ',', unpack = True)
    r = RamanSpectrum(pandas.Series(a[1],a[0]))
    r.name = ''
    w=1E-5
    a = 0.04
    g = [a,0.05,a,a,a,a,a,a,a,a,a,1.725,1.73,1.738,1.743,1.745,1.75,1.755,1.765,1.77,1.78,1.785,w,w,w,w,w,w,w,w,w,w,w,0,0]
    s =  fitspectrum(r,(1.70,1.80), 'xGaussian', g)
    clf()
    r.plot()
    for i in s.peaks: plot(s.x,i)
    plot(s.x,s.y)
    print s.params[0]
    xlim(1.70,1.80)
    ylim(-0.01,0.1)
    return s.areas
예제 #16
0
def Oct17():
    a= loadtxt('/home/chris/Dropbox/DataWeiss/151017/thioldots.csv', delimiter = ',', unpack = True, skiprows=1, usecols = (0,6,3,1,2,4,5))
        
    for i in range(1,7):
        r = polyfit(a[0,0:100],a[i,0:100],1)
        a[i]-=rs.polyeval(r,a[0])
        peak = uv.findpeak(a[0],a[i],(410,420))
       #print peak 
        diameter = -0.000000066521*peak[0]**3+0.00019557*peak[0]**2-0.092352*peak[0]+13.29
        #print 'diam', diameter
        epsilon = 21536*diameter**2.3
       # print 'eps', epsilon
        print 'CONC', 5*peak[1]/epsilon 
        plot(a[0],a[i])
    legend(['4.2','6.0',',6.4','7.7','9.7','11.5'])
    
    print 'THIOL EXCHANGE'  
    a= loadtxt('/home/chris/Dropbox/DataWeiss/151017/thiolcapped doits.csv', delimiter = ',', unpack = True, skiprows=1, usecols = (0,1))
    r = polyfit(a[0,0:100],a[1,0:100],1)
    a[1]-=rs.polyeval(r,a[0])
    peak = uv.findpeak(a[0],a[1],(410,420))
   #print peak 
    diameter = -0.000000066521*peak[0]**3+0.00019557*peak[0]**2-0.092352*peak[0]+13.29
    #print 'diam', diameter
    epsilon = 21536*diameter**2.3
   # print 'eps', epsilon
    print 'CONC', 5*peak[1]/epsilon
    
    a= loadtxt('/home/chris/Dropbox/DataWeiss/151017/thioldots.csv', delimiter = ',', unpack = True, skiprows=1, usecols = (0,3,1,2,4,5,6))
        
    for i in range(1,7):
        r = polyfit(a[0,0:100],a[i,0:100],1)
        a[i]-=rs.polyeval(r,a[0])
        peak = uv.findpeak(a[0],a[i],(410,420))
       #print peak 
        diameter = -0.000000066521*peak[0]**3+0.00019557*peak[0]**2-0.092352*peak[0]+13.29
        #print 'diam', diameter
        epsilon = 21536*diameter**2.3
       # print 'eps', epsilon
        print 'CONC', 5*peak[1]/epsilon 
        plot(a[0],a[i])
    legend(['200','400',',800','2000','3200','4000'])
        
    return 0
예제 #17
0
파일: May8.py 프로젝트: cmthompson/data
def May16():

    c = RamanSpectrum("/home/chris/Documents/DataWeiss/150516/150516_08.txt")
    c.values[:] *= 3
    c = autobaseline(c, (300, 1700), order=6)
    c.smooth()
    c.plot(label="Cd-enriched")
    a = fitspectrum(
        c,
        (900, 1150),
        "SixGaussian",
        [200, 200, 200, 200, 200, 200, 950, 990, 1026, 1064, 1087, 1115, 10, 10, 10, 10, 10, 10, 1, -100],
    )
    plot(a[1], a[2], linewidth=3, label="Cdenriched fit")

    #    a = RamanSpectrum('/home/chris/Documents/DataWeiss/150516/150516_08.txt')
    #    b = RamanSpectrum('/home/chris/Documents/DataWeiss/150516/150516_07.txt')
    #    c = add_RamanSpectra(a,b)
    #
    #    c = autobaseline(c,(300,1700),order = 4)
    #    c.smooth()
    #    c.plot(label='stoichiometric')
    #

    # CdMeOTPRef.index = array(CdMeOTPRef.index)-5
    # (CdMeOTPRef/120).plot()
    # (MeOTPRef/240).plot()
    a = RamanSpectrum("/home/chris/Documents/DataWeiss/150516/150516_01.txt")
    b = RamanSpectrum("/home/chris/Documents/DataWeiss/150516/150516_02.txt")
    c = RamanSpectrum("/home/chris/Documents/DataWeiss/150516/150516_03.txt") * 4
    d = RamanSpectrum("/home/chris/Documents/DataWeiss/150516/150516_05.txt")
    e = RamanSpectrum("/home/chris/Documents/DataWeiss/150516/150516_06.txt")
    a = add_RamanSpectra(a, b)

    a = add_RamanSpectra(a, c)

    a = add_RamanSpectra(a, d)

    a = add_RamanSpectra(a, e)

    a.values[:] /= 10
    a.plot(label="pieces")

    # ics('/home/chris/Orca/Successful/CdMeOTP/CdMeOTP.out')
    # ics('/home/chris/Orca/CdTP_bridge/CdTP_bridgeDFT.out',color='r')
    # a= fitspectrum(a,(900,1150),'SixGaussian', [200,200,200,200,200,200,950,990,1026,1064,1087,1115,10,10,10,10,10,10,1,-100])
    # plot(a[1],a[2],linewidth =3,label= 'piecesfit')
    return 0
예제 #18
0
파일: May8.py 프로젝트: cmthompson/data
def May20():
    a = RamanSpectrum("/home/chris/Documents/DataWeiss/150520/150520_02.txt")
    #    def xGaussian(x,*guess):
    #        numpeaks = (len(guess)-2)/3
    #        y = guess[-2]*x/1000+guess[-1]
    #        for i in range(numpeaks):
    #            y+= guess[i]*exp(-(x-guess[i+numpeaks])**2/guess[i+2*numpeaks])
    #        return y
    n_guess = [
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        100,
        720,
        790,
        785,
        811,
        820,
        848,
        865,
        885,
        10,
        10,
        10,
        10,
        10,
        10,
        10,
        10,
        0,
        600,
    ]

    a.plot()
    b = fitspectrum(a, (700, 908), "xGaussian", n_guess)
    plot(b[1], b[2])
    return 0
예제 #19
0
파일: march24.py 프로젝트: cmthompson/data
def Apr15():
    def gauss(x,A,G,m,b):return A*exp(-(1090-x)**2/G)+m*x+b
    a = RamanSpectrum('/home/chris/Documents/DataWeiss/150415/150415_15.txt')
    a = SPIDcorrect(a)
    noise = calc_noise(a,(900,1000))
    start = argmin(abs(1065-array(a.index)))
    end = argmin(abs(1115-array(a.index)))
    x = array(a.index[start:end])
    y = a.values[start:end]
    guess = [10,15,-1,y[0]+1000]
    
    peak = scipy.optimize.curve_fit(gauss, x, y, guess)
    print peak[0]
    
    
    a.plot(color = 'k')
    #plot(x,gauss(x,*peak[0]))
    #
    print 'signal to noise =', sqrt(peak[0][0]/noise)
    ylim(27000,37000)
    ylabel('Raman Intensity (a.u.)')
    xlabel('Raman Shift (cm$^{-1}$)')
    
    
    ax3 = gcf().add_axes((0.6,0.6,0.25,0.25))
    a.plot(color='k', ax = ax3)
    ax3.annotate('S/N: '+str(1.66), (1080, 28700), textcoords = 'data', size = 18)
    ax3.set_ylim(27500,29300)
    ax3.set_xlim(900,1200)
    return 0
예제 #20
0
def calculate_enchancement():
    global r,s
    #### Calc SERS enhancement on
    os.chdir('/home/chris/Documents/DataWeiss/150109')

    r = RamanSpectrum('1_MeTOP roughened Ag_1.txt')
    s = RamanSpectrum('2_MeOTP smooth silver_1.txt')
    r.autobaseline((500,1750),order=0)
    s.autobaseline((500,1750),order=0)
    on_roughened = calc_area(r,(1050,1130))*100 #### multiply, because used filter 0.01
    on_smooth = calc_area(s,(1050,1130))
    print 'hormalized area on roughened substrate =', on_roughened  
    
    print 'hormalized area on roughened substrate =', on_smooth
    r.plot(color = 'r')
    s.plot(color = 'k')
    legend(['roughened', 'smooth (x100)'],loc=2)
    annotate('x100', (0.6,0.7), xycoords = 'axes fraction', size = 24,color = 'k')
    print 'Approximate surface enhancement =',on_roughened/on_smooth
    xlabel('Raman Shift cm$^{-1}$')
    ylabel('Intensity a.u.')
    return 0
예제 #21
0
파일: May8.py 프로젝트: cmthompson/data
def May21b():
    clf()
    a = RamanSpectrum("/home/chris/Documents/DataWeiss/150520/150520_02.txt")
    a[:] -= 0.2
    n_guess = [
        0.05,
        0.05,
        0.05,
        0.05,
        0.05,
        0.05,
        0.05,
        1068,
        1100,
        1169,
        1184,
        1204,
        1221,
        1246,
        20,
        20,
        20,
        20,
        20,
        20,
        20,
        0,
        0.21,
    ]

    a.plot(color="k")
    CdODPARef.autobaseline((200, 1700), order=1)
    CdODPARef.plot()

    # b = RamanSpectrum('/home/chris/Documents/DataWeiss/150408/150408_02.txt')
    # b = autobaseline(b,(200,1700),leaveout=(200,300), order = 4)
    # b.plot()
    return 0
예제 #22
0
def processxymap():
    os.chdir('/home/chris/Documents/DataWeiss/150114')
    averagespectrum = RamanSpectrum('10_maybemap_1.txt')
    
    phononarea = array([])
    fluorescenceat1600=array([])
    fullspectrum = ndarray((1000,))
    for f in os.listdir('.'):
        if '10_maybemap' in f:
            if 'SPE' in f:
                continue
            elif f == 'maybemap_1.txt':
                
                continue
            elif f == 'maybemap.txt':
                
                continue
            
            else:
                r = RamanSpectrum(f)
                phononarea = append(phononarea,r.calc_area((200,230)))
                fluorescenceat1600 = append(fluorescenceat1600,r.values[-1]-min(r.values))
                averagespectrum+=r
    averagespectrum = _smooth(averagespectrum)
    figure()
    subplot(221)
    
    
    hist(fluorescenceat1600,bins=range(0,200,20))
    hist(phononarea,bins=range(0,200,20),color='r')
    xticks(range(0,200,20))
    subplot(223)
    averagespectrum.plot()
                
                
    return phononarea
예제 #23
0
def Jan22():### data from trying out the cryostat
    from scipy import optimize
    os.chdir('/home/chris/Documents/DataWeiss/150121')
    
    
    red = RamanSpectrum('17.SPE')
    red = normalize(red,(0,1600))
    red.plot(label='647 nm')
    
    green = RamanSpectrum('14.SPE')
    green=normalize(green,(0,1600))
    green.plot(label = '514 nm')
    
    
    cdRef=normalize(CdMeOTPRef,(0,1600))
    cdRef.plot(label = 'CdMeOTP Reference')
    
    mtpref = normalize(MeOTPRef,(0,1600))
    mtpref.plot(label = 'MeOTP Reference')
    xlim(1050,1150)
    
    legend()
    
    def singlegauss(x, A1, x1, c1):return A1*exp(-(x-x1)**2/(2*c1**2)) 
    def doublegauss(x, A1, x1, c1,A2,x2,c2):return A1*exp(-(x-x1)**2/(2*c1**2)) +A2*exp(-(x-x2)**2/(2*c2**2))
    green = autobaseline(green, (1050,1150), order = 0)
    print argmin(abs(green.index-1100))
    x = array(green.index[620:680])
    y = array(green.values[620:680])  
    print x
    
    
    r = list(optimize.curve_fit(singlegauss,x,y,[1,1087,20])[0])
    figure()
    plot(x,y,'s')
    plot(x,singlegauss(x,*r),'k')
    print r
    
    r = list(optimize.curve_fit(doublegauss,x,y,[1,1080,10,1,1090,10])[0])
    
    plot(x,doublegauss(x,*r),'r')
    
    
    plot(x,singlegauss(x,r[0],r[1],r[2]),'k.')
    plot(x,singlegauss(x,*r[3:6]),'k.')
    
    
    print r
    
    
         
    xlabel('Raman Shift cm$^{-1}$')
    ylabel('Intensity a.u.')
    return 0
예제 #24
0
def Oct13():
    a= loadtxt('/home/chris/Dropbox/DataWeiss/151013/NMR samples.csv', delimiter = ',', unpack = True, skiprows=1)
    
    for i in range(1,6):
        r = polyfit(a[0,0:100],a[i,0:100],1)
        a[i]-=rs.polyeval(r,a[0])
        peak = uv.findpeak(a[0],a[i],(410,420))
        print peak 
        diameter = -0.000000066521*peak[0]**3+0.00019557*peak[0]**2-0.092352*peak[0]+13.29
        print 'diam', diameter
        epsilon = 21536*diameter**2.3
        print 'eps', epsilon    
        print 'conc', 5*peak[1]/epsilon 
        plot(a[0],a[i])
    legend(['10.5','9.5','9.3','8.6','6.8'])
        
    return 0
def CdMBTinDMF():
    clf()
    a = RamanSpectrum('/home/chris/Documents/DataWeiss/150709/150709_01.txt')#### DMFonly
    b = RamanSpectrum('/home/chris/Documents/DataWeiss/150709/150709_02.txt')#### 510mg DMF with 200 mgCdMBT
    a.autobaseline((523,935,1336,1780),order = 3,specialoption='points')
    b.autobaseline((523,935,1336,1780),order = 3,specialoption='points')
    a[:]*=4720
    a[:]/=6256
   
    c = RamanSpectrum(b-a)
    c.plot()
    r = fitspectrum(c,(1070,1105),'xVoigt',[10000,1088,15,6,0,0])
    plot(r.x,r.y,'s-',linewidth=2)
    for i in r.peaks:
        plot(r.x,i)
    print r.areas
    print r.params[0][2:4]
    CdMethylTPRef.plot()
        
    
#    def difference(c): return sum((b[200:1700]-c*a[200:1700])**2)
#    r = minimize(difference,[1])
    
    return r.params
예제 #26
0
def Fig1(show_vib_numbers = True): ### reference spectra of methylbenzenethiol
    figure(figsize = (6,6))
    
    MBT = copy(MeOTPRef)
    MBT-=min(MBT[0:2000])
    MBT/=max(MBT[0:2000])
    

    CdMBT = copy(CdMeOTPRef)
    CdMBT.index = array(CdMBT.index)-3
    CdMBT-=min(CdMBT[0:2000])
    CdMBT/=max(CdMBT[0:2000])
    
    a = RamanSpectrum('/home/chris/Documents/DataWeiss/150408/150408_15.txt')
    
    a.autobaseline((268,440,723,915,1200,1391,1505,1680),specialoption='points', order = 4)
    a.smooth(window_len=11,window = 'SG')
    a[:]/=3000
                  
    
    MBT.plot(color = 'b',linewidth = 2)
    CdMBT.plot(color = 'k',linewidth = 2)
    a.plot(color = 'r',linewidth = 2) 
    xlim(500,1675)
    ylim(0,1.5)
    
    ylabel('Intensity (a.u.)')
    xlabel('Raman shift (cm$^{-1}$)')
         
                    
    ####Assignments
    assignmentfontsize = 10
   # annotate('Ring bending',(635,0.2), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('Ring bending',(647,0.38), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('Ring stretching',(1105,1.05), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='horizontal')
    annotate('Ring stretching',(806,1.1), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='horizontal')
    annotate('CSH bending ',(914,0.25), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
 #   annotate('CH bending ',(1190,0.33), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    #annotate('Ring stretching',(1300,0.5), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
   # annotate('CH bending',(1382,0.1), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('CC ring stretching',(1607,0.5), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')

    legend(['MTP', 'CdMTP$_2$', 'QDs-MTP'])

    matplotlib.pyplot.tight_layout()
    return 0
예제 #27
0
파일: Feb24.py 프로젝트: cmthompson/data
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
    
예제 #28
0
파일: Feb9.py 프로젝트: cmthompson/data
def Feb10():
    figure()
    a = RamanSpectrum('/home/chris/Documents/DataWeiss/150210/43_ long scan.SPE')
    
    
    adding  = pandas.Series([NaN]*len(arange(300,1500,0.5)),arange(300,1500,0.5))
    
    d=a.append(adding)
    
    d = d.interpolate(method='index')

    d = d[arange(300,1500,0.5)]
    
    e = FourierFilter(d,width = 1100)
    
    e.plot()
    
    
    b = RamanSpectrum('/home/chris/Documents/DataWeiss/150210/44.SPE')
    c=b+a
    a.autobaseline((300,1600),order = 4)
    #a = smooth(a,window_len=9)
    
    b.autobaseline((300,1600),order = 4)
    #b=smooth(b,window_len=9)
    
    #a.plot()
    #b.plot()
    
    c= autobaseline(c,(300,1600),order = 4)
    c = smooth(c, window_len=9)
    #c.plot()
    legend(['a','d','e'])
    
   
    
    return d
예제 #29
0
def Apr8Raman():
    os.chdir('/home/chris/Documents/DataWeiss/150408')
    fig = figure()
    a = RamanSpectrum('150408_15.txt')
    a.autobaseline((268,440,723,915,1200,1391,1505,1680),specialoption='points', order = 4)
    a.smooth(window_len=11,window = 'SG')
    #a+=800
    
    b = RamanSpectrum('150408_02.txt')
    #b = autobaseline(b,(200,1700),leaveout=(200,300), order = 4)
    b.autobaseline((268,440,723,915,1200,1391,1505,1680),specialoption='points', order = 4)
    b.smooth(window_len=11,window = 'SG')
    
    (normalize(MeOTPRef,(0,10000))*4000+1000).plot(color ='b',linewidth=2)
    a.plot(color = 'k',linewidth = 2)
    b.plot(color = 'r', linewidth = 2)
    
    ylim(-500,6000)
    xlim(200,1675)
    
    
    
    legend(['MeOTP ref', 'MeOTP treated','Native ligand only'])
    
    ylabel('Raman Intensity (a.u.)')
    xlabel('Raman Shift (cm$^{-1}$)')
    
    figure()
    title('Washing')
    a = RamanSpectrum('150408_11.txt')
    b = RamanSpectrum('150408_02.txt')
    a = autobaseline(a, (200,1700),leaveout=(200,300),order=4)
    b = autobaseline(b,(200,1700),leaveout=(200,300), order = 4)
   
    (normalize(ODPARef,(0,10000))*4000+2000).plot(color ='b',linewidth=2, label='ODPA Ref')
    a.plot(color = 'r',label='washed 5x')
    b.plot(color = 'k',label='washed 4x')
    #a= fitspectrum(b,(900,1150),'SixGaussian', [200,200,200,200,200,200,950,990,1026,1064,1087,1115,10,10,10,10,10,10,1,-100])
    #plot(a[1],a[2],linewidth =3,label='fit')
    legend()
    ylabel('Raman Intensity (a.u.)')
    xlabel('Raman Shift (cm$^{-1}$)')
    return 0
예제 #30
0
def Fig2(show_vib_numbers = False): ### reference spectra of methoxythiphenol
    figure(figsize = (6,6))
    a= loadtxt('/home/chris/Documents/DataWeiss/141014/4_methoxythiophenol_1.csv',
                  delimiter = ',',
                  unpack = True)
    MBT = pandas.Series(a[1],a[0])
    MBT-=min(MBT[0:2000])
    MBT/=max(MBT[0:2000])
    
    #a = loadtxt('/home/chris/Documents/DataWeiss/140918/9_MeOTP_1.txt',
    #              delimiter = ',',
    #              unpack = True)
    CdMBT = RamanSpectrum('/home/chris/Documents/DataWeiss/140918/9_CdMeOTP_1.txt')
   
    CdMBT-=min(CdMBT[200:1000])
    CdMBT/=max(CdMBT[500:2000])
    
   
    
    subplot(211)
    MBT.plot(color = 'b')
   
    
    xlim(500,1700)
    ylim(-0.01,1.2)
    ylabel('Intensity (a.u.)')
    xlabel('Raman shift (cm$^{-1}$)')
    annotate('MTP',(0.01,0.9), xycoords = 'axes fraction',
                    color = 'k',
                    horizontalalignment = 'left',
                    size = 12)
    
    
    legend(['expt', 'calc']) 
    
  
                    
                    
    ####Assignments
    assignmentfontsize = 10
    annotate('Ring bending',(647,0.25), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('Ring stretching',(1098,0.8), xytext=(1070,1.05), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='horizontal',arrowprops = {'width':2,'color':'k','headwidth':5})
    annotate('Ring stretching',(805,1.02), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='horizontal')
    annotate('CSH bending ',(914,0.25), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('CH bending ',(1190,0.35), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('Ring stretching',(1245,0.15), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    #annotate('CH bending',(1382,0.1), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='vertical')
    annotate('CC ring stretching',(1590,0.65),xytext=(1557,0.75), xycoords = 'data',horizontalalignment = 'center',verticalalignment = 'bottom',color = 'k',size = assignmentfontsize,rotation ='horizontal',arrowprops = {'width':2,'color':'k','headwidth':5})
    
    
    subplot(212)
    
    CdMBT.plot(color = 'k')
    ics('/home/chris/Orca/Successful/CdMeOTP/CdMeOTP.out',normalize=True,color = 'r', labelpeaks = False)
 
    xlim(500,1700)
    ylim(-0.01,1.6)
    ylabel('Intensity (a.u.)')
    xlabel('Raman shift (cm$^{-1}$)')
    annotate('Cd(MTP)$_2$',(0.01,0.9), xycoords = 'axes fraction',
             color = 'k',
             horizontalalignment = 'left',
             size = 12)
             
          
     ####Assignments
    #annotate('CS$_{\\nu}$',(639,0.38), xycoords = 'data',horizontalalignment = 'center',color = 'k',size = assignmentfontsize)
    #annotate('$\phi$CC$_{\\nu}$',(1088,1.05), xycoords = 'data',horizontalalignment = 'center',color = 'k',size = assignmentfontsize)
    #annotate('Ring CH$_\delta,oop$ ',(796,0.6), xycoords = 'data',horizontalalignment = 'center',color = 'k',size = assignmentfontsize)
    #annotate('$\phi$CC$_{\\nu}$ ',(1600,0.45), xycoords = 'data',horizontalalignment = 'center',color = 'k',size = assignmentfontsize)
    
    matplotlib.pyplot.tight_layout()
    return 0