Пример #1
0
def ReflQ_mag(Q, lamda, n, d, sigma, n_u, dd_u, sigma_u, n_l, dd_l, sigma_l):
    '''Calculate the reflectivity from a multilayer stack with
       Abeles matrix formalism. '''
    #pdb.set_trace()
    k_vac = 2*np.pi/lamda
    kz = Q[:, np.newaxis]/2.0
    n_amb2 = (n[:,-1]*n[:,-1])[:,np.newaxis]
    #print n_amb2.shape
    #print n.shape, n_l.shape, n_u.shape, kz.shape
    k_j = np.sqrt((n*n - n_amb2)*k_vac*k_vac + n_amb2*kz*kz)
    k_jl = np.sqrt((n_l*n_l - n_amb2)*k_vac*k_vac + n_amb2*kz*kz)
    k_ju = np.sqrt((n_u*n_u - n_amb2)*k_vac*k_vac + n_amb2*kz*kz)
    
    #print np.all(n_u == n), np.all(n_l == n)
    #print np.all(k_ju == k_j), np.all(k_jl == k_j)
    
    #print d.shape, n.shape, k_j.dtype
    #X = ass_X(k_j)
    X = im.ass_X_interfacelayer4(k_j, k_ju, k_jl, dd_u, dd_l, sigma, sigma_l, sigma_u)
    P = ass_P(k_j, d)
    
    PX = mu.dot2_Adiag(P[...,1:-1], X[...,:-1])
    #print P.dtype, X.dtype, PX.dtype
    M = mu.dot2(X[...,-1], reduce(mu.dot2, np.rollaxis(PX, 3)[::-1]))
    
    r = M[1,0]/M[0,0]
    
    
    return np.abs(r)**2
Пример #2
0
def ReflQ_mag(Q, lamda, n, d, sigma, n_u, dd_u, sigma_u, n_l, dd_l, sigma_l):
    '''Calculate the reflectivity from a multilayer stack with
       Abeles matrix formalism. '''
    #pdb.set_trace()
    k_vac = 2 * np.pi / lamda
    kz = Q[:, np.newaxis] / 2.0
    n_amb2 = (n[:, -1] * n[:, -1])[:, np.newaxis]
    #print n_amb2.shape
    #print n.shape, n_l.shape, n_u.shape, kz.shape
    k_j = np.sqrt((n * n - n_amb2) * k_vac * k_vac + n_amb2 * kz * kz)
    k_jl = np.sqrt((n_l * n_l - n_amb2) * k_vac * k_vac + n_amb2 * kz * kz)
    k_ju = np.sqrt((n_u * n_u - n_amb2) * k_vac * k_vac + n_amb2 * kz * kz)

    #print np.all(n_u == n), np.all(n_l == n)
    #print np.all(k_ju == k_j), np.all(k_jl == k_j)

    #print d.shape, n.shape, k_j.dtype
    #X = ass_X(k_j)
    X = im.ass_X_interfacelayer4(k_j, k_ju, k_jl, dd_u, dd_l, sigma, sigma_l,
                                 sigma_u)
    P = ass_P(k_j, d)

    PX = mu.dot2_Adiag(P[..., 1:-1], X[..., :-1])
    #print P.dtype, X.dtype, PX.dtype
    M = mu.dot2(X[..., -1], reduce(mu.dot2, np.rollaxis(PX, 3)[::-1]))

    r = M[1, 0] / M[0, 0]

    return np.abs(r)**2
Пример #3
0
def ReflQ(Q, lamda, n, d, sigma):
    '''Calculate the reflectivity from a multilayer stack with
       Abeles matrix formalism. '''
    #pdb.set_trace()
    k_vac = 2*np.pi/lamda
    kz = Q[:, np.newaxis]/2.0
    n_amb2 = n[-1]*n[-1]
    k_j = np.sqrt((n*n - n_amb2)*k_vac*k_vac + n_amb2*kz*kz)
    
    #print d.shape, n.shape, k_j.dtype
    #X = ass_X(k_j)
    X = im.ass_X_interfacelayer4(k_j, k_j, k_j, k_j*0+5, k_j*0+5, sigma, sigma*0, sigma*0)
    P = ass_P(k_j, d-10)
    
    PX = mu.dot2_Adiag(P[...,1:-1], X[...,:-1])
    #print P.dtype, X.dtype, PX.dtype
    M = mu.dot2(X[...,-1], reduce(mu.dot2, rollaxis(PX, 3)[::-1]))
    
    r = M[1,0]/M[0,0]
    
    
    return np.abs(r)**2
Пример #4
0
def ReflQ(Q, lamda, n, d, sigma):
    '''Calculate the reflectivity from a multilayer stack with
       Abeles matrix formalism. '''
    #pdb.set_trace()
    k_vac = 2 * np.pi / lamda
    kz = Q[:, np.newaxis] / 2.0
    n_amb2 = n[-1] * n[-1]
    k_j = np.sqrt((n * n - n_amb2) * k_vac * k_vac + n_amb2 * kz * kz)

    #print d.shape, n.shape, k_j.dtype
    #X = ass_X(k_j)
    X = im.ass_X_interfacelayer4(k_j, k_j, k_j, k_j * 0 + 5, k_j * 0 + 5,
                                 sigma, sigma * 0, sigma * 0)
    P = ass_P(k_j, d - 10)

    PX = mu.dot2_Adiag(P[..., 1:-1], X[..., :-1])
    #print P.dtype, X.dtype, PX.dtype
    M = mu.dot2(X[..., -1], reduce(mu.dot2, rollaxis(PX, 3)[::-1]))

    r = M[1, 0] / M[0, 0]

    return np.abs(r)**2