suppFig6.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. from optical_constants import read_refractive_index_from_yaml as read_nk
  7. import numpy as np
  8. import scipy.io
  9. from_disk = np.loadtxt('silver-d_perp_interpolated.txt')
  10. omega_star_ratio = from_disk[0, :]
  11. d_perp = from_disk[1, :] + 1j*from_disk[2, :]
  12. from_disk = np.loadtxt('silver-d_parl_interpolated.txt')
  13. d_parl = from_disk[1, :] + 1j*from_disk[2, :]
  14. c = 299792458 # m/s
  15. h_reduced = 6.5821e-16 # eV s
  16. omega_p = 9.02 # eV
  17. omega_p_star = 3.81 # eV
  18. gamma = 0.022 # eV
  19. eps_d = 1
  20. R = 2.5
  21. y_min = 0
  22. y_max = 2
  23. min_lim_omega_star_ratio = 0.87
  24. max_lim_omega_star_ratio = 0.99
  25. # min_lim_omega_ratio = min_lim_omega_star_ratio * omega_p_star/omega_p
  26. # max_lim_omega_ratio = max_lim_omega_star_ratio * omega_p_star/omega_p
  27. # 2 pi / lambda = (omega/c) /h_reduced
  28. WL = 2*np.pi/((omega_star_ratio * omega_p_star/c)/h_reduced)*1e6 # mkm
  29. min_WL_available = 0.1879
  30. max_WL_available = 1.9370
  31. WL[WL < min_WL_available] = min_WL_available
  32. WL[WL > max_WL_available] = max_WL_available
  33. index_Ag = read_nk('Ag-Johnson-1972.yml', WL, kind=1)
  34. eps_Ag = index_Ag**2
  35. print(index_Ag)
  36. def eps_m(omega):
  37. return 1 - omega_p * omega_p / (omega*omega + 1j*omega*gamma)
  38. Qext = []
  39. Qext_mie = []
  40. om_rat_plot = []
  41. for i in range(len(omega_star_ratio)):
  42. om_star_rat = omega_star_ratio[i]
  43. if (om_star_rat < min_lim_omega_star_ratio
  44. or om_star_rat > max_lim_omega_star_ratio):
  45. continue
  46. omega = om_star_rat*omega_p_star
  47. WL_mkm = 2*np.pi/((omega/c)/h_reduced)*1e6
  48. if WL_mkm < min_WL_available or WL_mkm > max_WL_available:
  49. continue
  50. x = (omega/c) * R * 1e-9/h_reduced
  51. # m = cmath.sqrt(eps_m(omega))
  52. m = index_Ag[i, 1]
  53. print(x, m)
  54. mesomie.calc_ab(R*10, # R in angstrem
  55. x, # xd
  56. x * m, # xm
  57. 1, # eps_d
  58. m * m, # eps_m
  59. d_parl[i], # d_parallel
  60. d_perp[i]) # d_perp
  61. mesomie.calc_Q()
  62. mie.SetLayersSize(x)
  63. mie.SetLayersIndex(m)
  64. mie.RunMieCalculation()
  65. Qext.append(mesomie.GetQext())
  66. Qext_mie.append(mie.GetQext())
  67. # print(x, m, Qext[-1] - mie.GetQext())
  68. om_rat_plot.append(om_star_rat)
  69. plt.plot(om_rat_plot, Qext_mie,
  70. label='classic', color='gray', lw=4)
  71. plt.plot(om_rat_plot, Qext,
  72. label='non-classic', color='red', lw=4)
  73. plt.legend()
  74. # plt.yscale('log')
  75. plt.xlim((min_lim_omega_star_ratio, max_lim_omega_star_ratio))
  76. plt.ylim((y_min, y_max))
  77. plt.title("R="+str(R))
  78. plt.show()