plot_d_param.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env python3
  2. # -*- coding: UTF-8 -*-
  3. from cProfile import label
  4. from matplotlib import markers, pyplot as plt
  5. import numpy as np
  6. from scipy import interpolate
  7. import scipy.io
  8. mat = scipy.io.loadmat('d-parameters/rs=4.mat')
  9. x_mat = mat['omegav'][0]
  10. d_perp_mat = mat['dperp'][0]*10
  11. x = np.linspace(x_mat[0], x_mat[-1], 1001)
  12. im_d_y = interpolate.interp1d(x_mat, np.imag(d_perp_mat), kind='cubic')
  13. re_d_y = interpolate.interp1d(x_mat, np.real(d_perp_mat))
  14. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  15. np.savetxt('rs4-d_perp_interpolated.txt', data)
  16. mat = scipy.io.loadmat('d-parameters/silver_xd_1.18A.mat')
  17. x_mat = mat['omegav'][0]
  18. d_perp_mat = mat['dperp'][0]*10
  19. d_parl_mat = mat['dparl'][0]*10
  20. x = np.linspace(x_mat[0], x_mat[-1], 1001)
  21. kind = 'linear'
  22. # kind = 'cubic'
  23. im_d_y = interpolate.interp1d(x_mat, np.imag(d_perp_mat), kind=kind)
  24. re_d_y = interpolate.interp1d(x_mat, np.real(d_perp_mat))
  25. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  26. np.savetxt('silver-d_perp_interpolated.txt', data)
  27. im_d_y = interpolate.interp1d(x_mat, np.imag(d_parl_mat), kind=kind)
  28. re_d_y = interpolate.interp1d(x_mat, np.real(d_parl_mat))
  29. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  30. np.savetxt('silver-d_parl_interpolated.txt', data)
  31. from_disk = np.loadtxt('rs4-d_perp_interpolated.txt')
  32. plt.figure('rs4')
  33. plt.plot(from_disk[0, :], from_disk[1, :], label='re d')
  34. plt.plot(from_disk[0, :], from_disk[2, :], label='im d')
  35. plt.plot(x_mat, np.real(d_perp_mat), label='re d mat')
  36. plt.plot(x_mat, np.imag(d_perp_mat), label='re d mat')
  37. plt.legend()
  38. plt.show()
  39. from_disk = np.loadtxt('silver-d_perp_interpolated.txt')
  40. plt.figure('silver')
  41. plt.plot(from_disk[0, :], from_disk[1, :], label='re d perp')
  42. plt.plot(from_disk[0, :], from_disk[2, :], label='im d perp')
  43. from_disk = np.loadtxt('silver-d_parl_interpolated.txt')
  44. plt.plot(from_disk[0, :], from_disk[1, :], label='re d parl')
  45. plt.plot(from_disk[0, :], from_disk[2, :], label='im d parl')
  46. plt.legend()
  47. plt.show()