dip_path_plot.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. from charged_shells.rotational_path import PairRotationalPath, PathEnergyPlot
  4. from charged_shells import expansion, interactions
  5. from charged_shells.parameters import ModelParams
  6. from pathlib import Path
  7. import json
  8. from plot_settings import *
  9. Array = np.ndarray
  10. zero_to_pi_half = np.linspace(0, np.pi/2, 100, endpoint=True)
  11. pi_half_to_pi = np.linspace(np.pi/2, np.pi, 100, endpoint=True)
  12. pi_to_three_halves_pi = np.linspace(np.pi, 3 * np.pi / 2, 100, endpoint=True)
  13. DipolePath = PairRotationalPath()
  14. DipolePath.set_default_x_axis(zero_to_pi_half)
  15. DipolePath.add_euler(beta2=pi_half_to_pi[::-1])
  16. DipolePath.add_euler(beta2=zero_to_pi_half[::-1])
  17. DipolePath.add_euler(beta2=zero_to_pi_half, beta1=zero_to_pi_half)
  18. DipolePath.add_euler(beta2=np.pi/2, beta1=np.pi/2, alpha2=zero_to_pi_half)
  19. DipolePath.add_euler(beta2=np.pi/2, alpha2=np.pi/2, beta1=pi_half_to_pi)
  20. DipolePath.add_euler(beta2=np.pi/2, beta1=pi_half_to_pi[::-1], alpha1=np.pi)
  21. DipolePath.add_euler(beta2=zero_to_pi_half[::-1], beta1=pi_half_to_pi, alpha1=np.pi)
  22. DipolePath.add_euler(beta2=zero_to_pi_half, beta1=pi_half_to_pi[::-1], alpha1=np.pi)
  23. DipolePath.add_euler(beta2=pi_half_to_pi, beta1=zero_to_pi_half[::-1], alpha1=np.pi)
  24. DipolePath2 = PairRotationalPath()
  25. DipolePath2.set_default_x_axis(zero_to_pi_half)
  26. DipolePath2.add_euler(beta2=pi_half_to_pi[::-1])
  27. DipolePath2.add_euler(beta2=zero_to_pi_half[::-1])
  28. DipolePath2.add_euler(beta2=zero_to_pi_half, beta1=zero_to_pi_half)
  29. DipolePath2.add_euler(beta2=np.pi/2, beta1=np.pi/2, alpha2=zero_to_pi_half)
  30. DipolePath2.add_euler(beta2=np.pi/2, alpha2=np.pi/2, beta1=pi_half_to_pi)
  31. DipolePath2.add_euler(beta2=zero_to_pi_half[::-1], beta1=pi_half_to_pi[::-1])
  32. DipolePath2.add_euler(beta2=zero_to_pi_half[::-1], beta1=np.pi)
  33. DipolePath2.add_euler(beta2=zero_to_pi_half, beta1=pi_half_to_pi[::-1], alpha1=np.pi)
  34. DipolePath2.add_euler(beta2=pi_half_to_pi, beta1=zero_to_pi_half[::-1], alpha1=np.pi)
  35. DipolePath3 = PairRotationalPath()
  36. DipolePath3.set_default_x_axis(zero_to_pi_half)
  37. DipolePath3.add_euler(beta2=np.pi/2, beta1=zero_to_pi_half, start_name="EP", end_name="EE")
  38. DipolePath3.add_euler(beta2=pi_half_to_pi, beta1=pi_half_to_pi, end_name="PP")
  39. DipolePath3.add_euler(beta2=pi_half_to_pi[::-1], beta1=np.pi, end_name="EP")
  40. DipolePath3.add_euler(beta2=pi_half_to_pi, beta1=pi_half_to_pi[::-1], end_name="EP")
  41. DipolePath3.add_euler(beta1=np.pi/2, beta2=pi_half_to_pi[::-1], alpha2=np.pi/2, end_name="tEE")
  42. DipolePath3.add_euler(beta1=np.pi/2, beta2=np.pi/2, alpha1=zero_to_pi_half[::-1], end_name="EE")
  43. DipolePath3.add_euler(beta1=np.pi/2, beta2=zero_to_pi_half[::-1], end_name="EP")
  44. def sections_plot(kappaR: float = 3, abar: float = 0.5, sigma_tilde=0.001, save_as=None):
  45. params = ModelParams(R=150, kappaR=kappaR)
  46. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30)
  47. ex2 = ex1.clone()
  48. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  49. path_plot.plot_sections(save_as=save_as)
  50. def kappaR_dependence(kappaR: Array, abar: float, sigma_tilde=0.001, save_as=None):
  51. params = ModelParams(R=150, kappaR=kappaR)
  52. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30)
  53. ex2 = ex1.clone()
  54. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=0)
  55. path_plot.plot(labels=[rf'$\kappa R$={kR}' for kR in kappaR],
  56. # norm_euler_angles={'beta2': np.pi},
  57. save_as=save_as)
  58. def abar_dependence(abar: Array, kappaR: float, sigma_tilde=0.001, save_as=None):
  59. params = ModelParams(R=150, kappaR=kappaR)
  60. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30)
  61. ex2 = ex1.clone()
  62. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  63. path_plot.plot(labels=[rf'$\bar a$={a}' for a in abar],
  64. # norm_euler_angles={'beta2': np.pi},
  65. save_as=save_as)
  66. def sigma0_dependence(sigma0: Array, kappaR: float, abar: float, sigma_tilde=0.001, save_as=None):
  67. params = ModelParams(R=150, kappaR=kappaR)
  68. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30, sigma0=sigma0)
  69. ex2 = ex1.clone()
  70. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  71. path_plot.plot(labels=[rf'$\eta={s0 / sigma_tilde}$' for s0 in sigma0],
  72. # norm_euler_angles={'beta2': np.pi},
  73. save_as=save_as)
  74. def model_comparison(config_data: dict, save_as=None, save_data=False):
  75. kappaR = 3
  76. params = ModelParams(R=150, kappaR=kappaR)
  77. a_bar = 0.5
  78. sigma_tilde = 0.001
  79. ex1 = expansion.MappedExpansionDipole(a_bar, params.kappaR, sigma_tilde, l_max=30)
  80. ex2 = ex1.clone()
  81. ex3 = ex1.clone().inverse_sign()
  82. # matching other models to the mapped CSp model based on equal patch size in potential
  83. # ex_gauss = quadrupole_model_mappings.ic_to_gauss(sigma_tilde, a_bar, params, l_max=30, sigma0=0)
  84. # ex_gauss2 = ex_gauss.clone()
  85. # ex_cap = quadrupole_model_mappings.ic_to_cap(sigma_tilde, a_bar, params, l_max=30, sigma0=0)
  86. # ex_cap2 = ex_cap.clone()
  87. # path plots for all models
  88. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params)
  89. energy = path_plot.evaluate_path()
  90. x_axis = path_plot.rot_path.stack_x_axes()
  91. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params)
  92. energy_inv = path_plot_inv.evaluate_path()
  93. # path_plot_gauss = PathEnergyPlot(ex_gauss, ex_gauss2, DipolePath3, dist=2., params=params)
  94. # energy_gauss = path_plot_gauss.evaluate_path()
  95. #
  96. # path_plot_cap = PathEnergyPlot(ex_cap, ex_cap2, DipolePath3, dist=2., params=params)
  97. # energy_cap = path_plot_cap.evaluate_path()
  98. # peak_energy_sanity_check
  99. # ex1new = expansion.MappedExpansionQuad(abar, params.kappaR, sigma_tilde, l_max=30)
  100. # ex2new = ex1new.clone()
  101. # pp_energy = interactions.charged_shell_energy(ex1new, ex2new, params)
  102. # print(f'PP energy: {pp_energy}')
  103. # Emanuele data
  104. em_data = np.load(Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_A").joinpath("pathway.npz"))['arr_0']
  105. # em_data = np.load(Path(config_data["emanuele_data"]).joinpath("FIG_7").joinpath("pathway.npz"))['arr_0']
  106. # em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_8").joinpath("FIXEDCHARGE")
  107. # .joinpath("FIX_A").joinpath("ECC_0.25"))
  108. # em_data = np.load(em_data_path.joinpath(f"EMME_{kappaR}.").joinpath("pathway.npz"))['arr_0']
  109. em_data, em_data_inv = em_data[:int(len(em_data) / 2)], em_data[int(len(em_data) / 2):]
  110. # if save_data:
  111. # np.savez(Path(config_data["figure_data"]).joinpath(f"fig_5_janus_kR{kappaR}.npz"),
  112. # ICi=em_data,
  113. # CSp=np.stack((x_axis, np.squeeze(energy))).T,
  114. # CSp_gauss=np.stack((x_axis, np.squeeze(energy_gauss))).T,
  115. # CSp_cap=np.stack((x_axis, np.squeeze(energy_cap))).T)
  116. fig, ax = plt.subplots(figsize=0.5 * np.array([8.25, 4.125]))
  117. ax.plot(em_data[:, 0], em_data[:, 1], label='ICi', c='tab:blue')
  118. ax.plot(em_data_inv[:, 0], em_data_inv[:, 1], ls='--', c='tab:blue')
  119. ax.plot(x_axis, np.squeeze(energy), label='CSp', c='tab:orange')
  120. ax.plot(x_axis, np.squeeze(energy_inv), ls='--', c='tab:orange')
  121. # ax.plot(x_axis, np.squeeze(energy_gauss), label='CSp - Gauss')
  122. # ax.plot(x_axis, np.squeeze(energy_cap), label='CSp - cap')
  123. # ax.plot(x_axis, em_data[:, 1] / np.squeeze(energy), label='CSp')
  124. path_plot.plot_style(fig, ax)
  125. if save_as is not None:
  126. plt.savefig(save_as, dpi=300)
  127. plt.show()
  128. def combined_kappaR_dependence(config_data: dict, kappaR: list[int], abar: float, sigma_tilde=0.001, save_as=None):
  129. em_data_path = (Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_C")
  130. .joinpath("FIX_A").joinpath(f"ECC_{np.round(abar/2, 4)}"))
  131. ic_data = []
  132. ic_data_inv = []
  133. for kR in kappaR:
  134. em_data = np.load(em_data_path.joinpath(f"EMME_{kR}.").joinpath("pathway.npz"))['arr_0']
  135. em_data, em_data_inv = em_data[:int(len(em_data) / 2)], em_data[int(len(em_data) / 2):]
  136. ic_data.append(em_data)
  137. ic_data_inv.append(em_data_inv)
  138. params = ModelParams(R=150, kappaR=np.asarray(kappaR))
  139. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30)
  140. ex2 = ex1.clone()
  141. ex3 = ex1.clone().inverse_sign()
  142. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=0)
  143. energy = path_plot.evaluate_path()
  144. x_axis = path_plot.rot_path.stack_x_axes()
  145. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=0)
  146. energy_inv = path_plot_inv.evaluate_path()
  147. labels = [rf'$\kappa R = {kR}$' for kR in [1, 3, 10]]
  148. fig, ax = plt.subplots()
  149. for d, d_inv, en, en_inv, label, c in zip(ic_data, ic_data_inv, energy.T, energy_inv.T, labels, COLORS):
  150. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  151. ax.plot(d_inv[:, 0], d_inv[:, 1], c=c)
  152. ax.plot(x_axis, en, ls='--', c=c)
  153. ax.plot(x_axis, en_inv, ls='--', c=c)
  154. DipolePath3.plot_style(fig, ax)
  155. if save_as is not None:
  156. plt.savefig(save_as, dpi=300)
  157. plt.show()
  158. def combined_abar_dependence(config_data: dict, kappaR: int, abar: list[float], sigma_tilde=0.001, save_as=None):
  159. em_data_path = Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_B").joinpath("FIX_M")
  160. ic_data = []
  161. ic_data_inv = []
  162. for ab in abar:
  163. em_data = np.load(em_data_path.joinpath(f"ECC_{np.round(ab/2, 4)}").joinpath(f"EMME_{kappaR}.").joinpath("pathway.npz"))['arr_0']
  164. em_data, em_data_inv = em_data[:int(len(em_data) / 2)], em_data[int(len(em_data) / 2):]
  165. ic_data.append(em_data)
  166. ic_data_inv.append(em_data_inv)
  167. params = ModelParams(R=150, kappaR=kappaR)
  168. ex1 = expansion.MappedExpansionDipole(np.asarray(abar), params.kappaR, sigma_tilde, l_max=30)
  169. ex2 = ex1.clone()
  170. ex3 = ex1.clone().inverse_sign()
  171. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  172. energy = path_plot.evaluate_path()
  173. x_axis = path_plot.rot_path.stack_x_axes()
  174. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  175. energy_inv = path_plot_inv.evaluate_path()
  176. labels = [rf'$\bar a={a}$' for a in [0.3, 0.4, 0.5]]
  177. fig, ax = plt.subplots()
  178. for d, d_inv, en, en_inv, label, c in zip(ic_data, ic_data_inv, energy.T, energy_inv.T, labels, COLORS):
  179. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  180. ax.plot(d_inv[:, 0], d_inv[:, 1], c=c)
  181. ax.plot(x_axis, en, ls='--', c=c)
  182. ax.plot(x_axis, en_inv, ls='--', c=c)
  183. DipolePath3.plot_style(fig, ax)
  184. if save_as is not None:
  185. plt.savefig(save_as, dpi=300)
  186. plt.show()
  187. 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):
  188. em_data_path = Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_D").joinpath("CHANGE_ZC")
  189. undercharged = np.load(em_data_path.joinpath("ZC_-56").joinpath("pathway.npz"))['arr_0']
  190. overcharged = np.load(em_data_path.joinpath("ZC_56").joinpath("pathway.npz"))['arr_0']
  191. neutral_path = Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_B").joinpath("FIX_M")
  192. neutral = np.load(neutral_path.joinpath(f"ECC_{np.round(abar/2, 4)}").joinpath(f"EMME_{int(kappaR)}.").joinpath("pathway.npz"))['arr_0']
  193. undercharged, undercharged_inv = undercharged[:int(len(undercharged) / 2)], undercharged[int(len(undercharged) / 2):]
  194. overcharged, overcharged_inv = overcharged[:int(len(overcharged) / 2)], overcharged[int(len(overcharged) / 2):]
  195. neutral, neutral_inv = neutral[:int(len(neutral) / 2)], neutral[int(len(neutral) / 2):]
  196. ic_data = [undercharged, neutral, overcharged]
  197. ic_data_inv = [undercharged_inv, neutral_inv, overcharged_inv]
  198. params = ModelParams(R=150, kappaR=kappaR)
  199. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30, sigma0=np.asarray(sigma0))
  200. ex2 = ex1.clone()
  201. ex3 = ex1.clone().inverse_sign(exclude_00=True)
  202. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  203. energy = path_plot.evaluate_path()
  204. x_axis = path_plot.rot_path.stack_x_axes()
  205. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  206. energy_inv = path_plot_inv.evaluate_path()
  207. labels = [rf'$\eta={s0/sigma_tilde}$' for s0 in sigma0]
  208. fig, ax = plt.subplots()
  209. for d, d_inv, en, en_inv, label, c in zip(ic_data, ic_data_inv, energy.T, energy_inv.T, labels, COLORS):
  210. ax.plot(d[:, 0], d[:, 1], label=label, c=c)
  211. ax.plot(d_inv[:, 0], d_inv[:, 1], c=c)
  212. ax.plot(x_axis, en, ls='--', c=c)
  213. ax.plot(x_axis, en_inv, ls='--', c=c)
  214. DipolePath3.plot_style(fig, ax)
  215. if save_as is not None:
  216. plt.savefig(save_as, dpi=300)
  217. plt.show()
  218. def combined_all(config_data: dict, save_as=None):
  219. sigma_tilde = 0.001
  220. kappaR_list = [1, 3, 10]
  221. abar_list = [0.5, 0.4, 0.3]
  222. sigma0_list = [-0.0002, 0.00, 0.0002]
  223. kappaR = 3
  224. abar = 0.5
  225. em_data_kappaR = (Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_C")
  226. .joinpath("FIX_A").joinpath(f"ECC_{np.round(abar / 2, 4)}"))
  227. ic_data_kappaR = []
  228. ic_data_kappaR_inv = []
  229. for kR in kappaR_list:
  230. em_data = np.load(em_data_kappaR.joinpath(f"EMME_{kR}.").joinpath("pathway.npz"))['arr_0']
  231. em_data, em_data_inv = em_data[:int(len(em_data) / 2)], em_data[int(len(em_data) / 2):]
  232. ic_data_kappaR.append(em_data)
  233. ic_data_kappaR_inv.append(em_data_inv)
  234. params = ModelParams(R=150, kappaR=np.asarray(kappaR_list))
  235. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30)
  236. ex2 = ex1.clone()
  237. ex3 = ex1.clone().inverse_sign()
  238. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=0)
  239. energy_kappaR = path_plot.evaluate_path()
  240. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=0)
  241. energy_kappaR_inv = path_plot_inv.evaluate_path()
  242. x_axis_kappaR = path_plot.rot_path.stack_x_axes()
  243. labels_kappaR = [rf'$\kappa R={kR}$' for kR in [1, 3, 10]]
  244. em_data_abar = Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_B").joinpath("FIX_M")
  245. ic_data_abar = []
  246. ic_data_abar_inv = []
  247. for ab in abar_list:
  248. em_data = np.load(
  249. em_data_abar.joinpath(f"ECC_{np.round(ab / 2, 4)}").joinpath(f"EMME_{kappaR}.").joinpath("pathway.npz"))[
  250. 'arr_0']
  251. em_data, em_data_inv = em_data[:int(len(em_data) / 2)], em_data[int(len(em_data) / 2):]
  252. ic_data_abar.append(em_data)
  253. ic_data_abar_inv.append(em_data_inv)
  254. params = ModelParams(R=150, kappaR=kappaR)
  255. ex1 = expansion.MappedExpansionDipole(np.asarray(abar_list), params.kappaR, sigma_tilde, l_max=30)
  256. ex2 = ex1.clone()
  257. ex3 = ex1.clone().inverse_sign()
  258. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  259. energy_abar = path_plot.evaluate_path()
  260. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  261. energy_abar_inv = path_plot_inv.evaluate_path()
  262. x_axis_abar = path_plot.rot_path.stack_x_axes()
  263. labels_abar = [rf'$\bar a={a}$' for a in abar_list]
  264. em_data_charge = Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_D").joinpath("CHANGE_ZC")
  265. undercharged = np.load(em_data_charge.joinpath("ZC_-56").joinpath("pathway.npz"))['arr_0']
  266. overcharged = np.load(em_data_charge.joinpath("ZC_56").joinpath("pathway.npz"))['arr_0']
  267. neutral_path = Path(config_data["emanuele_data"]).joinpath("FIG_5_JANUS").joinpath("FIG_5_JANUS_B").joinpath("FIX_M")
  268. neutral = np.load(
  269. neutral_path.joinpath(f"ECC_{np.round(abar / 2, 4)}").joinpath(f"EMME_{int(kappaR)}.").joinpath("pathway.npz"))[
  270. 'arr_0']
  271. undercharged, undercharged_inv = undercharged[:int(len(undercharged) / 2)], undercharged[
  272. int(len(undercharged) / 2):]
  273. overcharged, overcharged_inv = overcharged[:int(len(overcharged) / 2)], overcharged[int(len(overcharged) / 2):]
  274. neutral, neutral_inv = neutral[:int(len(neutral) / 2)], neutral[int(len(neutral) / 2):]
  275. ic_data_sigma0 = [overcharged, neutral, undercharged]
  276. ic_data_sigma0_inv = [overcharged_inv, neutral_inv, undercharged_inv]
  277. params = ModelParams(R=150, kappaR=kappaR)
  278. ex1 = expansion.MappedExpansionDipole(abar, params.kappaR, sigma_tilde, l_max=30, sigma0=np.asarray(sigma0_list))
  279. ex2 = ex1.clone()
  280. ex3 = ex1.clone().inverse_sign()
  281. path_plot = PathEnergyPlot(ex1, ex2, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  282. energy_sigma0 = path_plot.evaluate_path()
  283. path_plot_inv = PathEnergyPlot(ex1, ex3, DipolePath3, dist=2., params=params, match_expansion_axis_to_params=None)
  284. energy_sigma0_inv = path_plot_inv.evaluate_path()
  285. x_axis_sigma0 = path_plot.rot_path.stack_x_axes()
  286. labels_sigma0 = [rf'$\eta={s0/sigma_tilde}$' for s0 in sigma0_list]
  287. fig, axs = plt.subplots(3, 1, figsize=(6, 7.8))
  288. for d, d_inv, en, en_inv, label, c in zip(ic_data_kappaR, ic_data_kappaR_inv, energy_kappaR.T, energy_kappaR_inv.T, labels_kappaR, COLOR_LIST):
  289. axs[0].set_title('Screening', fontsize=15)
  290. axs[0].plot(d[:, 0], d[:, 1], label=label, c=c)
  291. axs[0].plot(x_axis_kappaR, en, ls='--', c=c)
  292. axs[0].plot(d_inv[:, 0], d_inv[:, 1], c=c)
  293. axs[0].plot(x_axis_kappaR, en_inv, ls='--', c=c)
  294. DipolePath3.plot_style(fig, axs[0], size=None)
  295. axs[0].get_legend().set_bbox_to_anchor((0.65, 1.07))
  296. for d, d_inv, en, en_inv, label, c in zip(ic_data_abar, ic_data_abar_inv, energy_abar.T, energy_abar_inv.T, labels_abar, COLOR_LIST):
  297. axs[1].set_title('Asymmetry', fontsize=15)
  298. axs[1].plot(d[:, 0], d[:, 1], label=label, c=c)
  299. axs[1].plot(x_axis_abar, en, ls='--', c=c)
  300. axs[1].plot(d_inv[:, 0], d_inv[:, 1], c=c)
  301. axs[1].plot(x_axis_abar, en_inv, ls='--', c=c)
  302. DipolePath3.plot_style(fig, axs[1], size=None)
  303. axs[1].get_legend().set_bbox_to_anchor((0.65, 1.05))
  304. for d, d_inv, en, en_inv, label, c in zip(ic_data_sigma0, ic_data_sigma0_inv, energy_sigma0.T, energy_sigma0_inv.T, labels_sigma0, COLOR_LIST):
  305. axs[2].set_title('Net charge', fontsize=15)
  306. axs[2].plot(d[:, 0], d[:, 1], label=label, c=c)
  307. axs[2].plot(x_axis_sigma0, en, ls='--', c=c)
  308. axs[2].plot(d_inv[:, 0], d_inv[:, 1], c=c)
  309. axs[2].plot(x_axis_sigma0, en_inv, ls='--', c=c)
  310. DipolePath3.plot_style(fig, axs[2], size=None)
  311. axs[2].get_legend().set_bbox_to_anchor((0.65, 1.04))
  312. for ax in axs:
  313. ax.yaxis.set_label_coords(-0.09, 0.5)
  314. # axs[-1].set_xlabel('rotational path', fontsize=15)
  315. plt.tight_layout()
  316. if save_as is not None:
  317. plt.savefig(save_as, dpi=300)
  318. plt.show()
  319. if __name__ == '__main__':
  320. with open(Path("/home/andraz/ChargedShells/charged-shells/config.json")) as config_file:
  321. config_data = json.load(config_file)
  322. # sections_plot(save_as=Path("/home/andraz/ChargedShells/Figures/dipole_test_path.png"))
  323. # kappaR_dependence(np.array([3, 5]), 0.5,
  324. # # save_as=Path("/home/andraz/ChargedShells/Figures/quadrupole_kappaR_dep.png")
  325. # )
  326. # abar_dependence(np.array([0.3, 0.4, 0.5]), 3,
  327. # save_as=Path("/home/andraz/ChargedShells/Figures/quadrupole_abar_dep.png")
  328. # )
  329. # sigma0_dependence(np.array([-0.0002, 0.00, 0.0002]), 3, 0.5,
  330. # save_as=Path("/home/andraz/ChargedShells/Figures/quadrupole_charge_dep_abar05_kappaR3.png")
  331. # )
  332. # model_comparison(config_data,
  333. # # save_as=Path(config_data["figures"]).joinpath("Emanuele_data").joinpath('IC_CS_janus_path.pdf')
  334. # )
  335. # combined_kappaR_dependence(config_data, kappaR=[1, 3, 10], abar=0.5,
  336. # # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('janus_kappaR_dep.png')
  337. # )
  338. #
  339. # combined_abar_dependence(config_data, kappaR=3, abar=[0.3, 0.4, 0.5],
  340. # # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('janus_abar_dep.png')
  341. # )
  342. #
  343. # combined_sigma0_dependence(config_data,
  344. # # save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('janus_charge_dep.png')
  345. # )
  346. #
  347. combined_all(config_data,
  348. save_as=Path(config_data["figures"]).joinpath("final_figures").joinpath('janus_combined_dep.png')
  349. )