In [1]:
#All libraries necesary:
%matplotlib inline
import matplotlib
matplotlib.rcParams['figure.figsize'] = (10, 6)
import matplotlib.pyplot as plt
import numpy as np
from math import pi, sin, cos
from copy import deepcopy
from mutils2 import *
import time
from milne import *
In [2]:
# PARAMETROS:
nlinea = 3 # Numero linea en fichero
x = np.arange(-2.0,2.0,20e-3) # Array Longitud de onda
B = 620. # Campo magnetico
thetaB = 2.45 # Inclinacion
phiB = 1.50 # Angulo azimutal
vlos = -0.25 # velocidad km/s
eta0 = 4.26 # Cociente de abs linea-continuo
a = 0.9 # Parametro de amortiguamiento
ddop = 0.05 # Anchura Doppler
# Sc = 4.0 # Cociente Gradiente y Ordenada de la funcion fuente
S_0=0.4 # Ordenada de la funcion fuente
S_1=0.5 # Gradiente de la funcion fuente
param = paramLine(nlinea)
stokes = stokesSyn(param,x,B,thetaB,phiB,vlos,eta0,a,ddop,S_0,S_1)
for i in range(4):
plt.subplot(2,2,i+1)
if i == 0: plt.ylim(0,1.1)
plt.plot(x,stokes[i])
plt.plot([0,0],[min(stokes[i]),max(stokes[i])],'k--')
In [3]:
print('Valores iniciales:', B, thetaB*180/np.pi, phiB*180/np.pi)
In [4]:
iB, ithetaB, iphiB = initialConditions(stokes,nlinea,x,param)
print(iB, ithetaB*180/np.pi, iphiB*180/np.pi)
In [5]:
campoArray= np.arange(10, 2000, 10)
In [6]:
outArray = []
for B in (campoArray):
stokes = stokesSyn(param,x,B,thetaB,phiB,vlos,eta0,a,ddop,S_0,S_1)
iB, igamma, ixi = initialConditions(stokes,nlinea,x,param)
outArray.append(iB)
plt.plot(campoArray,outArray,'r-')
plt.plot(campoArray,campoArray,'k--')
plt.xlabel('B Input')
plt.ylabel('B Output')
Out[6]: