suppFig5.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env python3
  2. # -*- coding: UTF-8 -*-
  3. from matplotlib import pyplot as plt
  4. import cmath
  5. from scattnlay import mesomie, mie
  6. import numpy as np
  7. from_disk = np.loadtxt('rs4-d_perp.txt')
  8. min_lim = 0.4
  9. max_lim = 0.8
  10. omega_ratio = from_disk[0, :]
  11. d_perp = from_disk[1, :] + 1j*from_disk[2, :]
  12. c = 299792458 # m/s
  13. h_reduced = 6.5821e-16 # eV s
  14. omega_p = 5.9 # eV
  15. gamma = 0.1 # eV
  16. eps_d = 1
  17. def eps_m(omega):
  18. return 1 - omega_p * omega_p / (omega*omega + 1j*omega*gamma)
  19. Rs = [2.5, 5, 10, 25]
  20. R = 5
  21. Qext = []
  22. Qext_mie = []
  23. om_rat_plot = []
  24. # for om_rat in omega_ratio:
  25. for i in range(len(omega_ratio)):
  26. om_rat = omega_ratio[i]
  27. if om_rat < min_lim or om_rat > max_lim:
  28. continue
  29. omega = om_rat*omega_p
  30. m = cmath.sqrt(eps_m(omega))
  31. x = (omega/c) * R * 1e-9/h_reduced
  32. mesomie.calc_ab(R*10, # R in angstrem
  33. x, # xd
  34. x * m, # xm
  35. 1, # eps_d
  36. m * m, # eps_m
  37. 0, # d_parallel
  38. d_perp[i]) # d_perp
  39. mesomie.calc_Q()
  40. mie.SetLayersSize(x)
  41. mie.SetLayersIndex(m)
  42. mie.RunMieCalculation()
  43. Qext.append(mesomie.GetQext())
  44. Qext_mie.append(mie.GetQext())
  45. # print(x, m, Qext[-1] - mie.GetQext())
  46. om_rat_plot.append(om_rat)
  47. # print(Qext)
  48. plt.plot(om_rat_plot, Qext_mie, label='classic', color='gray', lw=4)
  49. plt.plot(om_rat_plot, Qext, label='non-classic', color='red', lw=4)
  50. plt.legend()
  51. plt.yscale('log')
  52. plt.xlim((0.4, 0.8))
  53. plt.show()