path_plot.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import numpy as np
  2. from rotational_path import PairRotationalPath, PathEnergyPlot
  3. import expansion
  4. from parameters import ModelParams
  5. import patch_size
  6. from pathlib import Path
  7. import matplotlib.pyplot as plt
  8. zero_to_pi_half = np.linspace(0, np.pi/2, 100, endpoint=True)
  9. pi_half_to_pi = np.linspace(np.pi/2, np.pi, 100, endpoint=True)
  10. QuadPath = PairRotationalPath()
  11. QuadPath.set_default_x_axis(zero_to_pi_half)
  12. QuadPath.add_euler(beta1=np.pi/2, beta2=zero_to_pi_half)
  13. QuadPath.add_euler(beta1=zero_to_pi_half[::-1], beta2=zero_to_pi_half[::-1])
  14. QuadPath.add_euler(beta1=zero_to_pi_half)
  15. QuadPath.add_euler(beta1=zero_to_pi_half[::-1], beta2=zero_to_pi_half)
  16. QuadPath.add_euler(beta1=np.pi/2, beta2=zero_to_pi_half, alpha2=np.pi/2)
  17. QuadPath.add_euler(beta1=np.pi/2, beta2=np.pi/2, alpha1=zero_to_pi_half[::-1])
  18. DipolePath = PairRotationalPath()
  19. DipolePath.set_default_x_axis(zero_to_pi_half)
  20. DipolePath.add_euler(beta2=pi_half_to_pi[::-1])
  21. DipolePath.add_euler(beta2=zero_to_pi_half[::-1])
  22. DipolePath.add_euler(beta2=zero_to_pi_half, beta1=zero_to_pi_half)
  23. DipolePath.add_euler(beta2=np.pi/2, beta1=np.pi/2, alpha2=zero_to_pi_half)
  24. DipolePath.add_euler(beta2=np.pi/2, alpha2=np.pi/2, beta1=pi_half_to_pi)
  25. DipolePath.add_euler(beta2=np.pi/2, beta1=pi_half_to_pi[::-1], alpha1=np.pi)
  26. DipolePath.add_euler(beta2=zero_to_pi_half[::-1], beta1=pi_half_to_pi, alpha1=np.pi)
  27. DipolePath.add_euler(beta2=zero_to_pi_half, beta1=pi_half_to_pi[::-1], alpha1=np.pi)
  28. DipolePath.add_euler(beta2=pi_half_to_pi, beta1=zero_to_pi_half[::-1], alpha1=np.pi)
  29. DipolePath2 = PairRotationalPath()
  30. DipolePath2.set_default_x_axis(zero_to_pi_half)
  31. DipolePath2.add_euler(beta2=pi_half_to_pi[::-1])
  32. DipolePath2.add_euler(beta2=zero_to_pi_half[::-1])
  33. DipolePath2.add_euler(beta2=zero_to_pi_half, beta1=zero_to_pi_half)
  34. DipolePath2.add_euler(beta2=np.pi/2, beta1=np.pi/2, alpha2=zero_to_pi_half)
  35. DipolePath2.add_euler(beta2=np.pi/2, alpha2=np.pi/2, beta1=pi_half_to_pi)
  36. DipolePath2.add_euler(beta2=zero_to_pi_half[::-1], beta1=pi_half_to_pi[::-1])
  37. DipolePath2.add_euler(beta2=zero_to_pi_half[::-1], beta1=np.pi)
  38. DipolePath2.add_euler(beta2=zero_to_pi_half, beta1=pi_half_to_pi[::-1], alpha1=np.pi)
  39. DipolePath2.add_euler(beta2=pi_half_to_pi, beta1=zero_to_pi_half[::-1], alpha1=np.pi)
  40. if __name__ == '__main__':
  41. # kappaR = np.array([1, 3, 10])
  42. params = ModelParams(R=150, kappaR=3)
  43. # ex1 = expansion.MappedExpansionQuad(np.array([0.35, 0.44, 0.6]), params.kappaR, 0.001, max_l=20)
  44. # ex1 = expansion.Expansion24(sigma2=0.001, sigma4=0)
  45. # ex1 = expansion.Expansion(l_array=np.array([1]), coefs=expansion.rot_sym_expansion(np.array([1]), np.array([0.001])))
  46. # ex1 = expansion.GaussianCharges(omega_k=np.array([[0, 0], [np.pi, 0]]), lambda_k=np.array([5, 10]), sigma1=0.001, l_max=10)
  47. # ex1 = expansion.GaussianCharges(omega_k=np.array([0, 0]), lambda_k=np.array([1, 5, 10, 15]), sigma1=0.001, l_max=20)
  48. ex1 = expansion.SphericalCap(np.array([[0, 0], [np.pi, 0]]), np.array([0.5]), 0.001, 20)
  49. ex2 = ex1.clone()
  50. # charge_profile = ex1.charge_value(theta=np.linspace(0, np.pi, 100), phi=0)
  51. # plt.plot(charge_profile.T)
  52. # plt.show()
  53. # expansion.plot_theta_profile(ex1, num=1000, theta_end=np.pi, phi=0)
  54. #
  55. # ps = patch_size.potential_patch_size(ex1, params, theta1=np.pi / 2,
  56. # # match_expansion_axis_to_params=1
  57. # )
  58. # print(ps)
  59. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params)
  60. path_plot.plot(# labels=[rf'$\theta$={180 * patch / np.pi:.1f}' for patch in np.array([0.5])],
  61. # norm_euler_angles={'beta2': np.pi},
  62. # save_as=Path("/home/andraz/ChargedShells/Figures/dipole_path_kappaR3.png")
  63. )
  64. # path_plot.plot(labels=[rf'$\kappa R$={kR}' for kR in kappaR],
  65. # # norm_euler_angles={'beta2': np.pi},
  66. # # save_as=Path("/home/andraz/ChargedShells/Figures/dipole_path_lambda5_norm2.png")
  67. # )
  68. # path_plot.plot_sections(save_as=Path('/home/andraz/ChargedShells/Figures/dipole_path2.png'))