suppFig6.py 2.6 KB

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