suppFig5.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env python3
  2. # -*- coding: UTF-8 -*-
  3. from matplotlib import pyplot as plt
  4. import cmath
  5. from evalMie import *
  6. import numpy as np
  7. min_lim = 0.4
  8. max_lim = 0.75
  9. # mat = scipy.io.loadmat('d-parameters/rs=4.mat')
  10. # omega_ratio = mat['omegav'][0]
  11. # d_perp = mat['dperp'][0]*10
  12. from_disk = np.loadtxt('rs4-d_perp_interpolated.txt')
  13. omega_ratio = from_disk[0, :]
  14. d_perp = from_disk[1, :] + 1j*from_disk[2, :]
  15. c = 299792458 # m/s
  16. h_reduced = 6.5821e-16 # eV s
  17. omega_p = 5.9 # eV
  18. gamma = 0.1 # eV
  19. eps_d = 1
  20. def eps_m(omega):
  21. return 1 - omega_p * omega_p / (omega*omega + 1j*omega*gamma)
  22. Rs = [2.5, 5, 10, 25] # nm
  23. y_min = [1e-2, 1e-2, 1e-1, 1e-1]
  24. y_max = [1e1, 5e1, 5e1, 5e1]
  25. # for om_rat in omega_ratio:
  26. for fig in range(len(Rs)):
  27. R = Rs[fig]
  28. Qext = []
  29. Qext_mie = []
  30. om_rat_plot = []
  31. x_in = []
  32. m_in = []
  33. d_perp_in = []
  34. for i in range(len(omega_ratio)):
  35. om_rat = omega_ratio[i]
  36. if om_rat < min_lim or om_rat > max_lim:
  37. continue
  38. omega = om_rat*omega_p
  39. m = cmath.sqrt(eps_m(omega))
  40. x = (omega/c) * R * 1e-9/h_reduced
  41. x_in.append(x)
  42. m_in.append(m)
  43. om_rat_plot.append(om_rat)
  44. d_perp_in.append(d_perp[i])
  45. Qext_mie, _ = eval_mie_spectrum(x_in, m_in)
  46. Qext, _ = eval_mesomie_spectrum(x_in, m_in, R, d_perp_in)
  47. print(Qext)
  48. plt.figure(fig)
  49. plt.plot(om_rat_plot, Qext_mie, label='classic', color='gray', lw=4)
  50. plt.plot(om_rat_plot, Qext, label='non-classic', color='red', lw=4)
  51. # plt.plot(om_rat_plot, Qext, label="R="+str(R), lw=1)
  52. plt.legend()
  53. plt.yscale('log')
  54. plt.xlim((0.4, 0.75))
  55. plt.ylim((y_min[fig], y_max[fig]))
  56. plt.title("R="+str(R))
  57. plt.show()