本文整理匯總了Python中ramanTools.RamanSpectrum類的典型用法代碼示例。如果您正苦於以下問題:Python RamanSpectrum類的具體用法?Python RamanSpectrum怎麽用?Python RamanSpectrum使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RamanSpectrum類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Fig2
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: n
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: Mar31
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: spinning
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: May14
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: m
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: today
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: n2
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: Jan18
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: Mar24
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: May21
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: N2
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: Feb1
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: smooth_phonon
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: Oct17NMRfitting
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