I'm going to create a figure that compares the magnitude of anisotropy vs. energy threshold for the four data sets.
ipolcgmffreyaEach of the datap/Asym.csv spreadsheets were calculated using the script scripts/plot_Asym_energy_space.py.
Enable interactive plots
In [1]:
%matplotlib notebook
In [2]:
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import (MultipleLocator, FormatStrFormatter, AutoMinorLocator)
import pandas as pd
Move up a directory for easier access
In [3]:
os.getcwd()
Out[3]:
In [4]:
os.chdir('..')
In [5]:
os.getcwd()
Out[5]:
In [6]:
sys.path.append('../scripts')
In [7]:
import bicorr_plot as bicorr_plot
import bicorr_math as bicorr_math
In [8]:
angle_bin_edges = np.arange(10.01,181,10)
angle_bin_centers = bicorr_math.calc_centers(angle_bin_edges)
In [9]:
angle_bin_edges.shape
Out[9]:
In [10]:
os.listdir('cgmf/datap')
Out[10]:
In [11]:
Asym_df_meas = pd.read_csv(r'Cf072115_to_Cf072215b/datap/Asym_df.csv', index_col=0)
Asym_df_cgmf = pd.read_csv(r'cgmf/datap/Asym_df.csv', index_col=0)
Asym_df_freya = pd.read_csv(r'freya/datap/Asym_df.csv', index_col=0)
Asym_df_ipol = pd.read_csv(r'ipol/datap/Asym_df.csv', index_col=0)
Asym_df_ipol_noct = pd.read_csv(r'ipol_noct/datap/Asym_df.csv', index_col=0)
Which do I want to plot on the same distribution?
In [45]:
Asym_dfs=[Asym_df_meas,Asym_df_cgmf,Asym_df_freya,Asym_df_ipol,Asym_df_ipol_noct]
legends =['Experiment', 'CGMF', 'FREYA', 'PoliMi', 'PoliMi-No CT']
fmts = ['x', 's', 'D', 'o', '^']
colors = ['#5d269b', '#dd673b', '#80bc31', '#3cbfe0', '#4242f4']
to_plot = [0,1,2,3]
General plot settings
In [46]:
line_thickness = 1
ebar_width = 3
In [47]:
Asym_df_cgmf.head()
Out[47]:
In [58]:
fig = plt.figure(figsize=(4,4))
ax = plt.gca()
for i in to_plot:
Asym_df = Asym_dfs[i]
ax.errorbar(Asym_df['emin'],
Asym_df['Asym'],
yerr=Asym_df['Asym_err'],
fmt=fmts[i],
markeredgewidth=1,
markerfacecolor='none',
elinewidth=line_thickness,
capthick = line_thickness,
capsize = ebar_width,
c=colors[i])
ax.set_xlim([0.8,4])
ax.set_ylim([.5,4.5])
ax.set_xlabel('$E_{min}$ (MeV)')
ax.set_ylabel('$A_{sym}$')
# Set up ticks
ax.tick_params(axis='both',
which='major',
direction='inout',
length=6,
color='k',
bottom=True, right=True, top=True, left=True)
ax.tick_params(axis='both',
which='minor',
direction='in',
length=3,
bottom=True, right=True, top=True, left=True)
# Major
ax.xaxis.set_major_locator(MultipleLocator(1))
ax.yaxis.set_major_locator(MultipleLocator(1))
# Minor
ax.xaxis.set_minor_locator(MultipleLocator(.2))
ax.yaxis.set_minor_locator(MultipleLocator(0.2))
ax.text(1,4,'(a)', size=15, backgroundcolor='white')
leg = plt.legend([legends[i] for i in to_plot],bbox_to_anchor=(.46,.53))
leg.get_frame().set_edgecolor('w')
plt.tight_layout()
bicorr_plot.save_fig_to_folder('Asym_vs_Emin_compare',r'compare\fig')
In [16]:
In [29]:
def plot_calcs(Asym_df):
x = Asym_df['emin']
y = Asym_df['Asym']
yerr = Asym_df['Asym_err']
return x, y, yerr
In [44]:
Asym_df_exp = Asym_dfs[0]
to_plot = [1,2,3]
fig = plt.figure(figsize=(4,4))
ax = plt.gca()
x, y_exp, yerr_exp = plot_calcs(Asym_df_exp)
for i in to_plot:
Asym_df = Asym_dfs[i]
x_sim, y_sim, yerr_sim = plot_calcs(Asym_df)
y,yerr = bicorr_math.prop_err_division(y_sim,yerr_sim,y_exp,yerr_exp)
ax.errorbar(x, y, yerr=yerr,
fmt=fmts[i],
markeredgewidth=1,
markerfacecolor='none',
elinewidth=line_thickness,
capthick = line_thickness,
capsize = ebar_width,
c=colors[i])
leg = plt.legend([legends[i] for i in to_plot],bbox_to_anchor=(.4,.6))
leg.get_frame().set_edgecolor('w')
plt.axhline(1.0,color='gray', linewidth=1,linestyle='--')
ax.set_xlim([0.8,4])
ax.set_ylim([.5,2])
ax.set_xlabel('$E_{min}$ (MeV)')
ax.set_ylabel(r'$\left[A_{sym}\right]_{SIM} / \left[A_{sym}\right]_{EXP}$')
# Set up ticks
ax.tick_params(axis='both',
which='major',
direction='inout',
length=6,
color='k',
bottom=True, right=True, top=True, left=True)
ax.tick_params(axis='both',
which='minor',
direction='in',
length=3,
bottom=True, right=True, top=True, left=True)
# Major
ax.xaxis.set_major_locator(MultipleLocator(1))
ax.yaxis.set_major_locator(MultipleLocator(.5))
# Minor
ax.xaxis.set_minor_locator(MultipleLocator(.2))
ax.yaxis.set_minor_locator(MultipleLocator(0.1))
ax.text(1,1.83,'(b)', size=15, backgroundcolor='white')
plt.tight_layout()
bicorr_plot.save_fig_to_folder('Asym_vs_Emin_diff',r'compare\fig')
In [18]:
os.getcwd()
Out[18]:
In [17]:
Asym_df
Out[17]:
In [18]:
fig = plt.figure(figsize=(4,4))
ax = plt.gca()
for i in to_plot:
Asym_df = Asym_dfs[i]
ax.errorbar(Asym_df['emin'],
Asym_df['Asym_min'],
yerr=Asym_df['Asym_min_err'],
fmt=fmts[i],
markeredgewidth=1,
markerfacecolor='none',
elinewidth=line_thickness,
capthick = line_thickness,
capsize = ebar_width,
c=colors[i])
ax.set_xlim([0,4])
ax.set_ylim([.5,4.5])
ax.set_xlabel('$E_{min}$')
ax.set_ylabel('$A_{sym}$')
# Set up ticks
ax.tick_params(axis='both',
which='major',
direction='inout',
length=6,
color='k',
bottom=True, right=True, top=True, left=True)
ax.tick_params(axis='both',
which='minor',
direction='in',
length=3,
bottom=True, right=True, top=True, left=True)
# Major
ax.xaxis.set_major_locator(MultipleLocator(1))
ax.yaxis.set_major_locator(MultipleLocator(1))
# Minor
ax.xaxis.set_minor_locator(MultipleLocator(.2))
ax.yaxis.set_minor_locator(MultipleLocator(0.2))
plt.legend([legends[i] for i in to_plot])
plt.tight_layout()
In [18]:
bicorr_plot.save_fig_to_folder('Asym_min_vs_Emin_compare',r'compare\fig')
In [19]:
fig = plt.figure(figsize=(6,6))
ax = plt.gca()
for i in to_plot:
Asym_df = Asym_dfs[i]
ax.errorbar(Asym_df['emin'],
Asym_df['Asym'],
yerr=Asym_df['Asym_err'],
fmt=fmts[i],
markeredgewidth=1,
markerfacecolor='k',
elinewidth=line_thickness,
capthick = line_thickness,
capsize = ebar_width,
c=colors[i])
ax.errorbar(Asym_df['emin'],
Asym_df['Asym_min'],
yerr=Asym_df['Asym_min_err'],
fmt=fmts[i],
markeredgewidth=1,
markerfacecolor='none',
elinewidth=line_thickness,
capthick = line_thickness,
capsize = ebar_width,
c=colors[i])
ax.set_xlim([0,4])
ax.set_ylim([1,4])
ax.set_xlabel('$E_{min}$')
ax.set_ylabel('$A_{sym}$')
# Set up ticks
ax.tick_params(axis='both',
which='major',
direction='inout',
length=6,
color='k',
bottom=True, right=True, top=True, left=True)
ax.tick_params(axis='both',
which='minor',
direction='in',
length=3,
bottom=True, right=True, top=True, left=True)
# Major
ax.xaxis.set_major_locator(MultipleLocator(1))
ax.yaxis.set_major_locator(MultipleLocator(1))
# Minor
ax.xaxis.set_minor_locator(MultipleLocator(.2))
ax.yaxis.set_minor_locator(MultipleLocator(0.2))
plt.legend([legends[i] for i in np.repeat(to_plot,2).tolist()])
plt.tight_layout()
In [27]:
np.repeat(to_plot,2).tolist()
Out[27]:
In [ ]: