plot_d_param.py 1.0 KB

1234567891011121314151617181920212223242526272829303132
  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. # arr2D = np.loadtxt('rs4-im-d_perp.csv', delimiter=',')
  12. # im_d = arr2D[arr2D[:, 0].argsort()]
  13. # arr2D = np.loadtxt('rs4-re-d_perp.csv', delimiter=',')
  14. # re_d = arr2D[arr2D[:, 0].argsort()]
  15. x = np.linspace(x_mat[0], x_mat[-1], 1001)
  16. im_d_y = interpolate.interp1d(x_mat, np.imag(d_perp_mat), kind='cubic')
  17. re_d_y = interpolate.interp1d(x_mat, np.real(d_perp_mat))
  18. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  19. np.savetxt('rs4-d_perp_interpolated.txt', data)
  20. from_disk = np.loadtxt('rs4-d_perp_interpolated.txt')
  21. plt.plot(from_disk[0, :], from_disk[1, :], label='re d')
  22. plt.plot(from_disk[0, :], from_disk[2, :], label='im d')
  23. plt.plot(x_mat, np.real(d_perp_mat), label='re d mat')
  24. plt.plot(x_mat, np.imag(d_perp_mat), label='re d mat')
  25. plt.legend()
  26. plt.show()