In [1]:
import matplotlib.pyplot as plt
import os
import pandas as pd
import numpy as np
import quantumpropagator as qp
from quantumpropagator import readWholeH5toDict, abs2
#from __future__ import print_function
from ipywidgets import interact#, interactive, fixed, interact_manual
import ipywidgets as widgets

def heatThis(h5File,gams,thes,vmaxV,state,save=None):
    save = save or False
    from mpl_toolkits.axes_grid1 import make_axes_locatable
    wf   = qp.retrieve_hdf5_data(h5File,'WF')[:,:,state]
    time = qp.retrieve_hdf5_data(h5File,'Time')[0]
    fig = plt.figure(figsize=(10, 10), dpi= 80, facecolor='w', edgecolor='k')
    plt.title('Time = {:10.5f} fs'.format(time))
    plt.xlabel('Gamma')
    plt.ylabel('Theta')
    
    # this is to get a nice colorbar on the side
    ax = plt.gca()
    aaa = np.rad2deg
    ext = [aaa(gams[0]),aaa(gams[-1]),aaa(thes[0])*2,aaa(thes[-1])*2]
    im = ax.imshow(qp.abs2(wf), extent=ext, cmap='hot', vmax=vmaxV)
    #im = ax.imshow(qp.abs2(wf), cmap='PuBu_r', vmax=0.4)
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.05)

    plt.colorbar(im, cax=cax)
    
    if save:
        fig.savefig(os.path.splitext(h5File)[0] + '.png')
        plt.close()
    
def f(frame,state):
    return heatThis(os.path.join(a,filesList[frame]),gams,thes,vmaxV,state)

In [2]:
subfolders = sorted([ dir for dir in os.listdir('.') if os.path.isdir(dir) and dir != '.ipynb_checkpoints'])
print(''.join(['{} -> {}\n'.format(a,b) for a,b in enumerate(subfolders)]))


0 -> input_FinerGrid_0000


In [3]:
a = subfolders[-1]

In [4]:
filesList = [ fn for fn in sorted(os.listdir(a)) if fn[:8] == 'Gaussian' and fn[-3:] == '.h5']
outh5 = os.path.join(a,'allInput.h5')
dictio = readWholeH5toDict(outh5)
gams,thes = dictio['gams'],dictio['thes']
lastV = len(filesList)-1
# dictio.keys()
zeroWF = qp.retrieve_hdf5_data(os.path.join(a,filesList[0]),'WF')
vmaxV = abs2(zeroWF).max()
gamL,theL,nstates = (qp.retrieve_hdf5_data(os.path.join(a,filesList[0]),'WF')).shape
gamsT = np.rad2deg(gams)
thesT = np.rad2deg(thes)*2

In [5]:
interact(f, frame = widgets.IntSlider(min=0,max=lastV,step=1,value=lastV),state = widgets.IntSlider(min=0,max=nstates-1,step=1,value=0));
createimages = False

if createimages:
    for filn in filesList:
        filna = os.path.join(a,filn)
        heatThis(filna, gams, thes, vmaxV, save=True)


1d slices


In [ ]:


In [6]:
def sliceGammas(h5File, gamma, exa):
    wf  = qp.retrieve_hdf5_data(h5File,'WF')
    fig = plt.figure(figsize=(11, 6), dpi= 80, facecolor='w', edgecolor='k')
    ys = wf[gamma,:]*exa
    time = qp.retrieve_hdf5_data(h5File,'Time')[0]
    plt.title('Time = {:10.5f} fs --- gammaL = {:8.3f}'.format(time,gamsT[gamma]))
    plt.ylim(-0.5,0.5)
    plt.plot(thesT, np.real(ys), linewidth=1,ls='--')
    plt.plot(thesT, np.imag(ys), linewidth=1,ls='--')
    plt.plot(thesT, abs2(ys), linewidth=3,ls='-')

def sliceThetas(h5File, theta, exa):
    wf  = qp.retrieve_hdf5_data(h5File,'WF')
    fig = plt.figure(figsize=(11, 6), dpi= 80, facecolor='w', edgecolor='k')
    ys = wf[:,theta]*exa
    time = qp.retrieve_hdf5_data(h5File,'Time')[0]
    plt.title('Time = {:10.5f} fs --- thetaL = {:8.3f}'.format(time,thesT[theta]))
    plt.ylim(-0.5,0.5)
    plt.plot(gamsT, np.real(ys), linewidth=1,ls='--')
    plt.plot(gamsT, np.imag(ys), linewidth=1,ls='-.')
    plt.plot(gamsT, abs2(ys), linewidth=3,ls='-')    
    
def fgam(file_number,gamma,exa):
    return sliceGammas(os.path.join(a, filesList[file_number]), gamma, exa)

def fthe(file_number,theta,exa):
    return sliceThetas(os.path.join(a, filesList[file_number]), theta, exa)

In [7]:
interact(fgam, file_number = widgets.IntSlider(min=0,max=lastV,step=1,value=lastV), gamma = widgets.IntSlider(min=0,max=gamL-1,step=1,value=10), exa = widgets.IntSlider(min=1,max=10,step=1,value=1));



In [8]:
interact(fthe, file_number = widgets.IntSlider(min=0,max=lastV,step=1,value=lastV), theta = widgets.IntSlider(min=0,max=theL-1,step=1,value=16), exa = widgets.IntSlider(min=1,max=10,step=1,value=1));



In [9]:
outfn = os.path.join(a,'output')
outfnP = os.path.join(a,'outputPopul')

In [10]:
data = pd.read_csv(outfn, delim_whitespace=True, header=None);
dataP = pd.read_csv(outfnP, delim_whitespace=True, header=None);
data.columns = ['steps','fs','Norm Deviation','Kinetic','Potential','Total','Total deviation','Xpulse','Ypulse','Zpulse']

In [11]:
result = pd.concat([data, dataP], axis=1)
result


Out[11]:
steps fs Norm Deviation Kinetic Potential Total Total deviation Xpulse Ypulse Zpulse 0 1 2 3 4 5 6 7 8
0 0 0.000000 0.000000e+00 0.064274 0.102784 0.167058 0.000000e+00 3.719408e-09 3.719408e-09 3.719408e-09 0.0000 1.000000 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
1 10 0.100099 7.439902e-08 0.064406 0.102651 0.167058 5.063434e-08 4.264817e-09 4.264817e-09 4.264817e-09 0.1001 1.000000 8.399130e-17 3.471140e-23 9.187820e-28 5.760610e-18 2.717300e-18 5.488230e-18 5.394270e-18
2 20 0.200199 2.973275e-07 0.064774 0.102284 0.167058 2.018002e-07 -1.908942e-09 -1.908942e-09 -1.908942e-09 0.2002 0.999999 1.641490e-16 6.381730e-23 1.712370e-27 1.099550e-17 4.849570e-18 9.810940e-18 9.815720e-18
3 30 0.300298 6.680473e-07 0.065309 0.101748 0.167057 4.517627e-07 -1.728873e-08 -1.728873e-08 -1.728873e-08 0.3003 0.999999 5.774520e-16 3.388610e-22 8.334470e-27 4.747990e-17 2.721650e-17 5.495340e-17 5.307620e-17
4 40 0.400397 1.185480e-06 0.065959 0.101099 0.167057 7.985574e-07 -3.270009e-08 -3.270009e-08 -3.270009e-08 0.4004 0.999998 6.128880e-15 2.593600e-21 6.641390e-26 4.309960e-16 1.874990e-16 3.756030e-16 3.862950e-16
5 50 0.500496 1.848311e-06 0.066711 0.100346 0.167057 1.240547e-06 -2.134490e-08 -2.134490e-08 -2.134490e-08 0.5005 0.999996 1.686970e-14 5.599470e-21 1.481240e-25 1.061200e-15 3.707910e-16 7.349660e-16 7.931760e-16
6 60 0.600596 2.655021e-06 0.067583 0.099473 0.167056 1.776389e-06 4.710971e-08 4.710971e-08 4.710971e-08 0.6006 0.999995 1.921160e-14 7.621790e-21 1.923410e-25 1.314940e-15 5.227630e-16 1.038010e-15 1.098400e-15
7 70 0.700695 3.603845e-06 0.068591 0.098464 0.167056 2.404641e-06 1.610795e-07 1.610795e-07 1.610795e-07 0.7007 0.999993 1.143980e-13 5.562990e-20 1.425230e-24 8.558170e-15 3.708500e-15 7.295540e-15 7.703430e-15
8 80 0.800794 4.692743e-06 0.069729 0.097326 0.167055 3.123443e-06 2.137000e-07 2.137000e-07 2.137000e-07 0.8008 0.999991 5.361460e-13 2.066550e-19 1.125550e-23 3.478810e-14 1.234480e-14 2.394100e-14 2.626440e-14
9 90 0.900893 5.919403e-06 0.070975 0.096079 0.167054 3.930530e-06 1.788564e-08 1.788564e-08 1.788564e-08 0.9009 0.999988 8.719050e-13 2.774890e-19 2.983520e-23 5.100580e-14 1.512660e-14 2.900050e-14 3.296490e-14
10 100 1.000993 7.281279e-06 0.072307 0.094746 0.167053 4.823422e-06 -5.238151e-07 -5.238151e-07 -5.238151e-07 1.0010 0.999985 1.383100e-12 7.274180e-19 1.770050e-23 1.026230e-13 4.238160e-14 8.202660e-14 8.889130e-14
11 110 1.101092 8.775635e-06 0.073709 0.093343 0.167052 5.799575e-06 -1.125521e-06 -1.125521e-06 -1.125521e-06 1.1011 0.999982 8.798210e-12 4.580220e-18 1.110160e-21 6.131470e-13 2.345200e-13 4.488300e-13 4.975620e-13
12 120 1.201191 1.039956e-05 0.075175 0.091876 0.167051 6.856516e-06 -9.772309e-07 -9.772309e-07 -9.772309e-07 1.2012 0.999979 2.522690e-11 1.091170e-17 1.342980e-20 1.529150e-12 4.808180e-13 9.071210e-13 1.046750e-12
13 130 1.301291 1.214999e-05 0.076703 0.090347 0.167050 7.991863e-06 8.001710e-07 8.001710e-07 8.001710e-07 1.3013 0.999976 2.962010e-11 1.250560e-17 1.882180e-20 1.754110e-12 5.298660e-13 9.962970e-13 1.160790e-12
14 140 1.401390 1.402370e-05 0.078294 0.088755 0.167049 9.202451e-06 3.952689e-06 3.952689e-06 3.952689e-06 1.4014 0.999972 8.626870e-11 6.473230e-17 2.562110e-20 6.416780e-12 2.571470e-12 4.884670e-12 5.519140e-12
15 150 1.501489 1.601728e-05 0.079942 0.087105 0.167047 1.048405e-05 5.917519e-06 5.917519e-06 5.917519e-06 1.5015 0.999968 4.032620e-10 2.856310e-16 2.495490e-18 2.634650e-11 9.036290e-12 1.698680e-11 1.990980e-11
16 160 1.601588 1.812723e-05 0.081636 0.085410 0.167046 1.183547e-05 2.432090e-06 2.432090e-06 2.432090e-06 1.6016 0.999964 7.498350e-10 4.650820e-16 1.303150e-17 4.292850e-11 1.200860e-11 2.227590e-11 2.727730e-11
17 170 1.701688 2.034992e-05 0.083359 0.083685 0.167045 1.325480e-05 -8.677274e-06 -8.677274e-06 -8.677274e-06 1.7017 0.999959 8.751400e-10 7.233030e-16 5.765640e-18 5.767380e-11 1.967640e-11 3.702420e-11 4.399590e-11
18 180 1.801787 2.268165e-05 0.085098 0.081945 0.167043 1.471807e-05 -2.197730e-05 -2.197730e-05 -2.197730e-05 1.8018 0.999955 3.747530e-09 4.429090e-15 1.074710e-16 2.657160e-10 9.625890e-11 1.829360e-10 2.190990e-10
19 190 1.901886 2.511867e-05 0.086840 0.080202 0.167042 1.621070e-05 -2.278693e-05 -2.278693e-05 -2.278693e-05 1.9019 0.999950 1.157740e-08 1.329840e-14 2.273910e-15 7.080300e-10 2.106280e-10 3.983540e-10 4.979300e-10
20 200 2.001985 2.765714e-05 0.088580 0.078461 0.167040 1.779305e-05 3.944332e-06 3.944332e-06 3.944332e-06 2.0020 0.999945 1.509520e-08 1.666930e-14 5.133440e-15 8.415660e-10 2.146440e-10 4.027680e-10 5.200100e-10
21 210 2.102085 3.029318e-05 0.090313 0.076725 0.167039 1.936957e-05 5.460338e-05 5.460338e-05 5.460338e-05 2.1021 0.999939 2.528390e-08 4.010010e-14 1.323530e-16 1.801020e-09 6.234810e-10 1.203410e-09 1.493240e-09
22 220 2.202184 3.302284e-05 0.092038 0.074999 0.167037 2.052744e-05 9.204510e-05 9.204510e-05 9.204510e-05 2.2022 0.999934 1.040060e-07 2.187840e-13 1.106990e-13 6.912170e-09 2.160370e-09 4.195540e-09 5.380470e-09
23 230 2.302283 3.584214e-05 0.093749 0.073287 0.167036 2.157996e-05 5.828055e-05 5.828055e-05 5.828055e-05 2.3023 0.999928 2.141170e-07 6.446120e-13 8.436540e-13 1.222920e-08 3.058420e-09 5.899620e-09 7.950480e-09
24 240 2.402383 3.874703e-05 0.095433 0.071602 0.167035 2.324511e-05 -7.465350e-05 -7.465350e-05 -7.465350e-05 2.4024 0.999922 2.336450e-07 6.859030e-13 8.335560e-13 1.365760e-08 3.518010e-09 6.814490e-09 9.168980e-09
25 250 2.502482 4.173346e-05 0.097073 0.069962 0.167036 2.237324e-05 -2.435486e-04 -2.435486e-04 -2.435486e-04 2.5025 0.999916 5.981900e-07 1.794180e-12 7.348510e-13 4.223200e-08 1.316750e-08 2.617380e-08 3.501520e-08
26 260 2.602581 4.479737e-05 0.098657 0.068385 0.167042 1.589927e-05 -2.883720e-04 -2.883720e-04 -2.883720e-04 2.6026 0.999908 1.839230e-06 1.980430e-11 4.014380e-11 1.135050e-07 2.948490e-08 5.876260e-08 8.261470e-08
27 270 2.702680 4.793472e-05 0.100179 0.066866 0.167045 1.288354e-05 -5.624471e-05 -5.624471e-05 -5.624471e-05 2.7027 0.999901 2.659370e-06 5.831050e-11 1.323710e-10 1.433850e-07 2.995580e-08 5.916910e-08 8.741150e-08
28 280 2.802780 5.114152e-05 0.101640 0.065407 0.167048 1.005834e-05 4.187533e-04 4.187533e-04 4.187533e-04 2.8028 0.999894 3.219690e-06 2.498200e-11 4.557290e-11 2.065320e-07 5.396030e-08 1.093620e-07 1.573740e-07
29 290 2.902879 5.441382e-05 0.103044 0.064048 0.167092 -3.437918e-05 8.104735e-04 8.104735e-04 8.104735e-04 2.9029 0.999880 9.794810e-06 2.258430e-10 4.535330e-10 6.534180e-07 1.692500e-07 3.508030e-07 5.223090e-07
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
61 610 6.106056 1.739766e-04 0.124612 1.249350 1.373962 -1.206904e+00 -1.686749e-02 -1.686749e-02 -1.686749e-02 6.1061 0.793713 1.826300e-01 3.745130e-03 6.162710e-03 7.189680e-03 7.376940e-04 1.851250e-03 3.622920e-03
62 620 6.206155 1.777661e-04 0.126504 1.415674 1.542178 -1.375120e+00 -1.582047e-02 -1.582047e-02 -1.582047e-02 6.2062 0.764062 2.172760e-01 2.161060e-03 2.627490e-03 7.433680e-03 7.569100e-04 1.876030e-03 3.451490e-03
63 630 6.306254 1.815245e-04 0.128445 1.489349 1.617794 -1.450736e+00 -4.435824e-03 -4.435824e-03 -4.435824e-03 6.3063 0.753262 2.029580e-01 1.248770e-02 1.606890e-02 7.254970e-03 1.084080e-03 2.721710e-03 3.799430e-03
64 640 6.406354 1.852574e-04 0.127733 1.500779 1.628512 -1.461454e+00 7.914405e-03 7.914405e-03 7.914405e-03 6.4064 0.750766 2.120070e-01 9.794600e-03 1.255000e-02 7.338680e-03 1.004620e-03 2.493890e-03 3.674140e-03
65 650 6.506453 1.889872e-04 0.127576 1.595275 1.722851 -1.555793e+00 1.275837e-02 1.275837e-02 1.275837e-02 6.5065 0.732293 2.523870e-01 7.955680e-04 9.129990e-04 7.482220e-03 7.610050e-04 1.805070e-03 3.185230e-03
66 660 6.606552 1.927003e-04 0.128988 1.703857 1.832845 -1.665787e+00 8.330710e-03 8.330710e-03 8.330710e-03 6.6066 0.713638 2.656460e-01 2.645120e-03 4.481300e-03 7.105840e-03 8.143250e-04 2.077920e-03 3.206250e-03
67 670 6.706651 1.963800e-04 0.129193 1.725280 1.854473 -1.687415e+00 -4.721843e-04 -4.721843e-04 -4.721843e-04 6.7067 0.710708 2.594180e-01 6.145110e-03 9.793520e-03 6.859410e-03 9.070700e-04 2.401730e-03 3.373770e-03
68 680 6.806751 2.000361e-04 0.128203 1.749195 1.877398 -1.710340e+00 -6.864705e-03 -6.864705e-03 -6.864705e-03 6.8068 0.705763 2.739000e-01 2.542310e-03 4.358800e-03 7.014650e-03 8.090000e-04 2.107090e-03 3.104480e-03
69 690 6.906850 2.036733e-04 0.127729 1.825163 1.952892 -1.785834e+00 -7.262718e-03 -7.262718e-03 -7.262718e-03 6.9068 0.691794 2.950160e-01 1.112520e-04 2.359960e-04 6.908520e-03 7.357070e-04 1.989870e-03 2.802110e-03
70 700 7.006949 2.072831e-04 0.127822 1.871097 1.998918 -1.831860e+00 -2.967978e-03 -2.967978e-03 -2.967978e-03 7.0069 0.684108 2.985500e-01 1.969190e-03 2.461190e-03 6.608200e-03 7.735730e-04 2.242270e-03 2.873710e-03
71 710 7.107048 2.108624e-04 0.127218 1.875662 2.002880 -1.835822e+00 1.957829e-03 1.957829e-03 1.957829e-03 7.1070 0.683463 2.985930e-01 2.218900e-03 2.789070e-03 6.574730e-03 7.790530e-04 2.271960e-03 2.888480e-03
72 720 7.207148 2.144129e-04 0.126277 1.902900 2.029177 -1.862119e+00 4.175329e-03 4.175329e-03 4.175329e-03 7.2071 0.678397 3.078370e-01 5.621520e-04 6.344660e-04 6.567370e-03 7.287720e-04 2.100040e-03 2.744900e-03
73 730 7.307247 2.179323e-04 0.125750 1.943457 2.069207 -1.902149e+00 3.099444e-03 3.099444e-03 3.099444e-03 7.3072 0.671238 3.159460e-01 1.397740e-04 3.648930e-04 6.383290e-03 7.002370e-04 2.074850e-03 2.717030e-03
74 740 7.407346 2.214169e-04 0.125166 1.956164 2.081330 -1.914272e+00 4.658033e-04 4.658033e-04 4.658033e-04 7.4073 0.669190 3.169260e-01 4.994510e-04 1.087100e-03 6.283450e-03 6.992360e-04 2.119380e-03 2.752660e-03
75 750 7.507446 2.248658e-04 0.124334 1.960338 2.084672 -1.917615e+00 -1.545083e-03 -1.545083e-03 -1.545083e-03 7.5074 0.668541 3.181080e-01 3.258690e-04 7.627430e-04 6.276720e-03 6.949110e-04 2.102470e-03 2.738300e-03
76 760 7.607545 2.282780e-04 0.123454 1.978752 2.102205 -1.935147e+00 -1.888895e-03 -1.888895e-03 -1.888895e-03 7.6075 0.665337 3.222170e-01 8.782530e-05 2.430560e-04 6.179030e-03 6.816910e-04 2.079770e-03 2.718540e-03
77 770 7.707644 2.316517e-04 0.122630 1.993672 2.116302 -1.949244e+00 -9.540525e-04 -9.540525e-04 -9.540525e-04 7.7076 0.662814 3.247520e-01 1.678700e-04 2.522910e-04 6.070990e-03 6.738900e-04 2.083110e-03 2.722920e-03
78 780 7.807743 2.349852e-04 0.121808 1.996279 2.118087 -1.951029e+00 1.989296e-04 1.989296e-04 1.989296e-04 7.8077 0.662496 3.249640e-01 2.224620e-04 3.109190e-04 6.051520e-03 6.733130e-04 2.085940e-03 2.726400e-03
79 790 7.907843 2.382763e-04 0.120948 2.000588 2.121536 -1.954478e+00 7.718856e-04 7.718856e-04 7.718856e-04 7.9078 0.661865 3.257660e-01 1.444160e-04 2.262830e-04 6.043840e-03 6.704050e-04 2.086110e-03 2.722120e-03
80 800 8.007942 2.415233e-04 0.120093 2.009075 2.129167 -1.962109e+00 6.441781e-04 6.441781e-04 6.441781e-04 8.0079 0.660495 3.272430e-01 9.251070e-05 1.912810e-04 6.018490e-03 6.653140e-04 2.094570e-03 2.717390e-03
81 810 8.108041 2.447245e-04 0.119230 2.013346 2.132576 -1.965518e+00 1.838933e-04 1.838933e-04 1.838933e-04 8.1080 0.659881 3.278330e-01 9.167270e-05 2.124460e-04 6.013360e-03 6.630850e-04 2.102470e-03 2.712820e-03
82 820 8.208140 2.478783e-04 0.118351 2.014479 2.132831 -1.965773e+00 -1.857204e-04 -1.857204e-04 -1.857204e-04 8.2081 0.659829 3.278840e-01 9.115200e-05 2.109540e-04 6.010800e-03 6.629390e-04 2.102090e-03 2.713170e-03
83 830 8.308240 2.509827e-04 0.117467 2.017343 2.134810 -1.967752e+00 -2.788889e-04 -2.788889e-04 -2.788889e-04 8.3082 0.659468 3.282770e-01 8.889030e-05 1.979390e-04 5.991070e-03 6.620700e-04 2.097350e-03 2.715150e-03
84 840 8.408339 2.540361e-04 0.116582 2.020490 2.137072 -1.970014e+00 -1.631959e-04 -1.631959e-04 -1.631959e-04 8.4083 0.659055 3.287030e-01 9.271910e-05 1.965220e-04 5.976420e-03 6.612760e-04 2.093260e-03 2.713240e-03
85 850 8.508438 2.570370e-04 0.115704 2.021869 2.137573 -1.970515e+00 -5.076515e-06 -5.076515e-06 -5.076515e-06 8.5084 0.658958 3.287950e-01 9.535000e-05 1.984310e-04 5.974610e-03 6.612240e-04 2.091920e-03 2.711890e-03
86 860 8.608538 2.599837e-04 0.114838 2.022902 2.137741 -1.970683e+00 7.979175e-05 7.979175e-05 7.979175e-05 8.6085 0.658922 3.288280e-01 9.390610e-05 1.969870e-04 5.973240e-03 6.610330e-04 2.092560e-03 2.712010e-03
87 870 8.708637 2.628746e-04 0.113981 2.024485 2.138467 -1.971409e+00 7.559546e-05 7.559546e-05 7.559546e-05 8.7086 0.658787 3.289640e-01 9.200610e-05 1.949270e-04 5.971360e-03 6.606960e-04 2.093530e-03 2.710970e-03
88 880 8.808736 2.657082e-04 0.113136 2.025802 2.138938 -1.971880e+00 2.886665e-05 2.886665e-05 2.886665e-05 8.8087 0.658697 3.290500e-01 9.130680e-05 1.940030e-04 5.972110e-03 6.606320e-04 2.093960e-03 2.709970e-03
89 890 8.908835 2.684830e-04 0.112304 2.026662 2.138966 -1.971908e+00 -1.084721e-05 -1.084721e-05 -1.084721e-05 8.9088 0.658686 3.290550e-01 9.124700e-05 1.938990e-04 5.972380e-03 6.606440e-04 2.094000e-03 2.709870e-03
90 900 9.008935 2.711975e-04 0.111490 2.027564 2.139054 -1.971996e+00 -2.333437e-05 -2.333437e-05 -2.333437e-05 9.0089 0.658665 3.290720e-01 9.136420e-05 1.943120e-04 5.971220e-03 6.605930e-04 2.094090e-03 2.709750e-03

91 rows × 19 columns


In [12]:
data.plot(title = 'Norm Deviation', x='fs', y = 'Norm Deviation', figsize=(15,4));



In [13]:
data.plot(title = 'Kinetic', x='fs', y = 'Kinetic', figsize=(15,4));



In [14]:
data.plot(title = 'Potential', x='fs', y = 'Potential', figsize=(15,4));



In [15]:
data['Kinetic_Moved'] = data['Kinetic'] + data['Potential'][0]
data.plot(title = 'Comparison Potential Total Kinetic', x=['fs'] ,y=['Kinetic_Moved','Potential','Total'], figsize=(15,5));



In [16]:
fig = plt.figure(figsize=(9,5))
ax1 = fig.add_subplot(111)
ax2 = ax1.twinx()
ax1.set_ylabel('Population')
ax2.set_ylabel('Pulse')
popul = np.arange(nstates)+1
result.plot(title = 'Population and Pulse', ax = ax1,  x=['fs'] ,y=popul, linewidth=0.8)
result.plot(title = 'Population and Pulse', ax = ax2,  x=['fs'] ,y=['Xpulse','Ypulse','Zpulse'], linewidth=0.5,ls='--');


Expected values


In [17]:
def expected(h5file):
    wf  = qp.retrieve_hdf5_data(h5file,'WF')
    _,_,nstates = wf.shape
    for i in range(nstates):
        wfState = wf[:,:,i]
        popu = np.linalg.norm(wfState) # this is norm, the real popu is this squared
        if popu == 0:
            print('Expected Values State {}:\nPopul: {:10.3f} \nTheta: - \nGamma: -'.format(i, popu**2, theA, gamA))
        else:
            wfA = abs2(wfState/popu)
            gamAvg = np.sum(wfA,axis=1)
            theAvg = np.sum(wfA,axis=0)
            gamA = sum([ gamsT[i] * gamAvg[i] for i in range(gamAvg.size) ])
            theA = sum([ thesT[i] * theAvg[i] for i in range(theAvg.size) ])
            print('Expected Values State {}:\nPopul: {:10.3f} \nTheta: {:10.3f} \nGamma: {:10.3f}'.format(i, popu, theA, gamA))

def fexp(x):
    return expected(os.path.join(a,filesList[x]))

In [18]:
interact(fexp, x = widgets.IntSlider(min=0,max=lastV,step=1,value=lastV));


Initial condition differences


In [19]:
# filesList

In [20]:
%matplotlib notebook
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm

def plotWF(wf):
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    
    #something I do not like here, as X and Y are not in the order I like...
    X,Y = np.meshgrid(thesT,gamsT)

    ax.plot_wireframe(X, Y, wf.real, alpha=0.3)
    ax.plot_wireframe(X, Y, wf.imag, alpha=0.2, color='orange')
    print(wf.shape)

In [21]:
def plotdiffStates(state,frame):
    wf0  = qp.retrieve_hdf5_data(os.path.join(a,filesList[frame]),'WF')
    _,_,nstates = wf0.shape
    return plotWF(wf0[:,:,state])

interact(plotdiffStates, state = widgets.IntSlider(min=0,max=nstates-1,step=1,value=0),frame = widgets.IntSlider(min=0,max=lastV,step=1,value=0));