path_plot.py 5.4 KB

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