plot_d_param.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. im_d_y = interpolate.interp1d(x_mat, np.imag(d_perp_mat), kind=kind)
  23. re_d_y = interpolate.interp1d(x_mat, np.real(d_perp_mat))
  24. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  25. np.savetxt('silver-d_perp_interpolated.txt', data)
  26. im_d_y = interpolate.interp1d(x_mat, np.imag(d_parl_mat), kind=kind)
  27. re_d_y = interpolate.interp1d(x_mat, np.real(d_parl_mat))
  28. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  29. np.savetxt('silver-d_parl_interpolated.txt', data)
  30. from_disk = np.loadtxt('rs4-d_perp_interpolated.txt')
  31. plt.figure('rs4')
  32. plt.plot(from_disk[0, :], from_disk[1, :], label='re d')
  33. plt.plot(from_disk[0, :], from_disk[2, :], label='im d')
  34. plt.plot(x_mat, np.real(d_perp_mat), label='re d mat')
  35. plt.plot(x_mat, np.imag(d_perp_mat), label='re d mat')
  36. plt.legend()
  37. plt.show()
  38. from_disk = np.loadtxt('silver-d_perp_interpolated.txt')
  39. plt.figure('silver')
  40. plt.plot(from_disk[0, :], from_disk[1, :], label='re d perp')
  41. plt.plot(from_disk[0, :], from_disk[2, :], label='im d perp')
  42. from_disk = np.loadtxt('silver-d_parl_interpolated.txt')
  43. plt.plot(from_disk[0, :], from_disk[1, :], label='re d parl')
  44. plt.plot(from_disk[0, :], from_disk[2, :], label='im d parl')
  45. plt.legend()
  46. plt.show()