paquetes


In [1]:
#-*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({'font.size': 16})

angulos y longitudes de onda


In [2]:
#mercury=[n,lambda,delta min, nombre]
mercury=[[1.687,.40465,55.033,'morado2'], #morado2
         [1.682,.40778,54.500,'morado1'], #morado1
         [1.675,.43583,53.717,'azul'], #Azul
         [1.656,.54607,51.750,'verde'], #Verde
         [1.650,.57696,51.217,'amarillo2'], #Amarillo2
         [1.650,.57906,51.200,'amarillo1']] #Amarillo1
# fuente: http://users.df.uba.ar/bragas/Labo5_1er2011/G6Espectroscopia.pdf

def errorn(d):
    Dda= (np.sqrt((0.083)**2 + (0.083)**2)/2) #error de delta (d) + alpha
    Df = np.cos((((d*np.pi/180.)+(60*np.pi/180.)/2)))*Dda    #error de sen(d+alpha/2)
    f=np.sin(((d*np.pi/180.)+(60*np.pi/180.))/(2.))           #sen(d+a/2)
    sen=np.sin(30*np.pi/180.)                 #sen(a/2)
    Dsen=np.cos(30*np.pi/180.)*83/2000        #error de sen(a/2)
    
    error=(f/sen)*((Df/f)+(Dsen/sen))
    
    return error

In [5]:
n_aux=[]
nerror=[]
lam_aux=[]
plt.figure(figsize=(20,15))
ax = plt.subplot(111)
for item in mercury:
    #print key
    n=item[0]
    n_aux.append(n)
    lamb=item[1]
    delta=item[2]
    n_error=errorn(delta)
    #print item[3],' ',n,' ',n_error
    lam_aux.append(lamb)
    nerror.append(n_error)
    #ax.plot(lamb,n,'o', label=item[3])
    #print lamb,n

z=np.polyfit(lam_aux,n_aux,2)
p=np.poly1d(z)
l=np.linspace(lam_aux[0],lam_aux[-1],20)
#print p(0.43583)

n_ref0=p(l)
n_ref1=(1+1.52481889/(1-0.011254756/l**2)+0.187085527/(1-0.0588995392/l**2)+1.42729015/(1-129.141675/l**2))**.5
n_ref2=(1+1.5851495/(1-0.00926681282/l**2)+0.143559385/(1-0.0424489805/l**2)+1.08521269/(1-105.613573/l**2))**.5
n_ref3=(1+1.03961212/(1-0.00600069867/l**2)+0.231792344/(1-0.0200179144/l**2)+1.01046945/(1-103.560653/l**2))**.5
n_ref4=(1+1.12365662/(1-0.00644742752/l**2)+0.309276848/(1-0.0222284402/l**2)+0.881511957/(1-107.297751/l**2))**.5
n_ref5=(1+0.971247817/(1-0.00472301995/l**2)+0.216901417/(1-0.0153575612/l**2)+0.904651666/(1-168.68133/l**2))**.5
n_ref6=(1+2.00029547/(1-0.0121426017/l**2)+0.298926886/(1-0.0538736236/l**2)+1.80691843/(1-156.530829/l**2))**.5

#plt.plot(l,n_ref0,'g--',label='ajuste polinomial grado2')

ax.plot(l,n_ref1,'k--',label="SF5")
ax.plot(l,n_ref2,'r--',label="BAF10")

ax.plot(l,n_ref3,'c--',label="BK7")
ax.plot(l,n_ref4,'m--',label="BAK1")
ax.plot(l,n_ref5,'b--',label="FK51A")


#plt.errorbar(lam_aux, n_aux, yerr=n_error,linestyle='None',color='k', capsize = 5)

ax.grid()
# Shrink current axis's height by 10% on the bottom
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1,
                 box.width, box.height * 0.9])

# Put a legend below current axis
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05),
          fancybox=True, shadow=True, ncol=5)
plt.title('$n$ vs $\lambda$ solo materiales')
plt.xlabel('longitud de onda: $\lambda [\mu m]$')
plt.ylabel('indice de refraccion: $n$')
plt.savefig('materiales.png')
plt.show()


Calculo de n para cualquien lambda en [$\mu$m ]


In [8]:
#usar la funcion p definida en el codigo anterior
print 'n para lambda(0.43583): %.3f,  valor medido: 1.675, error: %0.4f'%(p(0.43583),abs(1.675 - p(0.43583)))


n para lambda(0.43583): 1.676,  valor medido: 1.675, error: 0.0013