コード例 #1
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
コード例 #2
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
コード例 #3
0
ファイル: SubgroupJan12.py プロジェクト: cmthompson/data
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
コード例 #4
0
ファイル: March12015.py プロジェクト: cmthompson/data
def March1():
    fluorfilelist = ["160301/160301fluor/160301_01.txt", "160301/160301fluor/160301_02.txt"]  ### PPA capped  ### oleate

    filenames = array(
        [
            "1pH5",
            "2pH5",
            "3pH5",
            "4pH5",
            "1pH7",
            "2pH7",
            "3pH7",
            "4pH7",
            "1pH8",
            "2pH8",
            "3pH8",
            "4pH8",
            "1pH9",
            "2pH9",
            "3pH5",
            "4pH9",
            "1pH11",
            "2pH11",
            "3pH11",
            "4pH11",
        ]
    )

    uvvis = loadtxt("160301/160301.csv", delimiter=",", unpack=True, skiprows=1, usecols=(0, 5, 6, 8))
    uvvis[1:] -= transpose([uvvis[1:, 0]])

    x448nm = np.where(uvvis[0] == 448)[0][0]
    x473nm = np.where(uvvis[0] == 473)[0][0]
    print x473nm
    uvvis[3] -= uvvis[3, x448nm]

    for i in uvvis[1:]:
        plot(uvvis[0], i)
    figure()
    absorbances_dots = uvvis[1:3, x473nm]
    plot(absorbances_dots)
    figure()
    absorbance_anth = uvvis[-1, x473nm]

    fluorescencedots = array([])
    nliq = 1.333
    nE = 1.359

    s = RamanSpectrum("160301/160301fluor/160301_03.txt")
    indy = 10 ** 7 / (10 ** 7 / 473 - s.index)
    rhodB = RamanSpectrum(pandas.Series(s.values, indy))
    rhodBarea = rhodB.calc_area((500, 700))
    rhodB *= 0.65 * (1 - 10 ** (-absorbance_anth)) * nE ** 2 / nE ** 2 / rhodBarea / (1 - 10 ** (-absorbance_anth))
    print rhodB.calc_area((500, 700))
    # rhodB.plot()

    ## PPA capped dots
    s = RamanSpectrum(fluorfilelist[0])
    indy = 10 ** 7 / (10 ** 7 / 473 - s.index)
    s = RamanSpectrum(pandas.Series(s.values, indy))
    s *= 0.65 * (1 - 10 ** (-absorbance_anth)) * nliq ** 2 / nE ** 2 / rhodBarea / (1 - 10 ** (-absorbances_dots[0]))
    s.plot()
    print "PPA capped CdSe dots QY:", s.calc_area((490, 650))

    #### oleate dots
    s = RamanSpectrum(fluorfilelist[1])
    indy = 10 ** 7 / (10 ** 7 / 473 - s.index)
    s = RamanSpectrum(pandas.Series(s.values, indy))
    s *= 0.65 * (1 - 10 ** (-absorbance_anth)) * 1.375 ** 2 / nE ** 2 / rhodBarea / (1 - 10 ** (-absorbances_dots[1]))
    s.plot()
    print "oleate capped CdSe dots QY:", s.calc_area((490, 650))

    return 0
def MBTSeries():
    """methylbenzenethiol exchanged CdSe quantum dots on June12"""
    clf()
    ax1 = gca()
    
    chdefarea=array([])
    thiolarea=array([])
    
    
    native= RamanSpectrum('/home/chris/Dropbox/DataWeiss/150612/150612_01_CdSe.txt') ###### Native ligand only
    native[:]/=2
    #native=removespikes(native)
    native.autobaseline((911,1196,1385,1515,1800),join='start',specialoption='points',order=7)
    native.autobaseline((600,690,826,861,911),specialoption='points', order = 5,join='end')
   
    
    eightyfour= RamanSpectrum('/home/chris/Dropbox/DataWeiss/150623/150623_7.txt') ###### 84 eq
    eightyfour[:]/=2
    #eightyfour=removespikes(eightyfour)
    eightyfour.autobaseline((764,838),order = 0,join='start')
    eightyfour.autobaseline((838,2000),order = 1,join='start')
    eightyfour.autobaseline((600,690,826,861,900,1196,1385,1515,1657),specialoption='points',order=7)
   # eightyfour.smooth()
    

    
    
    sixhundredforty= RamanSpectrum('/home/chris/Dropbox/DataWeiss/150617/150617_01.txt')  ###### 640 eq MBT
    #sixhundredforty=removespikes(sixhundredforty)
    sixhundredforty.autobaseline((803,861),order=1, join='start')
    sixhundredforty.autobaseline((861,1254),order = 2, join='start')
    sixhundredforty.autobaseline((1254,1515),order = 4, join = 'start')
    sixhundredforty.autobaseline((1515,2000),order = 3, join = 'start')
    sixhundredforty.autobaseline((555,613,764,1141,1321,1565,1652),specialoption='points',order=6)
    #sixhundredforty.smooth()
    
    thirtytwo=RamanSpectrum('/home/chris/Dropbox/DataWeiss/150623/150623_10.txt')  ###### 32 equivalents
    #thirtytwo=removespikes(thirtytwo)
    thirtytwo.autobaseline((300,862),order = 1,join='start')
    thirtytwo.autobaseline((786,862),order = 0,join='start')
    thirtytwo.autobaseline((862,1425),order = 2,join='start')
    thirtytwo.autobaseline((1425,1439),order = 1,join='start')
    thirtytwo.autobaseline((1439,2000),order = 2,join='start')
    x = RamanSpectrum('/home/chris/Dropbox/DataWeiss/150623/150623_12.txt')
    #x= removespikes(x)
    x.autobaseline((740,1441),order = 1)
    thirtytwo=add_RamanSpectra(thirtytwo,x)
    thirtytwo.autobaseline((740,764,1052,1141,1321,1425,1441),specialoption='points',order=2)
   # thirtytwo.smooth()
    
    
    oneseventynine=RamanSpectrum('/home/chris/Dropbox/DataWeiss/150623/150623_16.txt')  ###### 179 equivalents
   # oneseventynine=removespikes(oneseventynine)
    oneseventynine.autobaseline((300,793),order = 1,join='start')
    oneseventynine.autobaseline((793,862),order = 1,join='start')
    oneseventynine.autobaseline((862,1460),order = 1,join='start')
    oneseventynine.autobaseline((1460,1486),order = 1,join='start')
    oneseventynine.autobaseline((1486,2000),order = 1,join='start')
    oneseventynine.autobaseline((740,764,1052,1141,1321,1425,1441,1700),specialoption='points',order=2)
    #oneseventynine.smooth()
    
    mbt = CdMethylTPRef.copy()
    mbt[:]/=10
    
    lw = 2
    thirtytwo[:]+=200
    eightyfour[:]+=700
    oneseventynine[:]+=1000
    sixhundredforty[:]+=1550
    mbt[:]+=1950
    
    
    chtwistarea=array([native.calc_area((1285,1332)),thirtytwo.calc_area((1285,1332)),eightyfour.calc_area((1285,1332)),oneseventynine.calc_area((1285,1332)),sixhundredforty.calc_area((1285,1332)),mbt.calc_area((1285,1332))])
    chdefarea=array([native.calc_area((1413,1475)),thirtytwo.calc_area((1413,1475)),eightyfour.calc_area((1413,1475)),oneseventynine.calc_area((1413,1475)),sixhundredforty.calc_area((1413,1475)),mbt.calc_area((1413,1475))])
    thiolarea1=array([native.calc_area((1587,1611)),thirtytwo.calc_area((1587,1611)),eightyfour.calc_area((1587,1611)),oneseventynine.calc_area((1587,1611)),sixhundredforty.calc_area((1587,1611)),mbt.calc_area((1587,1611))])
    
    fits1 = list()
    fits2 = list()
    
    a = [thirtytwo, eightyfour, oneseventynine, sixhundredforty, mbt]
    a.reverse()
    for i in a:
        i.plot(linewidth=lw,axes=ax1)
    native.plot(linewidth = lw,axes=ax1)
    
    ax1.set_ylabel('Intensity (a.u.)')
    ax1.set_xlabel('Raman shift (cm$^{-1}$')
    legend(['solid', '640eq','179', '84eq','32eq','0'])
    ax1.set_xlim(500,1800)
    ax1.set_ylim(0,10000)
    

    
    ax2 = figure().add_subplot(111)
    for i in [thirtytwo, eightyfour, oneseventynine, sixhundredforty]:
        guess = [100,500,500,1065,1080,1085,7, 7,7,0,i[1100]]
        r = fitspectrum(i,(1050,1105), 'xGaussian', guess)
        for p in r.peaks:
            ax1.plot(r.x, p,'k', linewidth = 2)
        fits1.append(r.areas[1]/r.areas[2]) 
    ax2.plot([32,84,179,640],fits1,'rs-', label='1')
    
    return None
コード例 #6
0
ファイル: UVVistools.py プロジェクト: cmthompson/data
def indivQY(
    UVVisfile,
    UVViscolumn,
    anthracenecolumn,
    fluorescencefile,
    anthracenefluorescencefile,
    subtractfluorfile=None,
    UVVisplot=None,
    fluorplot=None,
    fluorescencerange=(410, 473),
    excitationwavelength=350,
    nliq=1.333,
    day=0,
    label=None,
    color="k",
    _plot_standard=False,
    subtract_smooth_background_for_anthracene=False,
):
    print "-------------------------------------"
    print "calculating fluorescence yield for", label, "file", fluorescencefile
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    if len(UVViscolumn) == 1:
        numuvviscolumn = alphabet.find(UVViscolumn)
    elif len(UVViscolumn) == 2:
        numuvviscolumn = alphabet.find(UVViscolumn[0]) * 26 + alphabet.find(UVViscolumn[1])

    a = loadtxt(
        UVVisfile, delimiter=",", unpack=True, skiprows=1, usecols=(0, numuvviscolumn, alphabet.find(anthracenecolumn))
    )

    a[1:] -= transpose([a[1:, 0]])

    anthracene = RamanSpectrum(pandas.Series(a[2][::-1], a[0][::-1]))
    dot = RamanSpectrum(pandas.Series(a[1][::-1], a[0][::-1]))

    if subtract_smooth_background_for_anthracene:
        anthracene.smoothbaseline((290, 300), (390, 400))

    anthracene[:] -= anthracene[389]

    anthraceneabsorbance350 = anthracene[excitationwavelength]
    absvalues = dot[excitationwavelength]

    nE = 1.359
    nQ = 1.44
    nW = 1.333  ## refractive index water

    a = loadtxt(anthracenefluorescencefile, delimiter="\t", unpack=True, skiprows=2, usecols=(0, 3))
    a[1] -= a[1, -1]
    anthracenefluorescence = RamanSpectrum(pandas.Series(a[1], a[0]))

    ###Normalizing to value of anthracene at 420 nm The area for the anthracene fluorescence is related to this value by 78.203
    #  anthracenefluorescencearea = anthracenefluorescence[420]*78.2032212661
    #  anthracenefluorescencearea = anthracenefluorescence[440]*292.86
    anthracenefluorescencearea = anthracenefluorescence[470] * 1257
    print "anthracene fluorescence area=", "%.2E" % anthracenefluorescencearea
    print anthracenefluorescence.calc_area((355, 550)) / anthracenefluorescence[
        470
    ], "ratio of total anthracene fluorescence area to value at 470"

    oneminusTdot = 1 - 10 ** (-absvalues)  ##### gives the fraction of photons absorbed by dots

    oneminusT_anthracene350 = 1 - 10 ** (-anthraceneabsorbance350)
    print "anthracene absorbance at 350 nm:", anthraceneabsorbance350, ". Fraction photons absorbed:", oneminusT_anthracene350
    print "dot absorbance at 350 nm:", absvalues, ". Fraction photons absorbed:", oneminusTdot

    a = loadtxt(fluorescencefile, delimiter="\t", unpack=True, skiprows=2, usecols=(0, 3))
    hi = RamanSpectrum(pandas.Series(a[1], a[0]))
    if subtractfluorfile != None:
        b = loadtxt(subtractfluorfile, delimiter="\t", unpack=True, skiprows=1, usecols=(0, 3))
        fluorbackground = RamanSpectrum(pandas.Series(b[1], b[0]))
        hi[:] -= fluorbackground[:]
        fluorbackground.plot(ax=fluorplot)
    hi.plot(ax=fluorplot)

    hi[:] -= min(hi[400:500])
    hi[:] *= (
        0.27
        / (1 + 0.00145 * 158)
        * oneminusT_anthracene350
        * nliq ** 2
        / nE ** 2
        / anthracenefluorescencearea
        / oneminusTdot
    )

    dotfluorescencearea = hi.calc_area(fluorescencerange, fill=False)

    ## quantum yield of dots using 0.27 as QY for anthracene with o2 quenching corrrection
    print "fluorescence (bande edg) yield of dot", dotfluorescencearea

    if UVVisplot is not None:
        if _plot_standard:
            anthracene.plot(ax=UVVisplot)  # plot(a[0],anthracene)
        dot.plot(ax=UVVisplot, label=label)
    if fluorplot is not None:
        hi.plot(ax=fluorplot, label=label)
        if _plot_standard:
            anthracenefluorescence.plot(ax=fluorplot, label=label)

    return dotfluorescencearea
コード例 #7
0
ファイル: UVVistools.py プロジェクト: cmthompson/data
def indivCdSeQY(
    UVVisfile,
    UVViscolumn,
    rhodaminecolumn,
    fluorescencefile,
    rhodaminefluorescencefile,
    excitationwavelength=None,
    standardfluorescencerange=None,
    baselineabsorbanceat=None,
    UVVisplot=None,
    fluorplot=None,
    fluorescencerange=(500, 600),
    nliq=1.333,
    day=0,
    label=None,
    color="k",
):
    print "-------------------------------------"
    print "calculating fluorescence yield for", label, "file", fluorescencefile
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    if len(UVViscolumn) == 1:
        numuvviscolumn = alphabet.find(UVViscolumn)
    elif len(UVViscolumn) == 2:
        # print 'longer',alphabet.find(UVViscolumn[0]),alphabet.find(UVViscolumn[1])
        numuvviscolumn = (alphabet.find(UVViscolumn[0]) + 1) * 26 + alphabet.find(UVViscolumn[1])

    a = loadtxt(
        UVVisfile, delimiter=",", unpack=True, skiprows=1, usecols=(0, numuvviscolumn, alphabet.find(rhodaminecolumn))
    )

    a[1:] -= transpose([a[1:, 0]])

    rhodamine = RamanSpectrum(pandas.Series(a[2][::-1], a[0][::-1]))
    dot = RamanSpectrum(pandas.Series(a[1][::-1], a[0][::-1]))

    if baselineabsorbanceat != None:
        dot -= dot[baselineabsorbanceat]

    rhodamine[:] -= rhodamine[700]

    rhodamineabsorbance350 = rhodamine[excitationwavelength]  # (rhodamine[374]-anthracene[389])*0.6735#
    absvalues = dot[excitationwavelength]

    nE = 1.359
    nQ = 1.44
    nW = 1.333  ## refractive index water

    a = loadtxt(rhodaminefluorescencefile, delimiter="\t", unpack=True, skiprows=1, usecols=(0, 3))
    a[1] -= a[1, -1]
    standardfluorescence = RamanSpectrum(pandas.Series(a[1], a[0]))

    ###Normalizing to area of rhodamine B
    # pdb.set_trace()
    standardfluorescencearea = standardfluorescence.calc_area(standardfluorescencerange)
    print "standard fluorescence area=", "%.2E" % standardfluorescencearea

    oneminusTdot = 1 - 10 ** (-absvalues)  ##### gives the fraction of photons absorbed by dots

    oneminusT_rhodamine350 = 1 - 10 ** (
        -rhodamineabsorbance350
    )  ##### gives the fraction of photons absorbed by standard
    print "rhodamine absorbance at", excitationwavelength, "nm:", rhodamineabsorbance350, ". Fraction photons absorbed:", oneminusT_rhodamine350
    print "dot absorbance at ", excitationwavelength, " nm:", absvalues, ". Fraction photons absorbed:", oneminusTdot

    a = loadtxt(fluorescencefile, delimiter="\t", unpack=True, skiprows=1, usecols=(0, 3))
    hi = RamanSpectrum(pandas.Series(a[1], a[0]))
    hi[:] -= min(hi)
    hi[:] *= 0.65 * oneminusT_rhodamine350 * nliq ** 2 / nE ** 2 / standardfluorescencearea / oneminusTdot

    dotfluorescencearea = hi.calc_area(fluorescencerange, fill=False)

    print "fluorescence (bande edge) yield of dot", dotfluorescencearea

    if UVVisplot is not None:
        # rhodamine.plot(ax=UVVisplot))
        dot.plot(ax=UVVisplot, label=label)
    if fluorplot is not None:
        hi.plot(ax=fluorplot, label=label)
    # standardfluorescence.plot(ax = fluorplot,label=label)

    return dotfluorescencearea