示例#1
0
def calc_ellips_plate(freq,epsil,wid=[],ang=60,conv=1,rep=0,corr=None):
    '''calculates ellipsometric angles for given layers'''
    from numpy import arctan,arctan2,abs
    from profit import plate,reflect
    if conv: conv=180./pi
    if len(wid)==0: #bulk material
        zz=reflect(epsil[0],ang=ang,polar='p',rep=0)
        zz/=reflect(epsil[0],ang=ang,polar='s',rep=0)
    else:
        if ang<0:
            fr=plate(freq,epsil,wid,ang=ang,rep=-1)
            zz=friter([f[:,0] for f in fr[0]],fr[1],fr[2])/friter([f[:,1] for f in fr[0]],fr[1],fr[2])
        else:
            zz=plate(freq,epsil,wid,ang=ang,rep=0,polar='p')
            zz/=plate(freq,epsil,wid,ang=ang,rep=0,polar='s')
    if rep==-2: return zz
    out=arctan(abs(zz))*conv,-arctan2(zz.imag,zz.real)*conv
    if corr=='pos':
        out[1][out[1]<-90]+=360.
    if rep==1: return out[0]+1j*out[1]
    else: return out
示例#2
0
文件: labin.py 项目: limu007/Charlay
 def measure(self,npix=None,**kwargs):
     from numpy.random import normal
     from math import sqrt
     if self.config==None:
         print("You must config first!")
         return
     if 'noise' in kwargs: noise=float(kwargs['noise'])
     else: noise=getattr(self.config,'Noise',0.05)
     noise/=sqrt(self.config.m_NrAverages)
     rep=normal(size=self.pixtable.shape,scale=noise)
     mater=None
     if 'mater' in kwargs: mater=kwargs['mater']
     elif hasattr(self.config,'Material') and self.config.Material.decode('ascii')!='simu': mater=self.config.Material.decode('ascii')
     else: mater=rc.simu_mater
     #print('using |'+str(mater)+'|')
     if mater!=None:
         if type(mater)==list:
             for m in mater:
                 if not m in self.data:
                     if m in rc.eps_ext: 
                         from profit import dielect
                         self.data[m]=dielect(self.pixtable,rc.eps_ext[m][0],rc.eps_ext[m][1])
                     elif m in rc.mod_ext: 
                         from numpy import polyval
                         self.data[m]=polyval(rc.mod_ext[m],self.pixtable)**2
                     print('calculating diel. '+m)
             if len(mater)-len(rc.simu_layer) in [0,1]:
                 from profit import plate
                 wid=rc.simu_layer
                 if hasattr(rc,'simu_layer_fluc'): wid=[wid[i]*normal(1,rc.simu_layer_fluc[i]) for i in range(len(wid))]
                 rep+=plate(self.pixtable,[self.data[m] for m in mater],wid)
         else:
             if not mater in self.data:
                 if mater in rc.mod_ext: 
                     from numpy import polyval
                     self.data[mater]=polyval(rc.mod_ext[mater],self.pixtable)**2
                 else:
                     from spectra import dbload
                     if type(mater)==bytes: dbname=mater.decode('ascii')
                     else: dbname=mater
                     if dbname in rc.eps_trans: dbname=rc.eps_trans[dbname]
                     try:
                         inp=dbload(dbname,self.pixtable)
                     except:
                         print('cannot load material '+dbname)
                         return rep
                     #for i in range(len(inp)):
                     self.data[mater]=inp[1]
             if len(self.data)>0:
                 from profit import reflect
                 rep+=reflect(self.data[mater])#,self.data[mater[1]])
     rep*=self.config.m_IntegrationTime
     return rep
示例#3
0
def init(iban=[500,900],nfil=52,redir='/home/limu/Lab/spectra/scan/',norm='new'):
    global bins,refe,mall,dall,zzall,nomal,epsil
    import os
    if norm=='new':
        bins2,refe2=loadtxt('/home/limu/Lab/spectra/soi3/radek3/novy_bod.dat',unpack=True,comments='%')
        ## plot(bins2,scan_anal.zzall[3][3][2580:0:-1],hold=0)
        uni2=unittest(base=bins2,comp=['cSi_asp','gSiO2'])
        bins=uni2[0]
        epsil=array(uni2[1]);refe=reflect(epsil[0])
    else:
        bins,refe=loadtxt('/home/limu/Lab/TblRefSi3648.dat',unpack=True)#[:,0]
        bins=1/spectra.ev2um/bins[:2600]*1000
    from numpy import load
    zzall=[load(redir+'fline0%02i.npy'%i) for i in range(nfil)]
    # how to detect oscilations
    if os.path.exists(redir+'nomal.npy'):
        nomal=load(redir+'nomal.npy')[1][:len(bins)]
    else:
        nr=hamming(11);nr/=nr.sum()
        mall=[[abs(z[500:900:10][5:-5]-convolve(z[500:900:10],nr,'same')[5:-5]).mean() for z in zz] for zz in zzall]
        dall=[[z[500:900].mean() for z in zz] for zz in zzall]