DENSITIES PAPER


In [1]:
import quantumpropagator as qp
import numpy as np
import os
import glob
import h5py as h5

In [2]:
fol_wf =  '/home/alessio/Desktop/No-Kick/y-IR_140_nac0_0000' #'/home/alessio/x-last_Stuff/m-only_IR_middle140_0000'
wavefunctions_files = sorted(glob.glob(fol_wf + '/Gau*.h5'))

In [3]:
single_one = wavefunctions_files[-1]

In [5]:
def watch_wavefunction(single_one):
    h5_handler = h5.File(single_one,'r')
    wf2 = h5_handler['WF']
    time = h5_handler['Time'][0]
    #print (wf2.shape)
    return time, np.asarray(wf2[15:-15,15:-15,30:-30,:])

def count_nonzero_wf(wf2,threshold):
    wf = qp.abs2(wf2)
    new_file = np.where(wf > threshold,wf,0)
    return new_file

threshold = 0.0001


time, wf = watch_wavefunction(single_one)
pL, gL, tL, nstates = wf.shape


aaa = count_nonzero_wf(wf,threshold)

In [9]:
# %load_ext Cython

threshold = 0.00001

def give_me_stats(time, wf, threshold):
    new_one = qp.abs2(wf)
    
    calc = 0
    calculate_this = np.zeros((pL,gL,tL), dtype=bool)
    mod_sum = 0
    for p in range(pL):
        for g in range(gL):
            for t in range(tL):
                if np.sum(new_one[p,g,t]) > threshold:
                    mod_sum += np.sum(new_one[p,g,t])
                    calc += 1
                    calculate_this[p,g,t] = True
    norm = np.linalg.norm(wf)
    print('{:6.2f} {:5} {:5.2f} {:5.2f} {:5.2f}%'.format(time, calc, mod_sum, norm,mod_sum/norm*100))
#     return calculate_this, calc, mod_sum


for single_one in wavefunctions_files[::1]:
    t1,w1 = watch_wavefunction(single_one)
    give_me_stats(t1,w1,threshold)


  0.00  1479  1.00  1.00 99.66%
  1.25  1465  1.00  1.00 99.64%
  2.50  1475  1.00  1.00 99.64%
  3.75  1486  1.00  1.00 99.63%
  5.00  1477  1.00  1.00 99.61%
  6.25  1462  1.00  1.00 99.61%
  7.50  1455  1.00  1.00 99.62%
  8.75  1455  1.00  1.00 99.59%
 10.00  1479  0.99  1.00 99.57%
 11.25  1502  0.99  1.00 99.55%
 12.50  1505  0.99  1.00 99.52%
 13.75  1530  0.99  1.00 99.50%
 15.00  1591  0.99  1.00 99.46%
 16.25  1731  0.99  1.00 99.35%
 17.50  2006  0.99  1.00 99.13%
 18.75  2392  0.99  1.00 98.78%
 20.00  2973  0.98  1.00 98.32%
 21.25  3641  0.97  1.00 97.70%
 22.50  4162  0.96  0.99 96.97%
 23.75  4364  0.95  0.99 96.11%
 25.00  4598  0.94  0.99 95.31%
 26.25  4892  0.93  0.98 94.72%
 27.50  4962  0.92  0.98 94.22%
 28.75  5177  0.92  0.98 94.10%
 30.00  5352  0.92  0.98 94.01%
 31.25  5310  0.92  0.98 93.72%
 32.50  5282  0.91  0.97 93.48%
 33.75  5375  0.91  0.97 93.25%
 35.00  5585  0.90  0.97 93.00%
 36.25  5809  0.90  0.97 92.84%
 37.50  5833  0.90  0.97 92.60%
 38.75  5689  0.90  0.97 92.45%
 40.00  5586  0.90  0.97 92.42%
 41.25  5623  0.90  0.97 92.61%
 42.50  5812  0.90  0.97 92.91%
 43.75  5973  0.90  0.97 92.95%
 45.00  6345  0.90  0.97 92.91%
 46.25  6647  0.90  0.97 92.73%
 47.50  6872  0.90  0.97 92.50%
 48.75  7050  0.90  0.97 92.22%
 50.00  7075  0.89  0.97 91.98%
 51.25  7098  0.89  0.97 91.82%
 52.50  7112  0.89  0.97 91.76%
 53.75  7211  0.89  0.97 91.82%
 55.00  7103  0.88  0.96 91.70%
 56.25  7123  0.88  0.96 91.70%
 57.50  7142  0.88  0.96 91.65%
 58.75  7200  0.88  0.96 91.61%
 60.00  7135  0.88  0.96 91.38%
 61.25  7246  0.88  0.96 91.31%
 62.50  7302  0.87  0.96 91.10%
 63.75  7451  0.87  0.96 91.02%
 65.00  7522  0.87  0.96 90.99%
 66.25  7746  0.87  0.96 91.16%
 67.50  8014  0.88  0.96 91.33%
 68.75  8371  0.88  0.96 91.51%
 70.00  8692  0.88  0.96 91.56%
 71.25  8787  0.88  0.96 91.47%
 72.50  8832  0.88  0.96 91.31%
 73.75  8787  0.88  0.96 91.18%
 75.00  8679  0.88  0.96 91.07%
 76.25  8553  0.88  0.96 91.02%
 77.50  8310  0.88  0.96 90.88%
 78.75  8386  0.88  0.96 90.93%
 80.00  8503  0.88  0.96 90.96%
 81.25  8599  0.88  0.96 90.97%
 82.50  8624  0.88  0.96 91.00%
 83.75  8242  0.87  0.96 90.78%
 85.00  7870  0.87  0.96 90.66%
 86.25  7532  0.87  0.96 90.48%
 87.50  7182  0.87  0.96 90.28%
 88.75  6955  0.87  0.96 90.19%
 90.00  6877  0.87  0.96 90.19%
 91.25  6971  0.87  0.96 90.28%
 92.50  6964  0.87  0.96 90.25%
 93.75  7062  0.87  0.96 90.30%
 95.00  7072  0.87  0.96 90.33%
 96.25  7033  0.87  0.96 90.33%
 97.50  7086  0.87  0.96 90.44%
 98.75  7046  0.87  0.96 90.44%
100.00  7085  0.87  0.96 90.51%
101.25  6977  0.87  0.96 90.46%
102.50  6958  0.87  0.96 90.49%
103.75  6863  0.87  0.96 90.49%
105.00  6849  0.87  0.96 90.53%
106.25  6815  0.87  0.96 90.43%
107.50  6711  0.86  0.96 90.30%
108.75  6473  0.86  0.95 90.11%
110.00  6388  0.86  0.95 90.04%
111.25  6410  0.86  0.95 90.06%
112.50  6369  0.86  0.95 89.99%
113.75  6321  0.86  0.95 89.90%
115.00  6204  0.85  0.95 89.74%
116.25  6261  0.86  0.95 89.77%
117.50  6287  0.86  0.95 89.79%
118.75  6393  0.86  0.95 89.87%
120.00  6558  0.86  0.96 89.97%
121.25  6704  0.86  0.96 89.99%
122.50  6942  0.86  0.96 90.12%
123.75  7152  0.86  0.96 90.21%
125.00  7221  0.86  0.96 90.20%
126.25  7343  0.86  0.96 90.19%
127.50  7415  0.86  0.96 90.08%
128.75  7550  0.86  0.96 90.05%
130.00  7566  0.86  0.96 89.95%
131.25  7666  0.86  0.96 89.89%
132.50  7697  0.86  0.96 89.70%
133.75  7839  0.86  0.96 89.72%
135.00  7929  0.86  0.96 89.64%
136.25  8069  0.86  0.96 89.65%
137.50  8138  0.86  0.96 89.59%
138.75  8282  0.86  0.96 89.65%
140.00  8307  0.86  0.96 89.65%
141.25  8267  0.86  0.96 89.60%
142.50  8138  0.85  0.96 89.46%
143.75  8338  0.86  0.95 89.59%
145.00  8528  0.86  0.95 89.68%
146.25  8542  0.85  0.95 89.63%
147.50  8443  0.85  0.95 89.44%
148.75  8378  0.85  0.95 89.30%
150.00  8223  0.85  0.95 89.16%
151.25  8068  0.84  0.95 89.03%
152.50  7979  0.84  0.95 88.88%
153.75  7965  0.84  0.95 88.78%
155.00  8024  0.84  0.95 88.72%
156.25  8178  0.84  0.95 88.76%
157.50  8193  0.84  0.95 88.70%
158.75  8340  0.84  0.95 88.77%
160.00  8479  0.84  0.95 88.84%
161.25  8560  0.84  0.95 88.90%
162.50  8583  0.84  0.95 88.90%
163.75  8784  0.85  0.95 89.01%
165.00  8869  0.85  0.95 89.00%
166.25  8881  0.85  0.95 88.96%
167.50  8829  0.85  0.95 88.90%
168.75  8938  0.85  0.95 89.01%
170.00  8998  0.85  0.95 89.01%
171.25  9071  0.85  0.95 88.91%
172.50  9065  0.85  0.95 88.87%
173.75  8848  0.85  0.95 88.77%
175.00  8714  0.85  0.95 88.78%
176.25  8703  0.85  0.95 88.84%
177.50  8612  0.85  0.95 88.87%
178.75  8461  0.85  0.95 88.84%
180.00  8197  0.85  0.95 88.64%
181.25  8111  0.85  0.95 88.62%
182.50  8102  0.85  0.95 88.64%
183.75  8013  0.85  0.95 88.65%
185.00  8031  0.85  0.95 88.78%
186.25  7854  0.85  0.95 88.68%
187.50  7748  0.85  0.95 88.60%
188.75  7669  0.84  0.95 88.55%
190.00  7619  0.84  0.95 88.51%
191.25  7587  0.84  0.95 88.50%
192.50  7525  0.84  0.95 88.44%
193.75  7402  0.84  0.95 88.35%
195.00  7370  0.84  0.95 88.38%
196.25  7363  0.84  0.95 88.46%

In [ ]: