|
@@ -1,3 +1,4 @@
|
|
|
+from matplotlib import gridspec
|
|
|
from charged_shells import expansion, interactions, mapping, functions
|
|
|
from charged_shells.parameters import ModelParams
|
|
|
import numpy as np
|
|
@@ -28,7 +29,7 @@ class PeakEP(Peak):
|
|
|
|
|
|
def __init__(self, ex: Expansion, log_y: bool = False, kappaR_axis_in_expansion: int = None):
|
|
|
self.emanuele_data_column = 4
|
|
|
- self.y_label = r'$|U_{EP}|$' if log_y else r'$U_{EP}$'
|
|
|
+ self.y_label = r'$|V_\mathrm{EP}|$' if log_y else r'$V_\mathrm{EP}$'
|
|
|
self.ex1 = ex.clone()
|
|
|
self.ex2 = ex.clone()
|
|
|
self.ex1.rotate_euler(alpha=0, beta=np.pi / 2, gamma=0)
|
|
@@ -40,7 +41,7 @@ class PeakPP(Peak):
|
|
|
|
|
|
def __init__(self, ex: Expansion, log_y: bool = False, kappaR_axis_in_expansion: int = None):
|
|
|
self.emanuele_data_column = 3
|
|
|
- self.y_label = r'$U_{PP}$'
|
|
|
+ self.y_label = r'$V_\mathrm{PP}$'
|
|
|
self.ex1 = ex.clone()
|
|
|
self.ex2 = ex.clone()
|
|
|
self.log_y = log_y
|
|
@@ -51,11 +52,11 @@ class PeakSEP(Peak):
|
|
|
|
|
|
def __init__(self, ex: Expansion, log_y: bool = False, kappaR_axis_in_expansion: int = None):
|
|
|
self.emanuele_data_column = 5
|
|
|
- self.y_label = r'$|U_{sEP}|$' if log_y else r'$U_{sEP}$'
|
|
|
+ self.y_label = r'$|V_\mathrm{sEP}|$' if log_y else r'$V_\mathrm{sEP}$'
|
|
|
self.ex1 = ex.clone()
|
|
|
self.ex2 = ex.clone()
|
|
|
self.ex1.rotate_euler(alpha=0, beta=np.pi / 4, gamma=0)
|
|
|
- self.ex2.rotate_euler(alpha=0, beta=np.pi / 4, gamma=0)
|
|
|
+ self.ex2.rotate_euler(alpha=0, beta=3 * np.pi / 4, gamma=0)
|
|
|
self.log_y = log_y
|
|
|
self.kappaR_axis_in_expansion = kappaR_axis_in_expansion
|
|
|
|
|
@@ -88,12 +89,16 @@ def get_charge_energy_dicts(peak: Peak, params: ModelParams, emanuele_data: Arra
|
|
|
return data_dict_ic, data_dict_cs
|
|
|
|
|
|
|
|
|
-def get_kappaR_energy_dicts(peak: Peak, params: ModelParams, emanuele_data: Array, kappaR: Array, abar_cs: list, max_kappaR: float = 50):
|
|
|
+def get_kappaR_energy_dicts(peak: Peak, params: ModelParams, emanuele_data: Array,
|
|
|
+ kappaR: Array, abar_cs: list, max_kappaR: float = 50, only_loaded: bool = False):
|
|
|
abar_ic, inverse = np.unique(emanuele_data[:, 1], return_inverse=True)
|
|
|
|
|
|
energy_fn = mapping.parameter_map_two_expansions(partial(interactions.charged_shell_energy, dist=2),
|
|
|
peak.kappaR_axis_in_expansion)
|
|
|
- energy = energy_fn(peak.ex1, peak.ex2, params)
|
|
|
+ if not only_loaded:
|
|
|
+ energy = energy_fn(peak.ex1, peak.ex2, params)
|
|
|
+ else:
|
|
|
+ energy = np.full((len(abar_cs), len(kappaR)), 1.)
|
|
|
|
|
|
data_dict_ic = {}
|
|
|
data_dict_cs = {}
|
|
@@ -177,7 +182,7 @@ def IC_peak_energy_plot(config_data: dict,
|
|
|
kappaR = np.geomspace(min_kappaR, max_kappaR, num)
|
|
|
params = ModelParams(R=R, kappaR=kappaR)
|
|
|
|
|
|
- ex = expansion.MappedExpansionQuad(np.array(a_bar)[:, None], params.kappaR[None, :], 0.001, l_max=20)
|
|
|
+ ex = expansion.MappedExpansionQuad(np.array(a_bar)[:, None], params.kappaR[None, :], 0.00099, l_max=20)
|
|
|
|
|
|
if which == 'ep':
|
|
|
peak = PeakEP(ex, log_y, kappaR_axis_in_expansion=1)
|
|
@@ -190,27 +195,43 @@ def IC_peak_energy_plot(config_data: dict,
|
|
|
|
|
|
data_dict_ic, data_dict_cs = get_kappaR_energy_dicts(peak, params, data, kappaR, a_bar, max_kappaR)
|
|
|
|
|
|
+ corrected_data = {}
|
|
|
+ for key, data in data_dict_ic.items():
|
|
|
+ corrected_data[key] = data[:, 1] * higher_multipole_ic_correction(data[:, 0], float(key), higher_l=4)
|
|
|
+
|
|
|
+ corrected_data2 = {}
|
|
|
+ for key, data in data_dict_ic.items():
|
|
|
+ corrected_data2[key] = data[:, 1] * higher_multipole_ic_correction(data[:, 0], float(key), higher_l=6)
|
|
|
+
|
|
|
colors = cycle(plt.rcParams['axes.prop_cycle'].by_key()['color'])
|
|
|
|
|
|
- fig, ax = plt.subplots(figsize=(4.25, 3))
|
|
|
- for (key, data1), data2 in zip(data_dict_ic.items(), data_dict_cs.values()):
|
|
|
- current_color = next(colors)
|
|
|
- ax.plot(data1[:, 0], data1[:, 1], label=rf'$\bar a = {key:.2f}$', c=current_color)
|
|
|
- ax.plot(data2[:, 0], data2[:, 1], ls='--', c=current_color)
|
|
|
- ax.legend(fontsize=14, ncol=1, frameon=False, handlelength=0.7, loc='upper right',
|
|
|
- bbox_to_anchor=(0.42, 0.42),
|
|
|
+ fig = plt.figure(figsize=(2, 1.8))
|
|
|
+ gs = gridspec.GridSpec(1, 1, figure=fig)
|
|
|
+ gs.update(left=0.25, right=0.95, top=0.97, bottom=0.21)
|
|
|
+ ax = fig.add_subplot(gs[0, 0])
|
|
|
+ i = 0
|
|
|
+ for (key, data1), data2, cd, cd2 in zip(data_dict_ic.items(), data_dict_cs.values(), corrected_data.values(), corrected_data2.values()):
|
|
|
+ i += 1
|
|
|
+ if i == 1:
|
|
|
+ current_color = next(colors)
|
|
|
+ ax.plot(data1[:, 0], data1[:, 1], label=rf'$\bar a = {key:.2f}$', c=current_color)
|
|
|
+ ax.plot(data2[:, 0], data2[:, 1], ls='--', c=current_color)
|
|
|
+ ax.plot(data1[:, 0], cd, ls='-', c='r', label=r'$l=4$')
|
|
|
+ ax.plot(data1[:, 0], cd2, ls='-', c='g', label=r'$l=6$')
|
|
|
+ ax.legend(fontsize=9, ncol=1, frameon=False, handlelength=0.7, loc='upper right',
|
|
|
+ bbox_to_anchor=(0.7, 0.52),
|
|
|
# bbox_to_anchor=(0.42, 0.9)
|
|
|
)
|
|
|
- ax.tick_params(which='both', direction='in', top=True, right=True, labelsize=15)
|
|
|
- ax.set_xlabel(r'$\kappa R$', fontsize=15)
|
|
|
+ ax.tick_params(which='both', direction='in', top=True, right=True, labelsize=11)
|
|
|
+ ax.set_xlabel(r'$\kappa R$', fontsize=11)
|
|
|
|
|
|
- ax.set_ylabel(peak.y_label, fontsize=15)
|
|
|
+ ax.set_ylabel(peak.y_label, fontsize=11)
|
|
|
if log_y:
|
|
|
ax.set_yscale('log')
|
|
|
ax.set_xscale('log')
|
|
|
- plt.tight_layout()
|
|
|
+ # plt.tight_layout()
|
|
|
if save_as is not None:
|
|
|
- plt.savefig(save_as, dpi=600)
|
|
|
+ plt.savefig(save_as, dpi=300)
|
|
|
plt.show()
|
|
|
|
|
|
|
|
@@ -347,7 +368,7 @@ def IC_peak_energy_kappaR_combined_plot(config_data: dict,
|
|
|
params = ModelParams(R=R, kappaR=kappaR)
|
|
|
|
|
|
ex = expansion.MappedExpansionQuad(np.sort(np.array(a_bar))[:, None], # sorting necessary as it is also in energy_dicts()
|
|
|
- params.kappaR[None, :], 0.001, l_max=20)
|
|
|
+ params.kappaR[None, :], 0.00099, l_max=20)
|
|
|
|
|
|
peak_ep = PeakEP(ex, log_y=True, kappaR_axis_in_expansion=1)
|
|
|
peak_pp = PeakPP(ex, log_y=True, kappaR_axis_in_expansion=1)
|
|
@@ -357,35 +378,41 @@ def IC_peak_energy_kappaR_combined_plot(config_data: dict,
|
|
|
data_ic = []
|
|
|
data_cs = []
|
|
|
for peak in peaks:
|
|
|
- dict_ic, dict_cs = get_kappaR_energy_dicts(peak, params, data, kappaR, a_bar, max_kappaR)
|
|
|
+ dict_ic, dict_cs = get_kappaR_energy_dicts(peak, params, data, kappaR, a_bar, max_kappaR, only_loaded=False)
|
|
|
data_ic.append(dict_ic)
|
|
|
data_cs.append(dict_cs)
|
|
|
|
|
|
- legend_coords = [(0.58, 0.45), (0.58, 0.43), (0.58, 0.9)]
|
|
|
+ legend_coords = [(0.55, 0.45), (0.55, 0.43), (0.55, 0.63)]
|
|
|
|
|
|
- fig, axs = plt.subplots(3, 1, figsize=(3, 7.8))
|
|
|
+ # fig, axs = plt.subplots(3, 1, figsize=(2, 5.4))
|
|
|
+ fig = plt.figure(figsize=(2, 5.4))
|
|
|
+ gs = gridspec.GridSpec(3, 1, figure=fig)
|
|
|
+ gs.update(left=0.25, right=0.95, top=0.99, bottom=0.07, hspace=0.3)
|
|
|
+ axs = [fig.add_subplot(gs[0, 0]), fig.add_subplot(gs[1, 0]), fig.add_subplot(gs[2, 0])]
|
|
|
for ax, data_dict_ic, data_dict_cs, peak, lc in zip(axs, data_ic, data_cs, peaks, legend_coords):
|
|
|
colors = cycle(plt.rcParams['axes.prop_cycle'].by_key()['color'])
|
|
|
for ab in a_bar:
|
|
|
key = np.around(ab, 5)
|
|
|
current_color = next(colors)
|
|
|
- ax.plot(data_dict_ic[key][:, 0], data_dict_ic[key][:, 1], label=rf'$\bar a = {key:.2f}$', c=current_color)
|
|
|
- ax.plot(data_dict_cs[key][:, 0], data_dict_cs[key][:, 1], ls='--', c=current_color)
|
|
|
- ax.axvline(x=10, c='k', ls=':')
|
|
|
- ax.axvline(x=3, c='k', ls=':')
|
|
|
- ax.axvline(x=1, c='k', ls=':')
|
|
|
- ax.legend(fontsize=13, ncol=1, frameon=False, handlelength=0.7, loc='upper right', bbox_to_anchor=lc)
|
|
|
- ax.tick_params(which='both', direction='in', top=True, right=True, labelsize=15)
|
|
|
+ ax.plot(data_dict_ic[key][:, 0], data_dict_ic[key][:, 1], label=rf'$\bar a = {key:.1f}$', c=current_color, linewidth=1.5)
|
|
|
+ ax.plot(data_dict_cs[key][:, 0], data_dict_cs[key][:, 1], ls='--', c=current_color, linewidth=1.5)
|
|
|
+ ax.axvline(x=10, c='k', ls=':', linewidth=1)
|
|
|
+ ax.axvline(x=3, c='k', ls=':', linewidth=1)
|
|
|
+ ax.axvline(x=1, c='k', ls=':', linewidth=1)
|
|
|
+ ax.legend(fontsize=9, ncol=1, frameon=False, handlelength=0.7, loc='upper right', bbox_to_anchor=lc)
|
|
|
+ ax.tick_params(which='both', direction='in', top=True, right=True, labelsize=11)
|
|
|
# if ax == axs[-1]:
|
|
|
- ax.set_xlabel(r'$\kappa R$', fontsize=15)
|
|
|
+ ax.set_xlabel(r'$\kappa R$', fontsize=11)
|
|
|
|
|
|
- ax.set_ylabel(peak.y_label, fontsize=15)
|
|
|
+ ax.set_ylabel(peak.y_label, fontsize=11)
|
|
|
if peak.log_y:
|
|
|
ax.set_yscale('log')
|
|
|
ax.set_xscale('log')
|
|
|
- ax.yaxis.set_label_coords(-0.2, 0.5)
|
|
|
- plt.subplots_adjust(left=0.3)
|
|
|
- plt.tight_layout()
|
|
|
+ ax.yaxis.set_label_coords(-0.25, 0.5)
|
|
|
+ ax.xaxis.set_label_coords(0.5, -0.12)
|
|
|
+ # plt.subplots_adjust(left=0.1)
|
|
|
+ # plt.tight_layout()
|
|
|
+ # plt.subplots_adjust(left=0.25, right=0.97, top=0.85, bottom=0.15)
|
|
|
if save_as is not None:
|
|
|
plt.savefig(save_as, dpi=300)
|
|
|
plt.show()
|
|
@@ -403,8 +430,8 @@ def IC_peak_energy_charge_combined_plot(config_data: dict,
|
|
|
data = em_data['changeZc']
|
|
|
|
|
|
params = ModelParams(R=R, kappaR=3)
|
|
|
- sigma0 = np.linspace(-0.0003, 0.0003, 300)
|
|
|
- sigma_tilde = 0.001
|
|
|
+ sigma0 = np.linspace(-0.000297, 0.000297, 300)
|
|
|
+ sigma_tilde = 0.00099
|
|
|
|
|
|
ex = expansion.MappedExpansionQuad(np.sort(np.array(a_bar)), # sorting necessary as it is also in energy_dicts()
|
|
|
kappaR=3, sigma0=sigma0, l_max=20, sigma_tilde=sigma_tilde)
|
|
@@ -421,64 +448,74 @@ def IC_peak_energy_charge_combined_plot(config_data: dict,
|
|
|
data_ic.append(dict_ic)
|
|
|
data_cs.append(dict_cs)
|
|
|
|
|
|
- fig, axs = plt.subplots(3, 1, figsize=(3, 7.8))
|
|
|
+ # fig, axs = plt.subplots(3, 1, figsize=(3, 7.8))
|
|
|
+ fig = plt.figure(figsize=(2, 5.4))
|
|
|
+ gs = gridspec.GridSpec(3, 1, figure=fig)
|
|
|
+ gs.update(left=0.25, right=0.95, top=0.99, bottom=0.07, hspace=0.3)
|
|
|
+ axs = [fig.add_subplot(gs[0, 0]), fig.add_subplot(gs[1, 0]), fig.add_subplot(gs[2, 0])]
|
|
|
for ax, data_dict_ic, data_dict_cs, peak in zip(axs, data_ic, data_cs, peaks):
|
|
|
colors = cycle(plt.rcParams['axes.prop_cycle'].by_key()['color'])
|
|
|
for ab in a_bar:
|
|
|
key = np.around(ab, 5)
|
|
|
current_color = next(colors)
|
|
|
- ax.plot(data_dict_ic[key][:, 0], data_dict_ic[key][:, 1], label=rf'$\bar a = {key:.2f}$', c=current_color)
|
|
|
- ax.plot(data_dict_cs[key][:, 0], data_dict_cs[key][:, 1], ls='--', c=current_color)
|
|
|
- ax.legend(fontsize=13, ncol=1, frameon=False, handlelength=0.7, loc='upper right',
|
|
|
+ ax.plot(data_dict_ic[key][:, 0], data_dict_ic[key][:, 1], label=rf'$\bar a = {key:.1f}$', c=current_color, linewidth=1.5)
|
|
|
+ ax.plot(data_dict_cs[key][:, 0], data_dict_cs[key][:, 1], ls='--', c=current_color, linewidth=1.5)
|
|
|
+ ax.legend(fontsize=9, ncol=1, frameon=False, handlelength=0.7, loc='upper right',
|
|
|
bbox_to_anchor=(0.77, 1.03),
|
|
|
)
|
|
|
- ax.tick_params(which='both', direction='in', top=True, right=True, labelsize=15)
|
|
|
+ ax.tick_params(which='both', direction='in', top=True, right=True, labelsize=11)
|
|
|
# if ax == axs[-1]:
|
|
|
- ax.set_xlabel(r'$\eta$', fontsize=15)
|
|
|
+ ax.set_xlabel(r'$\eta$', fontsize=11)
|
|
|
|
|
|
- ax.set_ylabel(peak.y_label, fontsize=15)
|
|
|
+ ax.set_ylabel(peak.y_label, fontsize=11)
|
|
|
if peak.log_y:
|
|
|
ax.set_yscale('log')
|
|
|
# ax.set_xscale('log')
|
|
|
- ax.yaxis.set_label_coords(-0.2, 0.5)
|
|
|
- plt.subplots_adjust(left=0.3)
|
|
|
- plt.tight_layout()
|
|
|
+ ax.yaxis.set_label_coords(-0.18, 0.5)
|
|
|
+ ax.xaxis.set_label_coords(0.5, -0.12)
|
|
|
+ # plt.subplots_adjust(left=0.3)
|
|
|
+ # plt.tight_layout()
|
|
|
if save_as is not None:
|
|
|
plt.savefig(save_as, dpi=300)
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
+def higher_multipole_ic_correction(kappaR, abar, higher_l: int = 4):
|
|
|
+ return (functions.sph_bessel_k(3, kappaR) * functions.sph_bessel_i(2, kappaR * abar) * abar ** (higher_l - 2) /
|
|
|
+ (functions.sph_bessel_k(higher_l + 1, kappaR) * functions.sph_bessel_i(higher_l, kappaR * abar)))
|
|
|
+
|
|
|
+
|
|
|
def main():
|
|
|
with open(Path("/home/andraz/ChargedShells/charged-shells/config.json")) as config_file:
|
|
|
config_data = json.load(config_file)
|
|
|
|
|
|
- # a_bar = [0.2, 0.5, 0.8]
|
|
|
- # IC_peak_energy_plot(config_data, a_bar=a_bar, which='ep', max_kappaR=50,
|
|
|
- # # save_as=Path('/home/andraz/ChargedShells/Figures/Emanuele_data/peak_pp_kappaR.png'),
|
|
|
+ a_bar = [0.2, 0.5, 0.8]
|
|
|
+ # IC_peak_energy_plot(config_data, a_bar=a_bar, which='pp', min_kappaR=0.01, max_kappaR=50,
|
|
|
+ # save_as=Path('/home/andraz/ChargedShells/Figures/Emanuele_data/peak_pp_kappaR_higher_correction_abar02.png'),
|
|
|
# save_data=False,
|
|
|
# quad_correction=False,
|
|
|
- # log_y=True
|
|
|
+ # log_y=False
|
|
|
# )
|
|
|
# IC_peak_energy_kappaR_combined_plot(config_data, a_bar,
|
|
|
# save_as=Path(
|
|
|
# '/home/andraz/ChargedShells/Figures/final_figures/peak_combined_kappaR.png')
|
|
|
# )
|
|
|
|
|
|
- # a_bar = [0.1, 0.2, 0.3]
|
|
|
+ a_bar = [0.1, 0.2, 0.3]
|
|
|
# IC_peak_energy_charge_plot(config_data, a_bar=a_bar, which='sep',
|
|
|
# # save_as=Path('/home/andraz/ChargedShells/Figures/Emanuele_data/peak_sep_charge.png'),
|
|
|
# )
|
|
|
- # IC_peak_energy_charge_combined_plot(config_data, a_bar,
|
|
|
- # save_as=Path('/home/andraz/ChargedShells/Figures/final_figures/peak_combined_charge.png')
|
|
|
- # )
|
|
|
+ IC_peak_energy_charge_combined_plot(config_data, a_bar,
|
|
|
+ save_as=Path('/home/andraz/ChargedShells/Figures/final_figures/peak_combined_charge.png')
|
|
|
+ )
|
|
|
|
|
|
kappaR = [0.01, 3.02407, 30]
|
|
|
- IC_peak_energy_abar_plot(config_data, kappaR=kappaR, which='sep', min_abar=0.2, max_abar=0.8,
|
|
|
- save_as=Path('/home/andraz/ChargedShells/Figures/Emanuele_data/peak_sep_abar.png'),
|
|
|
- save_data=False,
|
|
|
- quad_correction=False,
|
|
|
- log_y=False
|
|
|
- )
|
|
|
+ # IC_peak_energy_abar_plot(config_data, kappaR=kappaR, which='sep', min_abar=0.2, max_abar=0.8,
|
|
|
+ # save_as=Path('/home/andraz/ChargedShells/Figures/Emanuele_data/peak_sep_abar.png'),
|
|
|
+ # save_data=False,
|
|
|
+ # quad_correction=False,
|
|
|
+ # log_y=False
|
|
|
+ # )
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|