In [1]:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
%matplotlib notebook
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from ipywidgets import interact,fixed #, interactive, fixed, interact_manual
import ipywidgets as widgets
import pickle
name_data_file = 'newExtrapolated_allCorrection.pickle'
with open(name_data_file, "rb") as input_file:
data = pickle.load(input_file)
data.keys()
Out[1]:
In [2]:
from quantumpropagator import fromLabelsToFloats, labTranformA
phis_ext = labTranformA(data['phis'])
gams_ext = labTranformA(data['gams'])
thes_ext = labTranformA(data['thes'])
phiV_ext, gamV_ext, theV_ext = fromLabelsToFloats(data)
# take step
dphi = phis_ext[0] - phis_ext[1]
dgam = gams_ext[0] - gams_ext[1]
dthe = thes_ext[0] - thes_ext[1]
# take range
range_phi = phis_ext[-1] - phis_ext[0]
range_gam = gams_ext[-1] - gams_ext[0]
range_the = thes_ext[-1] - thes_ext[0]
header = ' Labels extr. internal extr. dq range\n'
string = 'Phi -> {:8.4f} {:8.4f} {:8.4f} {:8.4f} {:8.4f} {:8.4f}\nGam -> {:8.4f} {:8.4f} {:8.4f} {:8.4f} {:8.4f} {:8.4f}\nThe -> {:8.4f} {:8.4f} {:8.4f} {:8.4f} {:8.4f} {:8.4f}'
out = (header + string).format(phiV_ext[-1],phiV_ext[0],phis_ext[-1],phis_ext[0],dphi,range_phi,
gamV_ext[-1],gamV_ext[0],gams_ext[-1],gams_ext[0],dgam,range_gam,
theV_ext[-1],theV_ext[0],thes_ext[-1],thes_ext[0],dthe,range_the)
print(out)
In [1]:
fileh5 = '/home/alessio/Desktop/Noise_Or_Not/m-only_IR_longer_with_nac_2_1_0000/allInput.h5'
inp = qp.readWholeH5toDict(fileh5)
In [27]:
wf2 = np.zeros_like(inp['potCube'],dtype=complex)
allp,allg,allt,alls = wf2.shape
wf = wf2[:,:,:,0].reshape(allp,allg,allt,1)
dime = allp*allg*allt
print(dime,allp,allg,allt)
np.empty((dime,dime))
wf[0,0,0,0] = 1
#qp.Cderivative3dMu(0,wf,inp)
wf[0,0,0,0] = 0
In [22]:
dime=65000
np.empty((dime,dime))
Out[22]:
In [29]:
492800*492800
Out[29]:
In [25]:
inp.keys()
Out[25]:
In [26]:
# I need to cut all those thing and create a consistent inp dictionary with all those arrays cut down to the small non-extrapolated cube
In [4]:
potential = data['potCube']
ground = potential[:,:,:,0]
zero_g = ground - np.amin(ground)
# find the minimum
p_min,g_min,t_min = np.unravel_index(zero_g.argmin(), zero_g.shape)
In [5]:
# The three potentials are
p_linear_pot = zero_g[:,g_min,t_min]
g_linear_pot = zero_g[p_min,:,t_min]
t_linear_pot = zero_g[p_min,g_min,:]
In [6]:
p_linear_pot = p_linear_pot
In [7]:
fig = plt.figure(figsize=(5,5))
plt.plot(p_linear_pot);
# plt.plot(g_linear_pot)
# plt.plot(t_linear_pot)
This is along phi. I take the G element of the kin matrix corresponding to the second derivative.
In [8]:
#
kin = data['kinCube']
p_linear_kin = kin[:,g_min,t_min]
p_linear_mu = p_linear_kin[:,0,2]
#
p_delta = -0.005
g_delta = -0.00535816080362
t_delta = 0.00390081087821
In [ ]:
In [9]:
# 52 here is [len(phis)-3] -> [55-3] because I insert 3 numbers into the toeplitz matrix
from scipy.linalg import toeplitz
p_matrix = toeplitz([-(5/2), (4/3), -(1/12), *np.zeros(52)])
In [10]:
np.set_printoptions(linewidth=250, edgeitems=5)
In [11]:
p_matrix_divided = p_matrix/(dphi**2)
p_matrix_divided
Out[11]:
In [12]:
# linear mu saved in kin matrix is already 1/mass... this is why here I multiply instead of dividing
new = (p_matrix_divided*p_linear_mu)
In [13]:
new
Out[13]:
In [14]:
p_linear_pot_diagonal = np.diag(p_linear_pot)
In [33]:
to_diagonalize = p_linear_pot_diagonal + new
In [32]:
p_linear_pot_diagonal = p_linear_pot_diagonal/27.21
In [34]:
to_diagonalize
Out[34]:
In [35]:
eigVal,eigVec = np.linalg.eig(to_diagonalize)
In [36]:
index_min = np.unravel_index(eigVal.argmin(), eigVal.shape)
eigVal,index_min, eigVal[index_min]
Out[36]:
In [37]:
eigVec
Out[37]:
In [38]:
p_gaussian = eigVec[index_min]
p_gaussian, np.linalg.norm(p_gaussian)
Out[38]:
In [39]:
fig = plt.figure(figsize=(5,5))
plt.plot(phis_ext,p_gaussian);
In [43]:
np.sort(eigVal)
Out[43]:
In [44]:
eigVal
Out[44]:
In [41]:
eigVal[28]
Out[41]:
In [42]:
eigVec[28]
Out[42]:
In [27]:
fig = plt.figure(figsize=(5,5))
plt.plot(phis_ext,eigVec[28]);
In [ ]: