#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt

#----------------------------------------------------------------------------------------#
# read Mie Parameter, refractive index, qe, albedo, gfact

f = open('mie_code_output.txt', 'r')

list = f.readline()
x = list.split()[0]
x = float(x.strip())
x = round(x,2) 
nr = list.split()[1]
nr = float(nr.strip())
nr = round(nr,2) 
ni = list.split()[2]
ni = float(ni.strip())
ni = round(ni,2) 

list = f.readline()
list.strip()
qe = list.split()[0]
qe = float(qe.strip())
qe = round(qe,2) 
albedo = list.split()[1]
albedo = float(albedo.strip())
albedo = round(albedo,2)
gfact = list.split()[2]
gfact = float(gfact.strip())
gfact = round(gfact,2) 

f.closed

#----------------------------------------------------------------------------------------#
# read scattering sngle, p11, p12, p33, p34

c1,c2,c3,c4,c5  = np.loadtxt("mie_code_output.txt", skiprows=2, unpack=True)

#----------------------------------------------------------------------------------------#
# print p11

fig = plt.figure()

ax = fig.add_subplot(111)

plt.plot(c1,c2,'k-')
plt.yscale('log')

plt.grid(True,which="both")

plt.xlabel(r"Scattering Angle $\Theta$ ($^\circ$)")
plt.ylabel(r"$P_{11}$")

plt.text(0.70,0.85,'x = '+str(x), fontsize=12, transform = ax.transAxes)
plt.text(0.70,0.80,'n=('+str(nr)+','+str(ni)+')', fontsize=12, transform = ax.transAxes)     

plt.text(0.70,0.70,'qe = '+str(qe), fontsize=12, transform = ax.transAxes)     
plt.text(0.70,0.65,'w0 = '+str(albedo), fontsize=12, transform = ax.transAxes)     
plt.text(0.70,0.60,'g = '+str(gfact), fontsize=12, transform = ax.transAxes)     

plt.savefig('p11.png')

#----------------------------------------------------------------------------------------#
# print p12

fig = plt.figure()
ax = fig.add_subplot(111)

plt.plot(c1,c3,'k-')
#plt.yscale('log')

plt.grid(True,which="both")

plt.xlabel(r"Scattering Angle $\Theta$ ($^\circ$)")
plt.ylabel(r"$P_{12}$")    

plt.savefig('p12.png')

#----------------------------------------------------------------------------------------#
# print p33

fig = plt.figure()
ax = fig.add_subplot(111)

plt.plot(c1,c4,'k-')
plt.yscale('log')

plt.grid(True,which="both")

plt.xlabel(r"Scattering Angle $\Theta$ ($^\circ$)")
plt.ylabel(r"$P_{33}$")    

plt.savefig('p33.png')

#----------------------------------------------------------------------------------------#
# print p34

fig = plt.figure()

ax = fig.add_subplot(111)

plt.plot(c1,c5,'k-')
#plt.yscale('log')

plt.grid(True,which="both")

plt.xlabel(r"Scattering Angle $\Theta$ ($^\circ$)")
plt.ylabel(r"$P_{34}$")    

plt.savefig('p34.png')

#----------------------------------------------------------------------------------------#

About / Au sujet de

Ben
Created:
31 mai 2016 21:27:33

Updated:
31 mai 2016 21:27:33

License / Licence

MIT License

Abstract / Résumé