Ejemplo n.º 1
0
    return angle(y) - angle(y)[0]


def power2dBnormalized(x):
    return 10 * log10(abs(x)) - max(10 * log10(abs(x)))


def field2dBnormalized(x):
    return 20 * log10(abs(x)) - max(20 * log10(abs(x)))


if __name__ == '__main__':
    #overcoupled ring amplitude is trace number 10

    phase = '/home/joaquin/Documents/reports/20121025_dispersionAnillos_/data/dispersionV740D9_TMringsTErings.dat'
    xp, yp = importap(phase)

    #    +p[4]*(x-1530)+p[5]*(x-1530)**2+p[6]+p[7]*sin(2*pi*x/p[8])
    fitfunc2 = lambda p, x: unwrap(
        angle(ring(x * 1e-9, p[0], p[1], p[2], p[3])))  # Target function
    errfunc2 = lambda p, x, y: fitfunc2(
        p, x) - y  # Distance to the target function

    index1560 = where(xp[12] > 1560)[0][0]
    #    index1560=-1
    indexTrace = 14
    indexTraceNoRing = 13

    xpOverCoupled = xp[indexTrace][0:index1560]
    ypOverCoupled = -yp[indexTrace][0:index1560] + interp(
        xpOverCoupled, xp[indexTraceNoRing], yp[indexTraceNoRing])
Ejemplo n.º 2
0
def main():
    #overcoupled ring amplitude is trace number 10
    phase = 'dispersionV740D9_TMringsTErings.dat'
    xphase, yphase = importap(phase)
    indexTrace = 12
    indexTraceNoRing = 13

    index1560 = where(xphase[indexTrace] > 1560)[0][0]
    xp = xphase[indexTrace][0:index1560]
    yp = yphase[indexTrace][0:index1560]

    dataShift = 21
    yp = -yphase[indexTrace][0:index1560] + interp(
        xphase[indexTrace][dataShift:index1560 + dataShift],
        xphase[indexTraceNoRing], yphase[indexTraceNoRing])

    amp = 'linearV740D9_TMrings_TErings.dat'
    xamp, yamp = importaa(amp)
    indexTraceNoRing = 11
    indexTrace = 10

    index1560 = where(xamp[10] > 1560)[0][0]
    xa = xamp[indexTrace][0:index1560]
    ya = 10**((yamp[indexTrace][0:index1560] -
               interp(xamp[indexTrace][0:index1560], xamp[indexTraceNoRing],
                      yamp[indexTraceNoRing])) / 20)
    ya = ya / max(ya)
    x = xa
    y = ya * exp(1j * yp)

    fitfunc = lambda p, x: ring(x * 1e-9, p[0], p[1], p[2], p[
        3])  # Target function ring(x,phi=0,k=0.3,A=0.99,ng=4.36,R=20e-6)
    errfunc = lambda p, x, y: abs(real(fitfunc(p, x) - y)) + abs(
        imag(fitfunc(p, x) - y))  # Distance to the target function
    p0 = [3, 0.3, .9, 4.3526515]  # Initial guess for the parameters

    p1, success = optimize.leastsq(errfunc, p0[:], args=(x, y))
    ax1 = subplot(211)
    plot(x, abs(y), '-', x, abs(fitfunc(p1, x)), '--')
    ylabel('Transmission')
    ax1.yaxis.set_label_coords(-0.1, 0.5)

    title(
        '$ 200nm-gap $ Overcoupled ring ($k=0.350$, $\mathrm{A=0.963}$, $n_g=4.36$)'
    )
    #    yticks(arange(0,1.1,0.2),('0','','','','','1'))
    yticks([0, 1], ('0', '1'))
    xticks([1530, 1560], ['', ''])

    #    xticks(arange(1530,1561,5),repeat('',shape(arange(1530,1561,5))[-1]))

    print 'p0 = [phi,k,A,ng] = ', p0
    print 'p1 = [phi,k,A,ng] = ', p1
    a = p1[2]
    print 'losses = ', -log(a) / pi / (20e-6 * 100) * 10 / log(10)
    print 20 * log10(p1[2]) / (2 * pi * 20e-6 * 100)

    #    a=exp(-alfa*L/2)=exp(-alfa*2*pi*R/2)=exp(-alfa*pi*R)
    #    log(a)=-alfa*pi*R
    #    alfa = -log(a)/pi/R [m^-1]

    print -log(a) / pi / 20e-4
    print 20 * log10((p1[2]) / (2 * pi * 20e-6 * 100))

    ax2 = subplot(212)
    ax2.yaxis.grid(True)
    plot(x, -unwrap(angle(y)) / pi, x, -unwrap(angle(fitfunc(p1, x))) / pi,
         '--')
    ylabel('Phase (rad)')
    ola = ax2.yaxis.set_label_coords(-0.1, 0.5)
    xlabel('Wavelength (nm)')
    legend(('data', 'fit'), loc=8)

    yticks(
        [0, 2, 4, 6, 8, 10, 12],
        ('$0$', '$2\pi$', '$4\pi$', '$6\pi$', '$8\pi$', '$10\pi$', '$12\pi$'))
    #    xticks(arange(1530,1561,5),['1530','','','','','','1560'])
    xticks([1530, 1560], ['1530', '1560'])
    savefig('r20g200TE_fitPhaseAmp.eps')
    show()
    return
Ejemplo n.º 3
0
def main():
    #corrugated 6 (27\mum)','corrugated 1 (450\mum)
    x6, y6 = importap(
        '/home/joaquin/Dropbox/reports/20110724_DispersionSara/dataJoaquin/corrugada6_setbottom_scan_all.dat',
        [0])
    x1, y1 = importap(
        '/home/joaquin/Dropbox/reports/20110724_DispersionSara/dataJoaquin/corrugada1_setbottom_C11_Pin=-1.dat',
        [0])
    c = 3e8
    x1t = x1[0][31:300]  # from 1569 to 1596~nm
    y1t = y1[0][31:300]
    x6t = x6[0]
    y6t = y6[0]
    w1 = 2 * pi * c / (x1t * 1e-9) - 2 * pi * c / 1574e-9
    yw1 = y1t
    w6 = 2 * pi * c / (x6t * 1e-9) - 2 * pi * c / 1564e-9
    yw6 = y6t
    xmin = 1e-6 * array([
        1.563778713098983, 1.564429468006409, 1.565494339673106,
        1.566559211339802, 1.568038199765770, 1.569517188191737,
        1.571232814765860, 1.573007600877021, 1.575196503747453,
        1.577267087543807, 1.579810947636471, 1.581999850506903,
        1.584129593840296, 1.586495975321844, 1.588684878192276,
        1.591051259673824, 1.592589407636830, 1.595014948655417,
        1.596553096618423, 1.598327882729584, 1.599511073470358,
        1.600990061896326, 1.602232412174138, 1.603297283840835,
        1.604184676896416
    ])
    x = linspace(min(xmin), max(xmin), len(yw6))
    w = 2 * pi * 3e8 / x - 2 * pi * 3e8 / 1574e-9

    orderPol = 5
    p1 = polyfit(w1, yw1, orderPol)
    p6 = polyfit(w6, yw6, orderPol)
    figure(2)
    plot(x1t, yw1, x6t, yw6, x1t, polyval(p1, w1), x6t, polyval(p6, w6), x1t,
         polyval(p1 - p6, w1))

    figure(3)
    subplot(212)
    plot(x * 1e9, 7.8 - c / 423e-6 * polyval(polyder(p1 - p6), w), 'b-')

    ax = subplot(211)
    ax.set_title(
        '(a)',
        ha='left',
    )

    aa = '/home/joaquin/Dropbox/reports/20121025_dispersionAnillos/data/linear_santec0dBm_V740_C11_MiddleSet_18deg_corrugadas_Antoine.dat'
    xmzi, ymzi = importaa(aa, [0, 1], 0)

    xmin = 1e-6 * array([
        1.563778713098983, 1.564429468006409, 1.565494339673106,
        1.566559211339802, 1.568038199765770, 1.569517188191737,
        1.571232814765860, 1.573007600877021, 1.575196503747453,
        1.577267087543807, 1.579810947636471, 1.581999850506903,
        1.584129593840296, 1.586495975321844, 1.588684878192276,
        1.591051259673824, 1.592589407636830, 1.595014948655417,
        1.596553096618423, 1.598327882729584, 1.599511073470358,
        1.600990061896326, 1.602232412174138, 1.603297283840835,
        1.604184676896416
    ])
    ymin = array([
        -30.112883270882282, -30.319110314265075, -31.040904966104854,
        -32.037669009121686, -33.137546573829916, -34.031197095155349,
        -35.612271094423434, -37.090231572000121, -37.708912702148496,
        -41.420999483038770, -42.658361743335533, -42.830217612821194,
        -48.054636045185291, -44.273806916500746, -47.848409001802494,
        -46.164221480843018, -47.917151349596757, -49.223255957687783,
        -48.707688349230800, -50.976185826441522, -51.801093999972693,
        -51.251155217618582, -51.319897565412845, -53.554023868726439,
        -51.732351652178437
    ])
    xmax = 1e-6 * array([
        1.564133670321216, 1.564961903839758, 1.566026775506454,
        1.567150806710189, 1.568748114210234, 1.570227102636202,
        1.571942729210324, 1.574249951154833, 1.576083896803033,
        1.578331959210504, 1.580757500229090, 1.583301360321754,
        1.585312784581070, 1.587383368377425, 1.589868068933050,
        1.591997812266443, 1.593890917451682, 1.595665703562843,
        1.597440489674004, 1.598682839951816, 1.600161828377784,
        1.601640816803751, 1.602764848007487, 1.603474762451951,
        1.604598793655686
    ])
    ymax = array([
        -29.700429184116697, -29.597315662425299, -29.562944488528167,
        -30.112883270882282, -29.459830966836773, -29.666058010219565,
        -30.284739140367943, -31.144018487796249, -31.762699617944627,
        -32.793834834858593, -33.378144791109840, -34.306166486332408,
        -34.924847616480790, -36.987118050308723, -37.468314484868571,
        -39.221244353622311, -40.939803048478922, -41.317885961347379,
        -43.620754612455229, -43.792610481940898, -47.092243176065587,
        -47.332841393345511, -47.092243176065587, -47.882780175699622,
        -50.701216435264470
    ])

    xlim(1563, 1605)
    ylim(-55, -29)
    xticks([1570, 1600], ('', ''))
    yticks([-30, -55], (
        '-30',
        '-55',
    ))
    ylabel('Transmission (dB)')
    ax.yaxis.set_label_coords(-0.1, 0.5)
    plot(xmzi[0], ymzi[0], 'b-', xmin * 1e9, ymin, 'go', xmax * 1e9, ymax,
         'go')
    legend()

    ax2 = subplot(212)
    title('(b)')
    ng2 = (xmin * xmax) / 2 / 450e-6 / abs(xmin - xmax) + 4.36

    plot(xmin * 1e9, ng2, 'go')
    xlabel('Wavelength (nm)')
    ylabel('Group index')
    xticks([1570, 1600], ('1570', '1600'))
    yticks([7, 9, 11, 13], ('7', '9', '11', '13'))
    xlim(1563, 1605)
    ylim([6, 14])
    legend(('Heterodyne', 'fringes'), loc=9)
    savefig('gropIndexComparison_2.png')
    savefig('gropIndexComparison_2.eps')
    show()
    return
Ejemplo n.º 4
0
def main():
    #corrugated 6 (27\mum)','corrugated 1 (450\mum)

    xmin = 1e-6 * array([
        1.563778713098983, 1.564429468006409, 1.565494339673106,
        1.566559211339802, 1.568038199765770, 1.569517188191737,
        1.571232814765860, 1.573007600877021, 1.575196503747453,
        1.577267087543807, 1.579810947636471, 1.581999850506903,
        1.584129593840296, 1.586495975321844, 1.588684878192276,
        1.591051259673824, 1.592589407636830, 1.595014948655417,
        1.596553096618423, 1.598327882729584, 1.599511073470358,
        1.600990061896326, 1.602232412174138, 1.603297283840835,
        1.604184676896416
    ])

    x6, y6 = importap(
        '/home/joaquin/Dropbox/reports/20110724_DispersionSara/dataJoaquin/corrugada6_setbottom_scan_all.dat',
        [0])
    x1, y1 = importap(
        '/home/joaquin/Dropbox/reports/20110724_DispersionSara/dataJoaquin/corrugada1_setbottom_C11_Pin=-1.dat',
        [0])
    c = 3e8

    x1t = x1[0][31:300]  # from 1569 to 1596~nm
    y1t = y1[0][31:300]

    x6t = x6[0]
    y6t = y6[0]

    w1 = 2 * pi * c / (x1t * 1e-9) - 2 * pi * c / 1574e-9
    yw1 = y1t

    w6 = 2 * pi * c / (x6t * 1e-9) - 2 * pi * c / 1564e-9
    yw6 = y6t

    figure(1)
    plot(x1t, y1t, x6t, y6t)

    orderPol = 5

    p1 = polyfit(w1, yw1, orderPol)
    p6 = polyfit(w6, yw6, orderPol)

    figure(2)
    plot(w1, yw1, w6, yw6, w1, polyval(p1, w1), w6, polyval(p6, w6), w1,
         polyval(p1 - p6, w1))

    figure(3)
    subplot(211)
    p = polyfit(w6, (interp(w6, w1, yw1) - yw6) / 423e-6, orderPol)

    #    plot(x1t,7.8-1/423e-6*polyval(polyder(p1-p6),w1))
    plot(x1t, 7.8 - c / 423e-6 * polyval(polyder(p1 - p6), w1))

    subplot(212)

    aa = '/home/joaquin/Dropbox/reports/20121025_dispersionAnillos/data/linear_santec0dBm_V740_C11_MiddleSet_18deg_corrugadas_Antoine.dat'
    xmzi, ymzi = importaa(aa, [0, 1], 0)

    #    from scipy.io import loadmat
    #    loadmat('/home/joaquin/Dropbox/samples/V740/linear/maxYminCorr1001.mat')

    xmin = 1e-6 * array([
        1.563778713098983, 1.564429468006409, 1.565494339673106,
        1.566559211339802, 1.568038199765770, 1.569517188191737,
        1.571232814765860, 1.573007600877021, 1.575196503747453,
        1.577267087543807, 1.579810947636471, 1.581999850506903,
        1.584129593840296, 1.586495975321844, 1.588684878192276,
        1.591051259673824, 1.592589407636830, 1.595014948655417,
        1.596553096618423, 1.598327882729584, 1.599511073470358,
        1.600990061896326, 1.602232412174138, 1.603297283840835,
        1.604184676896416
    ])
    ymin = array([
        -30.112883270882282, -30.319110314265075, -31.040904966104854,
        -32.037669009121686, -33.137546573829916, -34.031197095155349,
        -35.612271094423434, -37.090231572000121, -37.708912702148496,
        -41.420999483038770, -42.658361743335533, -42.830217612821194,
        -48.054636045185291, -44.273806916500746, -47.848409001802494,
        -46.164221480843018, -47.917151349596757, -49.223255957687783,
        -48.707688349230800, -50.976185826441522, -51.801093999972693,
        -51.251155217618582, -51.319897565412845, -53.554023868726439,
        -51.732351652178437
    ])
    xmax = 1e-6 * array([
        1.564133670321216, 1.564961903839758, 1.566026775506454,
        1.567150806710189, 1.568748114210234, 1.570227102636202,
        1.571942729210324, 1.574249951154833, 1.576083896803033,
        1.578331959210504, 1.580757500229090, 1.583301360321754,
        1.585312784581070, 1.587383368377425, 1.589868068933050,
        1.591997812266443, 1.593890917451682, 1.595665703562843,
        1.597440489674004, 1.598682839951816, 1.600161828377784,
        1.601640816803751, 1.602764848007487, 1.603474762451951,
        1.604598793655686
    ])
    ymax = array([
        -29.700429184116697, -29.597315662425299, -29.562944488528167,
        -30.112883270882282, -29.459830966836773, -29.666058010219565,
        -30.284739140367943, -31.144018487796249, -31.762699617944627,
        -32.793834834858593, -33.378144791109840, -34.306166486332408,
        -34.924847616480790, -36.987118050308723, -37.468314484868571,
        -39.221244353622311, -40.939803048478922, -41.317885961347379,
        -43.620754612455229, -43.792610481940898, -47.092243176065587,
        -47.332841393345511, -47.092243176065587, -47.882780175699622,
        -50.701216435264470
    ])
    plot(xmzi[0], ymzi[0], xmax * 1e9, ymax, 'g.', xmin * 1e9, ymin, 'g.')
    xlim(1563, 1605)
    ylim(-55, -29)
    xticks([1570, 1580, 1590, 1600], ('1570', '1580', '1590', '1600'))
    xlabel('Wavelenght (nm)')
    ylabel('Transmission (dB)')

    #
    ##    approximate_taylor_polynomial(y,0,2,1)
    #
    #    figure(3)
    #    ng = 1580e-9**2/diff(xmin)/450e-6 + 4.36

    ng2 = (xmin * xmax) / 2 / 450e-6 / abs(xmin - xmax) + 4.36

    #    plot(xmin[0:-1]*1e9,ng,'o')
    plot(xmin * 1e9, ng2, 'o')
    xlabel('Wavelenght (nm)')
    ylabel('Group index')
    xticks([1570, 1580, 1590, 1600], ('1570', '1580', '1590', '1600'))
    yticks([7, 9, 11, 13], ('7', '9', '11', '13'))
    #    xlim([1563,1603])
    ylim([6, 14])
    legend(('Heterodyne', 'fringes'), ncol=2, mode="expand", loc=2)

    #    legend(["Heterodyne"], loc=1, ["fringes"], loc=4)
    #    l2 = legend([p2], ["fringes"], loc=4) # this removes l1 from the axes.
    #    gca().add_artist(l1) # add l1 as a separate artist to the axes

    #    ng2 = 1580e-9**2/diff(xmax*1e-9)/450e-6 + 4.36
    #    plot(xmax[0:-1],ng2,'+')

    # this is another inset axes over the main axes
    #    a = axes([0.25, 0.5, .5, .3], axisbg='y')
    plot(xmzi[0], ymzi[0], xmin * 1e9, ymin, 'o', xmax * 1e9, ymax, 'go')

    #    setp(a, xlim=(1563,1605),ylim=(-55,-29), xticks=[],yticks=[])

    savefig('gropIndexComparison_2.png')
    savefig('gropIndexComparison_2.eps')
    show()
    #    w1 = 2*pi/(x1t*1e-9) -2*pi/1585e-9
    #    yw1 = y1t
    #
    #    w6 = 2*pi/(x6[0]*1e-9) -2*pi/1585e-9
    #    yw6 = y6[0]
    #
    #    orderPol = 6
    #
    #
    ##    approximate_taylor_polynomial(y,0,2,1)
    #
    #    p1 = polyfit(w1,yw1,orderPol)
    #    p6 = polyfit(w6,yw6,orderPol)
    #
    #    plot(w1,yw1,w6,yw6)

    return
Ejemplo n.º 5
0
def main():
    #overcoupled ring amplitude is trace number 10
    phase = 'dispersionV740D9_TMringsTErings.dat'
    xphase, yphase = importap(phase)
    indexTrace = 14
    indexTraceNoRing = 13

    index1560 = where(xphase[indexTrace] > 1560)[0][0]
    xp = xphase[indexTrace][0:index1560]
    yp = yphase[indexTrace][0:index1560]

    dataShift = 21
    yp = -yphase[indexTrace][0:index1560] + interp(
        xphase[indexTrace][dataShift:index1560 + dataShift],
        xphase[indexTraceNoRing], yphase[indexTraceNoRing])

    amp = 'linearV740D9_TMrings_TErings.dat'
    xamp, yamp = importaa(amp)
    indexTraceNoRing = 11
    indexTrace = 12

    index1560 = where(xamp[10] > 1560)[0][0]
    xa = xamp[indexTrace][0:index1560]
    ya = 10**((yamp[indexTrace][0:index1560] -
               interp(xamp[indexTrace][0:index1560], xamp[indexTraceNoRing],
                      yamp[indexTraceNoRing])) / 20)
    ya = ya / max(ya)

    x = xa
    y = ya * exp(1j * yp)

    fitfunc = lambda p, x: ring(x * 1e-9, p[0], p[1], p[2], p[3]
                                )  # Target function
    errfunc = lambda p, x, y: abs(real(fitfunc(p, x) - y)) + abs(
        imag(fitfunc(p, x) - y))  # Distance to the target function

    p0 = [8.8, 0.3, .9, 4.3526515]  # Initial guess for the parameters

    p1, success = optimize.leastsq(errfunc, p0[:], args=(x, y))
    ax1 = subplot(211)
    plot(x, abs(y), '-', x, abs(fitfunc(p1, x)), '--')
    ylabel('Transmission')
    ax1.yaxis.set_label_coords(-0.1, 0.5)
    legend(('data', 'fit'), loc=8)
    title(
        '$ 275nm-gap $ Undercoupled ring ($k=0.217$, $\mathrm{A=0.934}$, $n_g=4.35$)'
    )
    yticks([0, 1], ('0', '1'))
    xticks([1530, 1560], ['', ''])

    print 'p0='
    print p0

    a = p1[2]
    print 'p1='
    print p1
    alpha = -log(a**2) / (2 * pi * 20e-6 * 100)  # cm^-1
    alphadBcm = -log(a**2) / (2 * pi * 20e-6 * 100)  # cm^-1

    ax2 = subplot(212)
    plot(x, angle(y) / pi, x, angle(fitfunc(p1, x)) / pi, '--')
    ylabel('Phase (rad)')
    ax2.yaxis.set_label_coords(-0.1, 0.5)
    xlabel('Wavelength (nm)')
    yticks([-0.5, .5], ('$-\pi/2$', '$\pi/2$'))

    xticks([1530, 1560], ['1530', '1560'])
    savefig('r20g275TE_fitPhaseAmp.eps')
    show()
    return