In [1]:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

import matplotlib.pyplot as plt
import pickle
import os

%matplotlib notebook



In [2]:
fol='/home/alessio/k-nokick'

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


0 -> HTML
1 -> IMPORTANTS
2 -> csv
3 -> d-experiments_smooth01_0000
4 -> d-experiments_smooth10_0000
5 -> d-experiments_smooth50_0000
6 -> d-experiments_smooth50_0001
7 -> y-IR_140_nac0_0000
8 -> y-IR_140_nac10_0000


In [4]:
subfolder = subfolders[4]
subfolder


Out[4]:
'd-experiments_smooth10_0000'

In [5]:
a = os.path.join(fol,subfolder)
filesList = [ fn for fn in sorted(os.listdir(a)) if fn[:8] == 'Gaussian' and fn[-3:] == '.h5']

if filesList == []:
    warning('The folder has not GaussianXXXX.h5 files')

outh5 = os.path.join(a,'allInput.h5')
name_momentum_file = os.path.join(a,'momentum.csv')


if os.path.isfile(name_momentum_file):
#if False:
    qp.good('Momentum file exists !')
    print('if you want to remove it:\n\nrm {}'.format(name_momentum_file))
    dictio = qp.readWholeH5toDict(outh5)
    phis,gams,thes = dictio['phis'],dictio['gams'],dictio['thes']
    dphi,dgam,dthe = dictio['dphi'],dictio['dgam'],dictio['dthe']
    calculate_momentum = False
else:
    calculate_momentum = True
    dictio = qp.readWholeH5toDict(outh5)
    phis,gams,thes = dictio['phis'],dictio['gams'],dictio['thes']
    dphi,dgam,dthe = dictio['dphi'],dictio['dgam'],dictio['dthe']
    print(dictio.keys())
    zeroWF = qp.retrieve_hdf5_data(os.path.join(a,filesList[0]),'WF')
    #vmaxV = abs2(zeroWF).max()
    phiL,gamL,theL,nstates = (qp.retrieve_hdf5_data(os.path.join(a,filesList[0]),'WF')).shape
    filesN = len(filesList)
    allwf = np.empty((filesN,phiL,gamL,theL,nstates),dtype=complex)
    alltime = np.empty((filesN))
    # I need population to normalize momentum
    allPopul = np.empty((filesN,nstates))
    lastV = len(filesList)-1

    # 
    #for i,fn in enumerate(filesList):
    for i,fn in qp.log_progress(enumerate(filesList),every=1,size=(len(filesList))):
        fnn = os.path.join(a,fn)
        wf_here = qp.retrieve_hdf5_data(fnn,'WF')
        allwf[i] = wf_here
        alltime[i] = qp.retrieve_hdf5_data(fnn,'Time')[0]
        for s in range(nstates):
            allPopul[i,s] = np.linalg.norm(wf_here[:,:,:,s])**2

    outfn = os.path.join(a,'output')
    outfnP = os.path.join(a,'outputPopul')


dict_keys(['nacCube', 'natoms', 'phiL', 'dthe', 'gams', 'phis', 'kinCube', 'pulseZ', 'absorb', 'dgam', 'gamL', 'nstates', 'pulseY', 'theL', 'dphi', 'Nac_multiplier', 'thes', 'fullTime', 'vmax_value', 'dt', 'outFol', 'dipCube', 'kind', 'potCube', 'initialTotal', 'pulseX'])

In [6]:
if calculate_momentum:
    momentum_p = np.empty((filesN,nstates+1))
    momentum_g = np.empty((filesN,nstates+1))
    momentum_t = np.empty((filesN,nstates+1))
    max_p = np.empty((filesN,nstates+1))
    max_g = np.empty((filesN,nstates+1))
    max_t = np.empty((filesN,nstates+1))

    for f in qp.log_progress(range(filesN),every=1,size=(filesN)):

        GRID = allwf[f,:,:,:,:]
        momp,momg,momt = qp.CextractMomentum3d(GRID,dictio) # those are the momentum CUBEs

        for s in range(nstates+1):
            if s != 8:
                # The momentum is normalized by the amount of population in a single state
                momentum_p[f,s] = np.real(np.vdot(GRID[:,:,:,s],momp[:,:,:,s]))/allPopul[f,s]
                momentum_g[f,s] = np.real(np.vdot(GRID[:,:,:,s],momg[:,:,:,s]))/allPopul[f,s]
                momentum_t[f,s] = np.real(np.vdot(GRID[:,:,:,s],momt[:,:,:,s]))/allPopul[f,s]
                max_p[f,s] = np.amax(qp.abs2(momp[:,:,:,s]))
                max_g[f,s] = np.amax(qp.abs2(momg[:,:,:,s]))
                max_t[f,s] = np.amax(qp.abs2(momt[:,:,:,s]))
            else:
                momentum_p[f,s] = np.real(np.vdot(GRID,momp))
                momentum_g[f,s] = np.real(np.vdot(GRID,momg))
                momentum_t[f,s] = np.real(np.vdot(GRID,momt))
                max_p[f,s] = np.amax(qp.abs2(momp))
                max_g[f,s] = np.amax(qp.abs2(momg))
                max_t[f,s] = np.amax(qp.abs2(momt))


/home/alessio/config/miniconda/envs/quantumpropagator/lib/python3.5/site-packages/ipykernel_launcher.py:17: RuntimeWarning: invalid value encountered in double_scalars
/home/alessio/config/miniconda/envs/quantumpropagator/lib/python3.5/site-packages/ipykernel_launcher.py:18: RuntimeWarning: invalid value encountered in double_scalars
/home/alessio/config/miniconda/envs/quantumpropagator/lib/python3.5/site-packages/ipykernel_launcher.py:19: RuntimeWarning: invalid value encountered in double_scalars

In [7]:
if calculate_momentum:
    def nameMe(stri):
        return ['{}_{}'.format(stri,x) for x in range(nstates)] + ['{}_{}'.format(stri,'Tot')]

    # nameMe('lol')

    df0 = pd.DataFrame(data=alltime, columns=['fs'])
    df1 = pd.DataFrame(data=momentum_p, columns=nameMe('Momentum-phi'))
    df2 = pd.DataFrame(data=momentum_g, columns=nameMe('Momentum-gam'))
    df3 = pd.DataFrame(data=momentum_t, columns=nameMe('Momentum-the'))
    df4 = pd.DataFrame(data=max_p, columns=nameMe('Max-phi'))
    df5 = pd.DataFrame(data=max_g, columns=nameMe('Max-gam'))
    df6 = pd.DataFrame(data=max_t, columns=nameMe('Max-the'))

    df = pd.concat([df0,df1,df2,df3,df4,df5,df6],axis=1)

    name_momentum_file = os.path.join(a,'momentum.csv')
    df.to_csv(name_momentum_file)
else:
    df = pd.read_csv(name_momentum_file)

In [8]:
def gg(n):
    return (2*np.pi)/n

print(gg(dphi),gg(dgam),gg(dthe))
fig, [ax0,ax1] = plt.subplots(2,1,figsize=(13,9),sharex=True)

ax0.plot(df['fs'],df['Momentum-phi_Tot'], label=('Momentum-phi_Tot'))
ax0.plot(df['fs'],df['Momentum-gam_Tot'], label=('Momentum-gam_Tot'))
ax0.plot(df['fs'],df['Momentum-the_Tot'], label=('Momentum-the_Tot'))
ax0.set_ylim(-50,150)
ax0.set_title('{}'.format(subfolder))
ax0.legend()

ax1.plot(df['fs'],df['Max-phi_Tot'], label=('Max-phi_Tot'))
ax1.plot(df['fs'],df['Max-gam_Tot'], label=('Max-gam_Tot'))
ax1.plot(df['fs'],df['Max-the_Tot'], label=('Max-the_Tot'))
ax1.set_xlabel('fs')
ax1.legend()

fig.tight_layout();


-1256.63706144 -1172.63843648 1610.73825503

In [27]:
df


Out[27]:
fs Momentum-phi_0 Momentum-phi_1 Momentum-phi_2 Momentum-phi_3 Momentum-phi_4 Momentum-phi_5 Momentum-phi_6 Momentum-phi_7 Momentum-phi_Tot ... Max-gam_Tot Max-the_0 Max-the_1 Max-the_2 Max-the_3 Max-the_4 Max-the_5 Max-the_6 Max-the_7 Max-the_Tot
0 0.000000 0.000000 NaN NaN NaN NaN NaN NaN NaN 0.000000 ... 17.776906 5.474280 0.000000e+00 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 5.474280
1 1.250000 9.167955 -6.391985 34.467086 9.883742 11.293490 29.624617 16.336208 15.820818 9.167818 ... 18.609263 5.515158 8.893275e-07 0.000116 0.000112 0.000015 0.000403 0.005479 0.002107 5.515158
2 2.500000 17.945736 7.455246 59.263091 -19.531772 4.293909 34.731340 -17.031993 -7.134737 17.944142 ... 20.667125 5.619381 8.455926e-07 0.000207 0.000281 0.000027 0.001678 0.016929 0.005143 5.619381
3 3.750000 25.974370 28.875222 76.297822 -27.297631 6.424428 34.173196 -5.014172 3.195879 25.969227 ... 21.921271 5.754877 1.322862e-06 0.000149 0.000116 0.000038 0.001753 0.028593 0.011605 5.754877
4 4.999999 32.948828 29.163244 82.113494 -17.661791 36.957739 32.476908 1.858285 4.594981 32.937167 ... 21.209595 5.857422 5.108888e-06 0.000156 0.000129 0.000050 0.003276 0.045891 0.019280 5.857422
5 6.249999 38.624818 35.101563 80.492676 2.997880 30.138296 27.808838 5.921568 13.862100 38.603467 ... 20.010361 5.835310 4.073686e-05 0.000182 0.000175 0.000099 0.004774 0.085881 0.029758 5.835310
6 7.499999 42.818538 39.374829 96.854708 35.298855 72.206145 18.809856 1.910581 13.480753 42.784065 ... 19.558785 5.697583 2.511898e-04 0.000337 0.000337 0.000129 0.010519 0.136696 0.047678 5.697583
7 8.749999 45.399630 42.737514 108.814315 54.400159 67.391571 18.169649 3.456307 34.964467 45.350890 ... 19.871353 5.662306 1.180651e-03 0.002322 0.002237 0.000249 0.007593 0.174543 0.060679 5.662306
8 9.999999 46.323987 43.942649 71.134337 46.314297 75.193406 23.826594 5.230378 31.927066 46.255864 ... 20.040282 5.497293 8.441737e-03 0.025162 0.021411 0.000472 0.032499 0.393003 0.148133 5.497293
9 11.249999 45.634928 42.045437 58.298392 43.719572 71.531117 20.847436 7.257832 44.866508 45.542753 ... 18.832813 5.215908 1.079300e-01 0.246918 0.168840 0.004987 0.052055 0.475800 0.199855 5.215908
10 12.499999 43.472829 36.877305 51.359656 40.796043 75.061015 34.314123 11.118625 44.708668 43.240419 ... 17.450805 4.904653 1.150487e+00 1.514565 0.923707 0.027511 0.191022 2.511098 1.160443 4.904653
11 13.749999 39.796577 29.403282 42.982350 34.503632 64.133996 19.418907 1.671117 38.424249 38.636144 ... 15.191695 5.851488 5.584157e+00 6.003230 5.323992 0.208169 0.816646 3.312456 1.762439 6.003230
12 14.999998 35.107231 15.611469 34.188647 26.284389 5.383823 38.177746 -4.277564 33.544985 30.514824 ... 11.841423 9.240290 1.267773e+01 17.018363 19.510265 1.032187 4.749307 21.350906 24.467172 24.467172
13 16.249998 28.216824 1.768468 27.232924 24.978352 -13.764290 3.328152 -20.010911 17.922056 21.765760 ... 20.165229 9.705480 1.989917e+01 29.837343 43.322073 3.449609 5.892132 18.313341 11.167073 43.322073
14 17.499998 11.822483 -21.136474 32.033596 31.835547 10.193685 5.858998 4.917702 30.506931 16.985386 ... 30.928642 9.665679 3.828258e+01 61.888555 91.648469 10.000921 12.565986 43.868182 33.693453 91.648469
15 18.749998 2.957751 -1.803206 35.910446 -11.982019 5.905179 37.010662 2.037061 1.630613 6.330880 ... 32.680469 10.308282 3.045103e+01 74.896578 93.613461 17.839352 27.289139 28.376128 20.085421 93.613461
16 19.999998 -7.327645 19.067085 -9.322236 -6.248223 -0.647389 36.417110 -6.083955 -16.490325 -2.980299 ... 30.717104 5.045471 2.581731e+01 91.515318 98.693044 16.677407 13.637071 36.066277 22.198302 98.693044
17 21.249998 -17.001619 -5.635683 4.255960 1.225791 6.160157 21.099138 -8.163050 -5.297109 -5.097657 ... 24.113626 3.381381 1.389289e+01 73.870515 50.179211 11.048030 18.163994 25.908439 21.511299 73.870515
18 22.499998 -26.603229 -8.350188 0.574130 -3.218629 8.900050 16.494992 4.422503 -11.415521 -8.684825 ... 25.433311 4.029116 7.751516e+00 51.924166 50.377967 12.146866 12.998899 28.671391 21.062807 51.924166
19 23.749998 -34.954337 -2.654850 6.279803 4.392942 9.345827 19.387765 5.785476 -11.150850 -8.447323 ... 24.127511 4.288509 5.459095e+00 55.648723 76.141883 20.840312 12.186725 28.917306 33.913545 76.141883
20 24.999997 -41.712536 2.913515 3.322228 6.462758 9.656194 24.469911 4.473294 -17.388356 -10.341967 ... 17.590365 3.547518 3.468898e+00 47.854216 36.339773 10.896487 11.883661 30.652538 18.779523 47.854216
21 26.249997 -46.572068 10.946527 5.504077 7.117563 6.834854 22.008794 13.539901 -19.813289 -10.381655 ... 24.768104 3.112310 2.163981e+00 65.759350 90.129614 13.145073 20.160834 48.587192 37.768627 90.129614
22 27.499997 -49.270904 19.888916 1.807020 8.178982 2.241686 19.922752 21.253129 -19.972139 -10.402402 ... 22.575455 2.000997 2.220356e+00 49.651528 49.077928 15.284017 14.758115 42.442345 32.289360 49.651528
23 28.749997 -49.618977 27.479183 3.815625 6.653245 6.075093 16.294305 19.256952 -30.806637 -10.591815 ... 29.829491 2.408252 2.681367e+00 56.767743 56.475928 7.501491 10.520065 29.667203 18.067207 56.767743
24 29.999997 -47.581482 37.337346 6.174982 5.832889 9.825426 15.140502 29.244385 -19.064191 -6.626665 ... 20.313742 2.303050 2.354257e+00 71.443193 66.379493 10.789338 10.727488 24.003776 24.851945 71.443193
25 31.249997 -43.289585 47.306536 9.081721 11.818774 17.121125 14.278097 29.359415 -19.799847 -2.496853 ... 17.000684 2.292407 1.928921e+00 43.355295 48.064609 8.962532 10.699690 29.161052 15.551860 48.064609
26 32.499997 -36.982864 57.400016 7.574214 10.725035 17.511886 18.619961 25.268547 -20.790057 0.226872 ... 32.279182 2.123320 3.025246e+00 66.305551 80.226144 15.188257 14.184248 23.266635 17.207914 80.226144
27 33.749996 -28.954955 67.092806 10.142185 12.982915 12.572534 15.372588 28.883218 -7.671149 5.185907 ... 15.540319 2.094063 2.836805e+00 34.068283 41.877404 17.793411 7.330358 33.216657 15.223783 41.877404
28 34.999996 -19.534761 74.195625 11.579326 9.153407 8.850621 24.554677 20.115858 -7.334637 8.391448 ... 28.672605 1.839726 2.494984e+00 42.377597 58.286403 9.553016 6.366768 23.291614 18.248386 58.286403
29 36.249996 -9.084045 79.168560 10.285178 5.096540 11.124528 31.306479 26.711955 1.841976 13.396980 ... 31.162677 1.835449 4.529380e+00 53.492458 72.957453 24.181958 12.074930 26.674645 21.607947 72.957453
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
81 101.249989 -32.850514 15.544639 3.886730 5.394298 2.996578 6.019010 -9.165979 -7.444840 -7.724702 ... 17.359930 3.056279 3.818787e+00 51.629855 58.231325 9.177656 15.209428 29.516795 26.104268 58.231325
82 102.499989 -36.510107 15.126278 -3.924884 -6.947038 1.180550 5.402024 -6.127584 -4.445429 -11.242750 ... 15.027393 3.603773 3.636780e+00 42.467200 53.162112 8.832842 13.382069 33.331167 21.758928 53.162112
83 103.749989 -38.716778 14.779876 0.213380 -0.342290 0.911680 3.934448 -2.571216 2.091203 -10.580026 ... 20.744867 4.151479 3.693964e+00 48.906392 59.456881 9.635804 9.763210 29.586265 23.346561 59.456881
84 104.999989 -39.351032 14.619186 4.238653 3.430701 -0.489293 4.829299 6.219740 13.268938 -9.350411 ... 20.540779 5.159596 3.913388e+00 63.835309 62.817531 8.607833 15.287080 34.363008 23.735928 63.835309
85 106.249989 -38.180925 13.883297 6.308859 6.912227 4.473870 7.037084 -12.540434 -19.624218 -9.632932 ... 19.083131 3.333289 3.312101e+00 48.167952 60.548357 10.484316 7.015241 42.244055 18.750831 60.548357
86 107.499989 -35.354664 14.372497 9.156270 10.069723 8.307969 6.722351 4.598130 6.849353 -6.355493 ... 25.006220 3.084788 3.547469e+00 57.565831 56.726204 8.947088 8.101011 43.723171 33.075069 57.565831
87 108.749989 -31.099165 14.243444 9.345377 7.139566 10.062966 10.210353 3.831716 7.854821 -5.011037 ... 15.177279 3.602708 3.412690e+00 29.410968 35.943993 9.685209 5.749274 31.363558 20.383535 35.943993
88 109.999988 -25.521161 14.466570 9.232996 6.439612 8.362844 3.509246 -8.779944 -11.945874 -4.637326 ... 21.439595 3.673754 3.507717e+00 75.807983 93.205403 11.153327 13.706895 24.679043 25.278980 93.205403
89 111.249988 -18.677578 13.994569 7.191479 3.826033 3.772297 8.623496 8.819047 13.489442 -1.711690 ... 20.068157 3.213706 3.282587e+00 42.576352 43.684711 9.530645 11.453686 30.218955 15.448321 43.684711
90 112.499988 -10.839184 13.340883 3.646444 1.597998 2.783197 9.937330 4.654637 -1.529218 -0.400626 ... 18.263519 2.838295 2.602055e+00 48.485227 53.829390 7.050977 19.697136 41.230186 13.510556 53.829390
91 113.749988 -2.280190 12.940890 4.349215 -1.382720 9.059235 9.678672 5.046652 2.628602 2.672856 ... 23.102514 2.881530 2.269219e+00 69.429020 88.543843 7.641676 7.242755 38.245170 20.019521 88.543843
92 114.999988 6.784820 12.641070 10.800957 5.560603 11.093809 6.055606 9.718543 12.797975 7.496887 ... 18.522513 3.847634 3.003886e+00 49.376962 43.013028 11.656931 12.119382 32.520246 16.209323 49.376962
93 116.249988 15.833433 11.665752 6.892580 5.538231 2.727168 6.781535 5.061427 3.885034 9.004260 ... 21.889882 3.185280 4.265396e+00 73.433684 102.141243 16.586334 7.276591 32.012741 31.300607 102.141243
94 117.499988 24.494837 11.445578 7.037108 8.182171 0.369956 4.760092 6.506238 3.290415 11.947134 ... 26.416967 2.629508 1.627002e+00 48.924107 39.170813 15.315418 8.142050 41.920330 25.603832 48.924107
95 118.749988 32.311173 12.615615 8.087999 8.907608 2.778930 -2.361002 -2.570394 -7.155389 14.188136 ... 23.376037 2.987548 2.580987e+00 59.600758 79.494078 10.597902 5.722066 49.486565 24.337251 79.494078
96 119.999987 38.793799 12.884613 6.313173 2.758241 0.348264 -1.758998 16.300196 20.949732 16.794078 ... 24.725700 2.827652 2.715580e+00 44.434800 55.865031 8.964777 5.602471 38.156044 34.026128 55.865031
97 121.249987 43.561721 14.751332 3.942797 -0.891624 0.637169 2.290799 4.077465 6.050079 17.374168 ... 19.697021 3.048087 3.047090e+00 33.819300 33.688214 7.575412 5.951198 37.457936 17.349381 37.457936
98 122.499987 46.358531 15.449838 -0.744032 -0.574620 7.440743 3.456535 -4.999934 -5.000921 17.776582 ... 22.861879 2.831311 1.912712e+00 55.856495 75.430114 9.807786 6.167857 31.126588 33.058926 75.430114
99 123.749987 47.010742 15.745383 0.853097 -1.901356 4.021313 -0.588520 9.040987 13.607054 18.647862 ... 17.801895 3.277192 2.472017e+00 50.131439 52.367449 9.623124 8.149215 35.554310 19.234416 52.367449
100 124.999987 45.220285 15.751124 5.104101 -1.029496 6.042605 -2.189228 7.420242 6.293267 18.436314 ... 17.201259 3.330233 2.409321e+00 51.633696 57.414025 8.869607 26.389557 39.179543 16.979566 57.414025
101 126.249987 40.964178 16.274210 5.656719 1.342236 3.815923 1.927489 1.056580 -2.065741 16.991608 ... 24.370473 2.774892 1.766941e+00 31.191693 36.688778 8.045736 16.914260 26.881437 26.383286 36.688778
102 127.499987 34.638973 17.562657 3.134355 -1.315521 -0.540451 2.181083 16.396580 20.604392 15.316618 ... 21.274045 2.800884 1.833926e+00 49.214462 51.821607 15.068535 21.310670 34.666308 16.592255 51.821607
103 128.749986 26.616497 18.509379 1.924925 -0.113999 0.392749 4.426974 0.941244 -1.846333 11.838834 ... 28.215102 3.142164 2.144698e+00 70.707074 79.966582 7.306954 13.152344 27.377691 22.201806 79.966582
104 129.999986 17.424879 18.471704 1.432392 2.155201 3.926778 6.381962 12.150648 18.539178 10.079652 ... 16.610471 4.169062 1.809767e+00 47.322254 55.821645 7.969266 6.406740 27.523312 18.459951 55.821645
105 131.249986 7.764243 19.278943 -2.820629 -1.697263 8.293909 10.117045 8.150639 8.874505 6.156174 ... 28.880381 3.472237 1.889280e+00 54.061731 59.859724 13.098503 8.493650 33.295192 20.108478 59.859724
106 132.499986 -1.792029 18.829052 2.700303 4.054398 6.909542 9.080443 11.594933 14.268682 4.181543 ... 20.630671 3.754190 2.742346e+00 62.532104 78.990295 15.481479 7.186142 33.718150 31.839408 78.990295
107 133.749986 -11.063359 19.903732 4.362515 4.099752 4.214847 9.333719 -5.569832 -8.848372 0.142647 ... 18.824552 4.138799 2.170761e+00 49.213171 58.090293 25.341597 10.984643 37.468770 25.715485 58.090293
108 134.999986 -19.385833 21.616521 6.022089 4.304806 6.243233 9.421594 7.656522 10.518660 -1.227419 ... 22.743877 3.440190 3.018633e+00 72.812221 84.203785 27.559826 13.513960 32.366698 21.059667 84.203785
109 136.249986 -26.600052 21.124558 -0.024946 -1.123745 -1.585364 4.321316 11.566090 13.972017 -5.357775 ... 23.355607 3.881010 2.786247e+00 55.954564 65.389164 23.954486 9.606532 41.629012 19.499229 65.389164
110 137.499986 -32.660671 20.743117 4.272119 1.688962 1.972980 6.533684 3.836003 4.241800 -6.904663 ... 30.014421 3.572768 2.918128e+00 67.688946 88.116780 11.385591 5.207485 20.889918 17.248646 88.116780

111 rows × 55 columns


In [30]:



Out[30]:
'Momentum-phi_2'

In [34]:
fig, [ax0,ax1] = plt.subplots(1,2,figsize=(15,8),sharex=True)

ax0.set_title('ciao')
ax0.set_xlabel('bello')

for i in range(7):
    ciii = 'Momentum-phi_{}'.format(i)
    ax0.plot(df['fs'],df[ciii])

ax0.legend()



fig.tight_layout();



In [9]:
nstates = 8
for s in range(nstates):
    fig, [ax0,ax1] = plt.subplots(2,1,figsize=(12,8),sharex=True)

    ax0.plot(df['fs'],df['Momentum-phi_{}'.format(s)], label=('Momentum-phi_{}'.format(s)))
    ax0.plot(df['fs'],df['Momentum-gam_{}'.format(s)], label=('Momentum-gam_{}'.format(s)))
    ax0.plot(df['fs'],df['Momentum-the_{}'.format(s)], label=('Momentum-the_{}'.format(s)))
    ax0.set_title(r'{} in state $S_{}$'.format(subfolder,s))
    ax0.set_ylim(-150,150)
    ax0.legend()

    ax1.plot(df['fs'],df['Max-phi_{}'.format(s)], label=('Max-phi_{}'.format(s)),ls='--')
    ax1.plot(df['fs'],df['Max-gam_{}'.format(s)], label=('Max-gam_{}'.format(s)),ls='--')
    ax1.plot(df['fs'],df['Max-the_{}'.format(s)], label=('Max-the_{}'.format(s)),ls='--')
    ax1.set_xlabel('fs')
    ax1.legend()
    
    fig.tight_layout();