quad_path_plot.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. import numpy as np
  2. from matplotlib.lines import Line2D
  3. from charged_shells.rotational_path import PairRotationalPath, PathEnergyPlot
  4. from charged_shells import expansion
  5. from charged_shells.parameters import ModelParams
  6. from pathlib import Path
  7. import json
  8. import quadrupole_model_mappings
  9. from plot_settings import *
  10. Array = np.ndarray
  11. zero_to_pi_half = np.linspace(0, np.pi/2, 100, endpoint=True)
  12. pi_half_to_pi = np.linspace(np.pi/2, np.pi, 100, endpoint=True)
  13. QuadPath = PairRotationalPath()
  14. QuadPath.set_default_x_axis(zero_to_pi_half)
  15. QuadPath.add_euler(beta1=np.pi/2, beta2=zero_to_pi_half, start_name="EP", end_name="EE")
  16. QuadPath.add_euler(beta1=zero_to_pi_half[::-1], beta2=zero_to_pi_half[::-1], end_name="PP")
  17. QuadPath.add_euler(beta1=zero_to_pi_half, end_name="EP")
  18. QuadPath.add_euler(beta1=zero_to_pi_half[::-1], beta2=zero_to_pi_half, end_name="EP")
  19. QuadPath.add_euler(beta1=np.pi/2, beta2=zero_to_pi_half, alpha2=np.pi/2, end_name="tEE")
  20. QuadPath.add_euler(beta1=np.pi/2, beta2=np.pi/2, alpha1=zero_to_pi_half[::-1], end_name="EE")
  21. def model_comparison(config_data: dict, save_as=None, save_data=False):
  22. kappaR = 3
  23. params = ModelParams(R=150, kappaR=kappaR)
  24. a_bar = 0.5
  25. sigma_tilde = 0.001
  26. ex1 = expansion.MappedExpansionQuad(a_bar, params.kappaR, sigma_tilde, l_max=30)
  27. ex2 = ex1.clone()
  28. # matching other models to the mapped CSp model based on equal patch size in potential
  29. # ex_gauss = quadrupole_model_mappings.ic_to_gauss(sigma_tilde, a_bar, params, l_max=30, sigma0=0)
  30. # ex_gauss2 = ex_gauss.clone()
  31. # ex_cap = quadrupole_model_mappings.ic_to_cap(sigma_tilde, a_bar, params, l_max=30, sigma0=0)
  32. # ex_cap2 = ex_cap.clone()
  33. # path plots for all models
  34. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params)
  35. energy = path_plot.evaluate_path()
  36. x_axis = path_plot.rot_path.stack_x_axes()
  37. # path_plot_gauss = PathEnergyPlot(ex_gauss, ex_gauss2, QuadPath, dist=2., params=params)
  38. # energy_gauss = path_plot_gauss.evaluate_path()
  39. #
  40. # path_plot_cap = PathEnergyPlot(ex_cap, ex_cap2, QuadPath, dist=2., params=params)
  41. # energy_cap = path_plot_cap.evaluate_path()
  42. # peak_energy_sanity_check
  43. # ex1new = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  44. # ex2new = ex1new.clone()
  45. # pp_energy = interactions.charged_shell_energy(ex1new, ex2new, params)
  46. # print(f'PP energy: {pp_energy}')
  47. # Emanuele data
  48. em_data = np.load(Path(config_data["emanuele_data"]).joinpath("FIG_3C").joinpath("pathway.npz"))['arr_0']
  49. # em_data = np.load(Path(config_data["emanuele_data"]).joinpath("FIG_7").joinpath("pathway.npz"))['arr_0']
  50. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("FIXEDCHARGE")
  51. # .joinpath("FIX_A").joinpath("ECC_0.25"))
  52. # em_data = np.load(em_data_path.joinpath(f"EMME_{kappaR}.").joinpath("pathway.npz"))['arr_0']
  53. if save_data:
  54. np.savez(Path(config_data["figure_data"]).joinpath(f"fig_7_kR{kappaR}.npz"),
  55. ICi=em_data,
  56. CSp=np.stack((x_axis, np.squeeze(energy))).T,
  57. # CSp_gauss=np.stack((x_axis, np.squeeze(energy_gauss))).T,
  58. # CSp_cap=np.stack((x_axis, np.squeeze(energy_cap))).T
  59. )
  60. fig, ax = plt.subplots(figsize=(8.25, 3))
  61. ax.plot(em_data[:, 0], em_data[:, 1], label='ICi', c=COLOR_LIST[1])
  62. ax.plot(x_axis, np.squeeze(energy), label='CSp', c=COLOR_LIST[1], ls='--')
  63. # ax.plot(x_axis, np.squeeze(energy_gauss), label='CSp - Gauss')
  64. # ax.plot(x_axis, np.squeeze(energy_cap), label='CSp - cap')
  65. # ax.plot(x_axis, em_data[:, 1] / np.squeeze(energy), label='CSp')
  66. path_plot.plot_style(fig, ax, size=(8.25, 3.5))
  67. if save_as is not None:
  68. plt.savefig(save_as, dpi=300)
  69. plt.show()
  70. def kappaR_dependence(kappaR: Array, abar: float, sigma_tilde=0.001, save_as=None):
  71. params = ModelParams(R=150, kappaR=kappaR)
  72. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  73. ex2 = ex1.clone()
  74. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=0)
  75. path_plot.plot(labels=[rf'$\kappa R$={kR}' for kR in kappaR],
  76. # norm_euler_angles={'beta2': np.pi},
  77. save_as=save_as)
  78. def abar_dependence(abar: Array, kappaR: float, sigma_tilde=0.001, save_as=None):
  79. params = ModelParams(R=150, kappaR=kappaR)
  80. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  81. ex2 = ex1.clone()
  82. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=None)
  83. path_plot.plot(labels=[rf'$\bar a$={a}' for a in abar],
  84. # norm_euler_angles={'beta2': np.pi},
  85. save_as=save_as)
  86. def sigma0_dependence(sigma0: Array, kappaR: float, abar: float, sigma_tilde=0.001, save_as=None):
  87. params = ModelParams(R=150, kappaR=kappaR)
  88. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30, sigma0=sigma0)
  89. ex2 = ex1.clone()
  90. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=None)
  91. path_plot.plot(labels=[rf'$\eta={s0 / sigma_tilde}$' for s0 in sigma0],
  92. # norm_euler_angles={'beta2': np.pi},
  93. save_as=save_as)
  94. def distance_dependence(dist: Array, kappaR: float, abar: float, sigma_tilde=0.001, save_as=None):
  95. params = ModelParams(R=150, kappaR=kappaR)
  96. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  97. ex2 = ex1.clone()
  98. plots = []
  99. for d in dist:
  100. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=d, params=params)
  101. x = d * kappaR
  102. plots.append(path_plot.evaluate_path() * np.exp(x) * x)
  103. x_axis = path_plot.rot_path.stack_x_axes()
  104. labels = [rf'$\rho/R ={d}$' for d in dist]
  105. fig, ax = plt.subplots(figsize=plt.figaspect(0.5))
  106. for pl, lbl in zip(plots, labels):
  107. ax.plot(x_axis, pl, label=lbl)
  108. QuadPath.plot_style(fig, ax)
  109. ax.set_ylabel(r'$U \kappa\rho e^{\kappa\rho}$', fontsize=15)
  110. if save_as is not None:
  111. plt.savefig(save_as, dpi=300)
  112. plt.show()
  113. def IC_kappaR_dependence(config_data: dict, save_as=None):
  114. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("FIXEDCHARGE")
  115. # .joinpath("FIX_A").joinpath("ECC_0.25"))
  116. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("FIXEDCHARGE")
  117. .joinpath("FIX_A").joinpath("ECC_0.25"))
  118. kR1 = np.load(em_data_path.joinpath("EMME_1.").joinpath("pathway.npz"))['arr_0']
  119. kR3 = np.load(em_data_path.joinpath("EMME_3.").joinpath("pathway.npz"))['arr_0']
  120. kR10 = np.load(em_data_path.joinpath("EMME_10.").joinpath("pathway.npz"))['arr_0']
  121. labels = [rf'$\kappa R$={kR}' for kR in [1, 3, 10]]
  122. fig, ax = plt.subplots()
  123. ax.plot(kR1[:, 0], kR1[:, 1], label=labels[0])
  124. ax.plot(kR3[:, 0], kR3[:, 1], label=labels[1])
  125. ax.plot(kR10[:, 0], kR10[:, 1], label=labels[2])
  126. QuadPath.plot_style(fig, ax)
  127. if save_as is not None:
  128. plt.savefig(save_as, dpi=300)
  129. plt.show()
  130. def IC_abar_dependence(config_data: dict, save_as=None):
  131. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("FIXEDCHARGE").joinpath("FIX_M"))
  132. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("FIXEDCHARGE").joinpath("FIX_M"))
  133. a03 = np.load(em_data_path.joinpath("ECC_0.15").joinpath("EMME_3.").joinpath("pathway.npz"))['arr_0']
  134. a04 = np.load(em_data_path.joinpath("ECC_0.2").joinpath("EMME_3.").joinpath("pathway.npz"))['arr_0']
  135. a05 = np.load(em_data_path.joinpath("ECC_0.25").joinpath("EMME_3.").joinpath("pathway.npz"))['arr_0']
  136. labels =[rf'$\bar a$={a}' for a in [0.3, 0.4, 0.5]]
  137. fig, ax = plt.subplots()
  138. ax.plot(a03[:, 0], a03[:, 1], label=labels[0])
  139. ax.plot(a04[:, 0], a04[:, 1], label=labels[1])
  140. ax.plot(a05[:, 0], a05[:, 1], label=labels[2])
  141. QuadPath.plot_style(fig, ax)
  142. if save_as is not None:
  143. plt.savefig(save_as, dpi=300)
  144. plt.show()
  145. def IC_sigma0_dependence(config_data: dict, save_as=None):
  146. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("CHARGE_ZC"))
  147. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("CHARGE_ZC"))
  148. undercharged = np.load(em_data_path.joinpath("ZC_-277.27").joinpath("pathway.npz"))['arr_0']
  149. neutral = np.load(em_data_path.joinpath("ZC_-560").joinpath("pathway.npz"))['arr_0']
  150. overchargerd = np.load(em_data_path.joinpath("ZC_-842.74").joinpath("pathway.npz"))['arr_0']
  151. labels = [rf'$\eta={eta}$' for eta in [-0.1, 0, 0.1]]
  152. fig, ax = plt.subplots()
  153. ax.plot(overchargerd[:, 0], overchargerd[:, 1], label=labels[0])
  154. ax.plot(neutral[:, 0], neutral[:, 1], label=labels[1])
  155. ax.plot(undercharged[:, 0], undercharged[:, 1], label=labels[2])
  156. QuadPath.plot_style(fig, ax)
  157. if save_as is not None:
  158. plt.savefig(save_as, dpi=300)
  159. plt.show()
  160. def combined_distance_dependence(config_data: dict, dist: Array = 2 * np.array([1., 1.15, 1.3, 1.45]),
  161. kappaR: float = 3,
  162. abar: float = 0.5,
  163. sigma_tilde=0.001,
  164. save_as=None):
  165. # em_data_path = Path(config_data["emanuele_data"]).joinpath("FIG_12")
  166. em_data_path = Path(config_data["emanuele_data"]).joinpath("FIG_3D_LONG_DIST")
  167. em_data = np.load(em_data_path.joinpath("pathway_fig12A.npz"))
  168. em_data_d2 = np.load(Path(config_data["emanuele_data"]).joinpath("FIG_3C").joinpath("pathway.npz"))['arr_0']
  169. ic_data = [em_data_d2]
  170. for key, d in em_data.items():
  171. ic_data.append(d)
  172. params = ModelParams(R=150, kappaR=kappaR)
  173. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  174. ex2 = ex1.clone()
  175. plots = []
  176. for d in dist:
  177. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=d, params=params)
  178. plots.append(path_plot.evaluate_path())
  179. x_axis = path_plot.rot_path.stack_x_axes()
  180. labels = [rf'$\rho/R ={d}$' for d in dist]
  181. # additional legend
  182. line1 = Line2D([0], [0], color='black', linewidth=1, label='ICi')
  183. line2 = Line2D([0], [0], color='black', linestyle='--', linewidth=1, label='CSp')
  184. fig, ax = plt.subplots()
  185. for i, (d, en, label, c) in enumerate(zip(ic_data, plots, labels, COLORS)):
  186. if i < 3:
  187. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  188. ax.plot(x_axis, en, ls='--', c=c)
  189. QuadPath.plot_style(fig, ax)
  190. main_legend = ax.get_legend()
  191. extra_legend = ax.legend(handles=[line1, line2], loc='upper left', fontsize=15, frameon=False)
  192. ax.add_artist(main_legend)
  193. ax.add_artist(extra_legend)
  194. if save_as is not None:
  195. plt.savefig(save_as, dpi=300)
  196. plt.show()
  197. def combined_rescaled_distance_dependence(config_data: dict,
  198. dist: Array = 2 * np.array([1, 1.5, 2, 3, 5, 10]),
  199. kappaR: float = 3,
  200. abar: float = 0.5,
  201. sigma_tilde=0.001,
  202. save_as=None):
  203. # em_data_path = Path(config_data["emanuele_data"]).joinpath("FIG_12")
  204. em_data_path = Path(config_data["emanuele_data"]).joinpath("FIG_3D_LONG_DIST")
  205. em_data = np.load(em_data_path.joinpath("pathway_fig12B.npz"))
  206. ic_data = []
  207. for key, d in em_data.items():
  208. # if key == 'kr10':
  209. # continue
  210. print(key, np.max(d[:, 1]))
  211. ic_data.append(d)
  212. params = ModelParams(R=150, kappaR=kappaR)
  213. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  214. ex2 = ex1.clone()
  215. plots = []
  216. for d in dist:
  217. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=d, params=params)
  218. x = d * kappaR
  219. plots.append(path_plot.evaluate_path() * np.exp(x) * x)
  220. # plots.append(path_plot.evaluate_path())
  221. x_axis = path_plot.rot_path.stack_x_axes()
  222. labels = [rf'$\rho/R ={d}$' for d in dist]
  223. fig, ax = plt.subplots()
  224. for d, en, label, c in zip(ic_data, plots, labels, COLORS):
  225. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  226. ax.plot(x_axis, en, ls='--', c=c)
  227. QuadPath.plot_style(fig, ax)
  228. ax.set_ylabel(r'$U \kappa\rho e^{\kappa\rho}$', fontsize=15)
  229. if save_as is not None:
  230. plt.savefig(save_as, dpi=300)
  231. plt.show()
  232. def combined_kappaR_dependence(config_data: dict, kappaR: list[int], abar: float, sigma_tilde=0.001, save_as=None):
  233. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("FIXEDCHARGE")
  234. # .joinpath("FIX_A").joinpath(f"ECC_{np.round(abar/2, 4)}"))
  235. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("FIXEDCHARGE")
  236. .joinpath("FIX_A").joinpath(f"ECC_{np.round(abar/2, 4)}"))
  237. ic_data = []
  238. for kR in kappaR:
  239. ic_data.append(np.load(em_data_path.joinpath(f"EMME_{kR}.").joinpath("pathway.npz"))['arr_0'])
  240. params = ModelParams(R=150, kappaR=np.asarray(kappaR))
  241. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  242. ex2 = ex1.clone()
  243. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=0)
  244. energy = path_plot.evaluate_path()
  245. x_axis = path_plot.rot_path.stack_x_axes()
  246. labels = [rf'$\kappa R={kR}$' for kR in [1, 3, 10]]
  247. fig, ax = plt.subplots()
  248. for d, en, label, c in zip(ic_data, energy.T, labels, COLORS):
  249. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  250. ax.plot(x_axis, en, ls='--', c=c)
  251. QuadPath.plot_style(fig, ax)
  252. if save_as is not None:
  253. plt.savefig(save_as, dpi=300)
  254. plt.show()
  255. def combined_abar_dependence(config_data: dict, kappaR: int, abar: list[float], sigma_tilde=0.001, save_as=None):
  256. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("FIXEDCHARGE").joinpath("FIX_M"))
  257. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("FIXEDCHARGE").joinpath("FIX_M"))
  258. ic_data = []
  259. for ab in abar:
  260. ic_data.append(np.load(em_data_path.joinpath(f"ECC_{np.round(ab/2, 4)}").
  261. joinpath(f"EMME_{kappaR}.").joinpath("pathway.npz"))['arr_0'])
  262. params = ModelParams(R=150, kappaR=kappaR)
  263. ex1 = expansion.MappedExpansionQuad(np.asarray(abar), params.kappaR, sigma_tilde, l_max=30)
  264. ex2 = ex1.clone()
  265. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=None)
  266. energy = path_plot.evaluate_path()
  267. x_axis = path_plot.rot_path.stack_x_axes()
  268. labels = [rf'$\bar a={a}$' for a in [0.3, 0.4, 0.5]]
  269. fig, ax = plt.subplots()
  270. for d, en, label, c in zip(ic_data, energy.T, labels, COLORS):
  271. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  272. ax.plot(x_axis, en, ls='--', c=c)
  273. QuadPath.plot_style(fig, ax)
  274. if save_as is not None:
  275. plt.savefig(save_as, dpi=300)
  276. plt.show()
  277. def combined_sigma0_dependence(config_data: dict, kappaR=3., abar=0.5, sigma0=(0.0002, 0.00, -0.0002), sigma_tilde=0.001, save_as=None):
  278. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("CHARGE_ZC"))
  279. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("CHARGE_ZC"))
  280. undercharged = np.load(em_data_path.joinpath("ZC_-503").joinpath("pathway.npz"))['arr_0']
  281. neutral = np.load(em_data_path.joinpath("ZC_-560").joinpath("pathway.npz"))['arr_0']
  282. overchargerd = np.load(em_data_path.joinpath("ZC_-617").joinpath("pathway.npz"))['arr_0']
  283. ic_data = [undercharged, neutral, overchargerd]
  284. params = ModelParams(R=150, kappaR=kappaR)
  285. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30, sigma0=np.asarray(sigma0))
  286. ex2 = ex1.clone()
  287. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=None)
  288. energy = path_plot.evaluate_path()
  289. x_axis = path_plot.rot_path.stack_x_axes()
  290. labels = [rf'$\eta={s0/sigma_tilde}$' for s0 in sigma0]
  291. fig, ax = plt.subplots()
  292. for d, en, label, c in zip(ic_data, energy.T, labels, COLORS):
  293. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  294. ax.plot(x_axis, en, ls='--', c=c)
  295. QuadPath.plot_style(fig, ax)
  296. if save_as is not None:
  297. plt.savefig(save_as, dpi=300)
  298. plt.show()
  299. def combined_all(config_data: dict, save_as=None):
  300. sigma_tilde = 0.001
  301. kappaR_list = [1, 3, 10]
  302. abar_list = [0.5, 0.4, 0.3]
  303. sigma0_list = [0.0002, 0.00, -0.0002]
  304. kappaR = 3
  305. abar = 0.5
  306. em_data_kappaR = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("FIXEDCHARGE")
  307. .joinpath("FIX_A").joinpath(f"ECC_{np.round(abar/2, 4)}"))
  308. ic_data_kappaR = []
  309. for kR in kappaR_list:
  310. ic_data_kappaR.append(np.load(em_data_kappaR.joinpath(f"EMME_{kR}.").joinpath("pathway.npz"))['arr_0'])
  311. params = ModelParams(R=150, kappaR=np.asarray(kappaR_list))
  312. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  313. ex2 = ex1.clone()
  314. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=0)
  315. energy_kappaR = path_plot.evaluate_path()
  316. x_axis_kappaR = path_plot.rot_path.stack_x_axes()
  317. labels_kappaR = [rf'$\kappa R={kR}$' for kR in [1, 3, 10]]
  318. em_data_abar = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("FIXEDCHARGE").joinpath("FIX_M"))
  319. ic_data_abar = []
  320. for ab in abar_list:
  321. ic_data_abar.append(np.load(em_data_abar.joinpath(f"ECC_{np.round(ab/2, 4)}").
  322. joinpath(f"EMME_{kappaR}.").joinpath("pathway.npz"))['arr_0'])
  323. params = ModelParams(R=150, kappaR=kappaR)
  324. ex1 = expansion.MappedExpansionQuad(np.asarray(abar_list), params.kappaR, sigma_tilde, l_max=30)
  325. ex2 = ex1.clone()
  326. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=None)
  327. energy_abar = path_plot.evaluate_path()
  328. x_axis_abar = path_plot.rot_path.stack_x_axes()
  329. labels_abar = [rf'$\bar a={a}$' for a in abar_list]
  330. em_data_charge = (Path(config_data["emanuele_data"]).joinpath("FIG_4_Panels_ACE").joinpath("CHARGE_ZC"))
  331. undercharged = np.load(em_data_charge.joinpath("ZC_-503").joinpath("pathway.npz"))['arr_0']
  332. neutral = np.load(em_data_charge.joinpath("ZC_-560").joinpath("pathway.npz"))['arr_0']
  333. overchargerd = np.load(em_data_charge.joinpath("ZC_-617").joinpath("pathway.npz"))['arr_0']
  334. ic_data_sigma0 = [undercharged, neutral, overchargerd]
  335. params = ModelParams(R=150, kappaR=kappaR)
  336. ex1 = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30, sigma0=np.asarray(sigma0_list))
  337. ex2 = ex1.clone()
  338. path_plot = PathEnergyPlot(ex1, ex2, QuadPath, dist=2., params=params, match_expansion_axis_to_params=None)
  339. energy_sigma0 = path_plot.evaluate_path()
  340. x_axis_sigma0 = path_plot.rot_path.stack_x_axes()
  341. labels_sigma0 = [rf'$\eta={s0/sigma_tilde}$' for s0 in sigma0_list]
  342. fig, axs = plt.subplots(3, 1, figsize=(6, 7.8))
  343. for d, en, label, c in zip(ic_data_kappaR, energy_kappaR.T, labels_kappaR, COLOR_LIST):
  344. axs[0].set_title('Screening', fontsize=15)
  345. axs[0].plot(d[:, 0], d[:, 1], label=label, c=c)
  346. axs[0].plot(x_axis_kappaR, en, ls='--', c=c)
  347. QuadPath.plot_style(fig, axs[0], size=None)
  348. for d, en, label, c in zip(ic_data_abar, energy_abar.T, labels_abar, COLOR_LIST):
  349. axs[1].set_title('Asymmetry', fontsize=15)
  350. axs[1].plot(d[:, 0], d[:, 1], label=label, c=c)
  351. axs[1].plot(x_axis_abar, en, ls='--', c=c)
  352. QuadPath.plot_style(fig, axs[1], size=None)
  353. for d, en, label, c in zip(ic_data_sigma0, energy_sigma0.T, labels_sigma0, COLOR_LIST):
  354. axs[2].set_title('Net charge', fontsize=15)
  355. axs[2].plot(d[:, 0], d[:, 1], label=label, c=c)
  356. axs[2].plot(x_axis_sigma0, en, ls='--', c=c)
  357. for ax in axs:
  358. ax.yaxis.set_label_coords(-0.09, 0.5)
  359. # axs[-1].set_xlabel('rotational path', fontsize=15)
  360. QuadPath.plot_style(fig, axs[2], size=None)
  361. for ax in axs:
  362. ax.get_legend().set_bbox_to_anchor((0.65, 1))
  363. if save_as is not None:
  364. plt.savefig(save_as, dpi=300)
  365. plt.show()
  366. def main():
  367. with open(Path("/home/andraz/ChargedShells/charged-shells/config.json")) as config_file:
  368. config_data = json.load(config_file)
  369. # model_comparison(config_data, save_data=False,
  370. # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('quad_og_comparison.png')
  371. # )
  372. # kappaR_dependence(np.array([1, 3, 10]), 0.5,
  373. # # save_as=Path("/home/andraz/ChargedShells/Figures/quadrupole_kappaR_dep.png")
  374. # )
  375. #
  376. # abar_dependence(np.array([0.3, 0.4, 0.5]), 3,
  377. # save_as=Path("/home/andraz/ChargedShells/Figures/quadrupole_abar_dep.png")
  378. # )
  379. # sigma0_dependence(np.array([-0.0002, 0.00, 0.0002]), 3, 0.5,
  380. # save_as=Path("/home/andraz/ChargedShells/Figures/quadrupole_charge_dep_abar05_kappaR3.png")
  381. # )
  382. # distance_dependence(dist=np.array([2, 3, 4, 6, 10, 20]), kappaR=3, abar=0.5,
  383. # # save_as=Path(config_data["figures"]).joinpath('quadrupole_distance_dep.png')
  384. # )
  385. # IC_kappaR_dependence(config_data,
  386. # save_as=Path(config_data["figures"]).joinpath("Emanuele_data").joinpath('IC_quadrupole_kappaR_dep.png')
  387. # )
  388. #
  389. # IC_abar_dependence(config_data, save_as=Path(config_data["figures"]).joinpath("Emanuele_data").
  390. # joinpath('IC_quadrupole_abar_dep.png'))
  391. #
  392. # IC_sigma0_dependence(config_data, save_as=Path(config_data["figures"]).joinpath("Emanuele_data").
  393. # joinpath('IC_quadrupole_charge_dep_abar05_kappaR3.png'))
  394. # combined_kappaR_dependence(config_data, kappaR=[1, 3, 10], abar=0.5,
  395. # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('quad_kappaR_dep.png')
  396. # )
  397. # combined_sigma0_dependence(config_data,
  398. # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('quad_charge_dep.png')
  399. # )
  400. # combined_abar_dependence(config_data, kappaR=3, abar=[0.3, 0.4, 0.5],
  401. # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('quad_abar_dep.png')
  402. # )
  403. # combined_rescaled_distance_dependence(config_data)
  404. combined_distance_dependence(config_data,
  405. save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('quad_dist_dep.png')
  406. )
  407. # combined_all(config_data,
  408. # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('quad_combined_dep.png')
  409. # )
  410. if __name__ == '__main__':
  411. main()