plot_d_param.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. arr2D = np.loadtxt('rs4-im-d_perp.csv', delimiter=',')
  8. im_d = arr2D[arr2D[:, 0].argsort()]
  9. arr2D = np.loadtxt('rs4-re-d_perp.csv', delimiter=',')
  10. re_d = arr2D[arr2D[:, 0].argsort()]
  11. xmin_im = np.min(im_d[:, 0])
  12. xmin_re = np.min(re_d[:, 0])
  13. xmax_im = np.max(im_d[:, 0])
  14. xmax_re = np.max(re_d[:, 0])
  15. x = np.linspace(np.max([xmin_im, xmin_re]), np.min([xmax_im, xmax_re]), 1000)
  16. im_d_y = interpolate.interp1d(im_d[:, 0], im_d[:, 1])
  17. re_d_y = interpolate.interp1d(re_d[:, 0], re_d[:, 1])
  18. data = np.array([x.T, re_d_y(x).T, im_d_y(x).T])
  19. np.savetxt('rs4-d_perp.txt', data)
  20. # print(data)
  21. # plt.plot(im_d[:, 0], im_d[:, 1], marker='o', ls='')
  22. # plt.plot(x, im_d_y(x))
  23. # plt.plot(re_d[:, 0], re_d[:, 1], marker='o', ls='')
  24. # plt.plot(x, re_d_y(x))
  25. # plt.xlim((0, 1))
  26. # plt.ylim((-4, 5))
  27. # plt.show()
  28. from_disk = np.loadtxt('rs4-d_perp.txt')
  29. plt.plot(from_disk[0, :], from_disk[1, :], label='re d')
  30. plt.plot(from_disk[0, :], from_disk[2, :], label='im d')
  31. plt.legend()
  32. plt.show()