In [1]:
%load_ext autoreload
%matplotlib inline
execfile ("_ImportScript.py")
import time


1

In [2]:
import matplotlib.pyplot as plt

In [3]:
beatbox.You.create_original_Universe()

In [4]:
numreal = 100

for i in range(numreal):
    beatbox.You.initiate_simulated_universe(truncated_nmax = 15)


Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
Generated  14146  potential Fourier coefficients
 with phases uniformly distributed between 0 and  6.28318530718
/Users/LaurencePeanuts/Documents/Travail/Stanford/Music/Music/beatbox/universe.py:597: RuntimeWarning: divide by zero encountered in power
  self.Power_Spectrum = self.PSnorm*10000*np.power((self.k/self.kstar) ,(-3+(self.n_s-1)))

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [5]:
if not os.path.isfile('../data/covCyy_lmax%d_lmin%d.txt' % (beatbox.Multiverse.truncated_lmax, beatbox.Multiverse.truncated_lmin)):
    beatbox.You.read_Planck_samples()
    beatbox.You.calculate_covariance_matrix(filename='lmax%d_lmin%d' % (beatbox.Multiverse.truncated_lmax, beatbox.Multiverse.truncated_lmin))
else:
    beatbox.You.load_covariance_matrix(filename='covCyy_lmax%d_lmin%d.txt' % (beatbox.Multiverse.truncated_lmax, beatbox.Multiverse.truncated_lmin))
    
# Calculate the inverse of the a_y covariance matrix
beatbox.You.calculate_sdv_Cyy_inverse()


datamap = beatbox.You.all_simulated_universes[0].ay2ayreal_for_inference(beatbox.You.all_simulated_universes[0].ay)+beatbox.You.generate_one_realization_of_noise()
beatbox.You.all_simulated_universes[-1].ay_real = datamap
 

MOCK = 1
beatbox.You.solve_for_3D_potential(datamap.T , A=None, print_alpha=0)


0.00450801849365
total time is:
0.501989126205
/Users/LaurencePeanuts/Documents/Travail/Stanford/Music/Music/beatbox/universe.py:431: ComplexWarning: Casting complex values to real discards the imaginary part
  ay_real[zero_ind] = value[zero_ind].astype(np.float)
/Users/LaurencePeanuts/Documents/Travail/Stanford/Music/Music/beatbox/multiverse.py:494: ComplexWarning: Casting complex values to real discards the imaginary part
  R_real[zero_ind,:] = beatbox.Universe.R[zero_ind,:].astype(np.float)
/Users/LaurencePeanuts/Documents/Travail/Stanford/Music/Music/beatbox/multiverse.py:440: RuntimeWarning: divide by zero encountered in power
  Power_Spectrum = PSnorm*10000*np.power((beatbox.Universe.k/kstar) ,(-3+(n_s-1)))

In [6]:
cov_frac = np.zeros((numreal,1))

for i in range(numreal):
    print i
    noise_realization = beatbox.You.generate_one_realization_of_noise()
    true_alms = beatbox.You.all_simulated_universes[i].ay2ayreal_for_inference(beatbox.You.all_simulated_universes[i].ay)
    datamap =  true_alms + noise_realization
    beatbox.You.solve_for_3D_potential(datamap.T , A=1, print_alpha=0)
    
    We=beatbox.Universe()        
    beatbox.You.all_data_universes = np.append(beatbox.You.all_data_universes,We)
    beatbox.You.all_data_universes[i].fn = beatbox.You.reconstrunct_fn

    if i == 0:
            ordered_inds_largenmax = beatbox.You.all_simulated_universes[i].get_ordered_fn_indices()
            ordered_inds_smallnmax = beatbox.You.all_data_universes[i].get_ordered_fn_indices()
    min_n_mode = np.min((len(ordered_inds_largenmax), len(ordered_inds_smallnmax) )    )
    
    true_fns = beatbox.You.all_simulated_universes[i].fn[ordered_inds_largenmax[:min_n_mode]].reshape(-1,1)
    rec_fns = beatbox.You.all_data_universes[i].fn[ordered_inds_smallnmax[:min_n_mode]].reshape(-1,1)
    abs_diff = np.abs(true_fns - rec_fns)
    err_sig = np.sqrt(np.diag(beatbox.You.inv_A)[ordered_inds_smallnmax[:min_n_mode]])
    diff_sigma = np.divide(abs_diff.reshape(-1,1) , err_sig.reshape(-1,1) ).reshape(-1,1)
    cov_frac[i,0] = np.double(np.sum(diff_sigma<=1)) / np.double(len(diff_sigma))
#     np.savetxt( "/Users/yashar/GravIT/Cycle_4_analysis/data/noise_" + str("%0.03d" % i) + ".txt", noise_realization)
#     np.savetxt( "/Users/yashar/GravIT/Cycle_4_analysis/data/true_alm_" + str("%0.03d" % i) + ".txt", true_alms)
#     np.savetxt( "/Users/yashar/GravIT/Cycle_4_analysis/data/true_fn_" + str("%0.03d" % i) + ".txt", true_fns )
#     np.savetxt( "/Users/yashar/GravIT/Cycle_4_analysis/data/rec_fn_" + str("%0.03d" % i) + ".txt", rec_fns )
#     np.savetxt( "/Users/yashar/GravIT/Cycle_4_analysis/data/abs_diff_" + str("%0.03d" % i) + ".txt", abs_diff)
print diff_sigma


0
0.00121903419495
time for loading is:
0.00899410247803
successfully loaded A from the disk.
total time is:
0.0114290714264
1
0.00074291229248
time for loading is:
0.0117909908295
successfully loaded A from the disk.
total time is:
0.0139038562775
2
0.000432014465332
time for loading is:
0.0079779624939
successfully loaded A from the disk.
total time is:
0.00980114936829
3
0.000570058822632
time for loading is:
0.00870513916016
successfully loaded A from the disk.
total time is:
0.0132119655609
4
0.000956058502197
time for loading is:
0.00916385650635
successfully loaded A from the disk.
total time is:
0.0133271217346
5
0.000617980957031
time for loading is:
0.00827217102051
successfully loaded A from the disk.
total time is:
0.0100860595703
6
0.000658988952637
time for loading is:
0.0108699798584
successfully loaded A from the disk.
total time is:
0.0129950046539
7
0.000433921813965
time for loading is:
0.00714993476868
successfully loaded A from the disk.
total time is:
0.00916910171509
8
0.00049901008606
time for loading is:
0.00872182846069
successfully loaded A from the disk.
total time is:
0.0106999874115
9
0.0022988319397
time for loading is:
0.0152480602264
successfully loaded A from the disk.
total time is:
0.0220859050751
10
0.000760078430176
time for loading is:
0.00911903381348
successfully loaded A from the disk.
total time is:
0.0112850666046
11
0.000632047653198
time for loading is:
0.00796699523926
successfully loaded A from the disk.
total time is:
0.0105319023132
12
0.000572919845581
time for loading is:
0.00730681419373
successfully loaded A from the disk.
total time is:
0.008957862854
13
0.000536918640137
time for loading is:
0.0110869407654
successfully loaded A from the disk.
total time is:
0.0128619670868
14
0.000457048416138
time for loading is:
0.00711798667908
successfully loaded A from the disk.
total time is:
0.00910782814026
15
0.000433921813965
time for loading is:
0.00740504264832
successfully loaded A from the disk.
total time is:
0.00973081588745
16
0.000708818435669
time for loading is:
0.00831890106201
successfully loaded A from the disk.
total time is:
0.0126039981842
17
0.000442981719971
time for loading is:
0.0109188556671
successfully loaded A from the disk.
total time is:
0.0128269195557
18
0.000673055648804
time for loading is:
0.00784993171692
successfully loaded A from the disk.
total time is:
0.00985789299011
19
0.000436067581177
time for loading is:
0.00758981704712
successfully loaded A from the disk.
total time is:
0.00970911979675
20
0.000441074371338
time for loading is:
0.00892901420593
successfully loaded A from the disk.
total time is:
0.01265001297
21
0.000442981719971
time for loading is:
0.0105979442596
successfully loaded A from the disk.
total time is:
0.0126099586487
22
0.000501871109009
time for loading is:
0.00755095481873
successfully loaded A from the disk.
total time is:
0.0092248916626
23
0.000433921813965
time for loading is:
0.00724697113037
successfully loaded A from the disk.
total time is:
0.00874495506287
24
0.000433921813965
time for loading is:
0.00846600532532
successfully loaded A from the disk.
total time is:
0.0104329586029
25
0.000783920288086
time for loading is:
0.0111358165741
successfully loaded A from the disk.
total time is:
0.0138750076294
26
0.000445127487183
time for loading is:
0.0074200630188
successfully loaded A from the disk.
total time is:
0.00894117355347
27
0.000445127487183
time for loading is:
0.00721001625061
successfully loaded A from the disk.
total time is:
0.00891518592834
28
0.000457048416138
time for loading is:
0.00705790519714
successfully loaded A from the disk.
total time is:
0.0094940662384
29
0.000699043273926
time for loading is:
0.01340508461
successfully loaded A from the disk.
total time is:
0.0165920257568
30
0.000445127487183
time for loading is:
0.0073390007019
successfully loaded A from the disk.
total time is:
0.00921297073364
31
0.000754117965698
time for loading is:
0.00937986373901
successfully loaded A from the disk.
total time is:
0.0113770961761
32
0.000452995300293
time for loading is:
0.00726795196533
successfully loaded A from the disk.
total time is:
0.00965905189514
33
0.000592231750488
time for loading is:
0.00881099700928
successfully loaded A from the disk.
total time is:
0.0120661258698
34
0.000701904296875
time for loading is:
0.00782990455627
successfully loaded A from the disk.
total time is:
0.0097029209137
35
0.000481128692627
time for loading is:
0.0104441642761
successfully loaded A from the disk.
total time is:
0.012011051178
36
0.00075888633728
time for loading is:
0.00814700126648
successfully loaded A from the disk.
total time is:
0.0109479427338
37
0.000653982162476
time for loading is:
0.00841498374939
successfully loaded A from the disk.
total time is:
0.0117061138153
38
0.000440835952759
time for loading is:
0.00719714164734
successfully loaded A from the disk.
total time is:
0.0090868473053
39
0.00142693519592
time for loading is:
0.0103318691254
successfully loaded A from the disk.
total time is:
0.0128910541534
40
0.000434875488281
time for loading is:
0.00874805450439
successfully loaded A from the disk.
total time is:
0.0102579593658
41
0.00073504447937
time for loading is:
0.00903105735779
successfully loaded A from the disk.
total time is:
0.0137639045715
42
0.000848054885864
time for loading is:
0.00905990600586
successfully loaded A from the disk.
total time is:
0.0112240314484
43
0.00126004219055
time for loading is:
0.00939893722534
successfully loaded A from the disk.
total time is:
0.0122380256653
44
0.000730991363525
time for loading is:
0.00952291488647
successfully loaded A from the disk.
total time is:
0.0120029449463
45
0.000679016113281
time for loading is:
0.0197670459747
successfully loaded A from the disk.
total time is:
0.0245981216431
46
0.000680923461914
time for loading is:
0.00864791870117
successfully loaded A from the disk.
total time is:
0.0109558105469
47
0.000786066055298
time for loading is:
0.00885200500488
successfully loaded A from the disk.
total time is:
0.0116021633148
48
0.000473976135254
time for loading is:
0.0136098861694
successfully loaded A from the disk.
total time is:
0.0154500007629
49
0.00198984146118
time for loading is:
0.00854396820068
successfully loaded A from the disk.
total time is:
0.0116109848022
50
0.000433206558228
time for loading is:
0.0103888511658
successfully loaded A from the disk.
total time is:
0.0142331123352
51
0.000590085983276
time for loading is:
0.0134179592133
successfully loaded A from the disk.
total time is:
0.0158879756927
52
0.000839948654175
time for loading is:
0.0168998241425
successfully loaded A from the disk.
total time is:
0.0197010040283
53
0.000658988952637
time for loading is:
0.00992107391357
successfully loaded A from the disk.
total time is:
0.0116829872131
54
0.000602006912231
time for loading is:
0.00725984573364
successfully loaded A from the disk.
total time is:
0.00896286964417
55
0.000442028045654
time for loading is:
0.00712490081787
successfully loaded A from the disk.
total time is:
0.00940299034119
56
0.000692844390869
time for loading is:
0.00853991508484
successfully loaded A from the disk.
total time is:
0.0104088783264
57
0.00162386894226
time for loading is:
0.0198628902435
successfully loaded A from the disk.
total time is:
0.0276188850403
58
0.00091814994812
time for loading is:
0.00930595397949
successfully loaded A from the disk.
total time is:
0.0121891498566
59
0.000463008880615
time for loading is:
0.00829887390137
successfully loaded A from the disk.
total time is:
0.0103788375854
60
0.000677108764648
time for loading is:
0.00973391532898
successfully loaded A from the disk.
total time is:
0.0117061138153
61
0.00137996673584
time for loading is:
0.0108280181885
successfully loaded A from the disk.
total time is:
0.0136618614197
62
0.000436782836914
time for loading is:
0.0107028484344
successfully loaded A from the disk.
total time is:
0.0131509304047
63
0.000632047653198
time for loading is:
0.00767207145691
successfully loaded A from the disk.
total time is:
0.0103571414948
64
0.000709056854248
time for loading is:
0.0130498409271
successfully loaded A from the disk.
total time is:
0.0152208805084
65
0.000434875488281
time for loading is:
0.00700402259827
successfully loaded A from the disk.
total time is:
0.00851702690125
66
0.00044584274292
time for loading is:
0.00733304023743
successfully loaded A from the disk.
total time is:
0.00886201858521
67
0.00043511390686
time for loading is:
0.00793290138245
successfully loaded A from the disk.
total time is:
0.0101871490479
68
0.000443935394287
time for loading is:
0.00701093673706
successfully loaded A from the disk.
total time is:
0.00852394104004
69
0.000453948974609
time for loading is:
0.00698900222778
successfully loaded A from the disk.
total time is:
0.00851893424988
70
0.00043511390686
time for loading is:
0.0069420337677
successfully loaded A from the disk.
total time is:
0.00861120223999
71
0.000434875488281
time for loading is:
0.00696396827698
successfully loaded A from the disk.
total time is:
0.00874781608582
72
0.000534057617188
time for loading is:
0.00746917724609
successfully loaded A from the disk.
total time is:
0.00944495201111
73
0.00048303604126
time for loading is:
0.00722193717957
successfully loaded A from the disk.
total time is:
0.0103249549866
74
0.000710964202881
time for loading is:
0.00737714767456
successfully loaded A from the disk.
total time is:
0.00945591926575
75
0.000434875488281
time for loading is:
0.0102958679199
successfully loaded A from the disk.
total time is:
0.0124340057373
76
0.000691890716553
time for loading is:
0.00800085067749
successfully loaded A from the disk.
total time is:
0.01025390625
77
0.000619173049927
time for loading is:
0.00812816619873
successfully loaded A from the disk.
total time is:
0.00983119010925
78
0.000473022460938
time for loading is:
0.00743103027344
successfully loaded A from the disk.
total time is:
0.00919413566589
79
0.000433921813965
time for loading is:
0.00693202018738
successfully loaded A from the disk.
total time is:
0.00854897499084
80
0.000509023666382
time for loading is:
0.00713801383972
successfully loaded A from the disk.
total time is:
0.00883913040161
81
0.000499963760376
time for loading is:
0.0073869228363
successfully loaded A from the disk.
total time is:
0.00946998596191
82
0.000652074813843
time for loading is:
0.00746893882751
successfully loaded A from the disk.
total time is:
0.00922799110413
83
0.000435829162598
time for loading is:
0.00694417953491
successfully loaded A from the disk.
total time is:
0.00844883918762
84
0.000612020492554
time for loading is:
0.00881600379944
successfully loaded A from the disk.
total time is:
0.0107839107513
85
0.000434875488281
time for loading is:
0.00701713562012
successfully loaded A from the disk.
total time is:
0.00878882408142
86
0.000433921813965
time for loading is:
0.00838804244995
successfully loaded A from the disk.
total time is:
0.0112669467926
87
0.00066089630127
time for loading is:
0.00985217094421
successfully loaded A from the disk.
total time is:
0.0123288631439
88
0.000694036483765
time for loading is:
0.0158879756927
successfully loaded A from the disk.
total time is:
0.0183720588684
89
0.000728845596313
time for loading is:
0.0137441158295
successfully loaded A from the disk.
total time is:
0.0162889957428
90
0.000681161880493
time for loading is:
0.00801396369934
successfully loaded A from the disk.
total time is:
0.00980019569397
91
0.00118494033813
time for loading is:
0.00728917121887
successfully loaded A from the disk.
total time is:
0.00985598564148
92
0.00043511390686
time for loading is:
0.00693297386169
successfully loaded A from the disk.
total time is:
0.00844502449036
93
0.000485181808472
time for loading is:
0.00732421875
successfully loaded A from the disk.
total time is:
0.00913715362549
94
0.000437021255493
time for loading is:
0.00781607627869
successfully loaded A from the disk.
total time is:
0.00993895530701
95
0.000462055206299
time for loading is:
0.00695109367371
successfully loaded A from the disk.
total time is:
0.0085289478302
96
0.000473976135254
time for loading is:
0.00735902786255
successfully loaded A from the disk.
total time is:
0.0091700553894
97
0.00121998786926
time for loading is:
0.00822496414185
successfully loaded A from the disk.
total time is:
0.0107789039612
98
0.000671863555908
time for loading is:
0.0079448223114
successfully loaded A from the disk.
total time is:
0.0106430053711
99
0.00043797492981
time for loading is:
0.00757503509521
successfully loaded A from the disk.
total time is:
0.0090639591217
[[ 1.0842427 ]
 [ 0.57711494]
 [ 0.32279163]
 ..., 
 [ 1.15148313]
 [ 1.08470148]
 [ 0.17951135]]

In [7]:
print cov_frac.shape
np.mean(cov_frac)
# print cov_frac


(100, 1)
Out[7]:
0.67133286318758822

In [8]:
execfile ("_CalcEvidence.py")


/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/numpy/linalg/linalg.py:1821: RuntimeWarning: overflow encountered in det
  r = _umath_linalg.det(a, signature=signature)
/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/ipykernel/__main__.py:7: RuntimeWarning: invalid value encountered in double_scalars
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-8-7d4111f24f8d> in <module>()
----> 1 execfile ("_CalcEvidence.py")

/Users/LaurencePeanuts/Documents/Travail/Stanford/Music/Music/Scripts/_CalcEvidence.py in <module>()
     15 
     16 
---> 17 n, bins, patches = plt.hist(EvidenceVector, np.logspace(-50, 1, 40), normed=0, facecolor='green', alpha=0.75)
     18 
     19 plt.rc('text', usetex=True)

/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, hold, data, **kwargs)
   3080                       histtype=histtype, align=align, orientation=orientation,
   3081                       rwidth=rwidth, log=log, color=color, label=label,
-> 3082                       stacked=stacked, data=data, **kwargs)
   3083     finally:
   3084         ax._hold = washold

/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
   1890                     warnings.warn(msg % (label_namer, func.__name__),
   1891                                   RuntimeWarning, stacklevel=2)
-> 1892             return func(ax, *args, **kwargs)
   1893         pre_doc = inner.__doc__
   1894         if pre_doc is None:

/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
   6190             # this will automatically overwrite bins,
   6191             # so that each histogram uses the same bins
-> 6192             m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
   6193             m = m.astype(float)  # causes problems later if it's an int
   6194             if mlast is None:

/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/numpy/lib/function_base.pyc in histogram(a, bins, range, normed, weights, density)
    667     if not np.all(np.isfinite([mn, mx])):
    668         raise ValueError(
--> 669             'range parameter must be finite.')
    670     if mn == mx:
    671         mn -= 0.5

ValueError: range parameter must be finite.

In [8]:
print EvidenceVector


[  7.68702275e-29   1.74222680e-25   6.50096113e-26   4.00846299e-27
   7.53989744e-27   1.20827294e-30   2.37000323e-28   1.10191646e-27
   2.60390975e-26   1.02977057e-26]

In [10]:
execfile ("_CalcEvidence.py")


-26.6414095015
3.44125872023e-26

In [7]:
execfile ("_CalcEvidence.py")


-40.0062567343
1.60083551651e-39

In [8]:
execfile ("_CalcEvidence.py")


-39.9328732344
2.57623356758e-39

In [7]:
execfile ("_CalcEvidence.py")


-40.7589982474
5.07877441395e-39

In [7]:
execfile ("_CalcEvidence.py")


-inf
3.00235364048e-175
/Users/LaurencePeanuts/miniconda2/lib/python2.7/site-packages/ipykernel/__main__.py:47: RuntimeWarning: divide by zero encountered in log10

In [8]:
5.07877441395e-39/1.3273048694e-39


Out[8]:
3.8263812113081666

In [ ]:
np.save( "/Users/LaurencePeanuts/Dropbox/KleineBar_KlaineTiger/MUSIC/2018/C_yy_lmax7.npy", beatbox.You.C_yy)
np.save( "/Users/LaurencePeanuts/Dropbox/KleineBar_KlaineTiger/MUSIC/2018/R_lmax7_nmax15.npy", beatbox.You.R_real)

In [ ]:
np.unique(beatbox.You.all_data_universes[0].kfilter)

In [ ]:


In [ ]:
# Check calculated k covariance from samples, against prior covariance matrix
numCp = np.zeros(len(beatbox.You.all_simulated_universes[0].fn))
for j in range(len(beatbox.You.all_simulated_universes[0].fn)):
    fns = [beatbox.You.all_simulated_universes[i].fn[j] for i in range(numreal)]
    numCp[j] = np.std(fns) #1./(np.std(fns)**2)

plt.plot(numCp)
plt.plot(1/np.sqrt(np.diag(beatbox.You.inv_Cf)),'--')

In [ ]:
plt.plot(beatbox.You.all_simulated_universes[0].fn[ordered_inds_largenmax],' +')
err_sig = np.sqrt(np.diag(beatbox.You.inv_A)[ordered_inds_smallnmax])
eb2 = plt.errorbar(np.arange(0,len(beatbox.You.all_data_universes[0].fn)).reshape(-1,1) , beatbox.You.all_data_universes[0].fn[ordered_inds_smallnmax].reshape(-1,1) , yerr = err_sig.reshape(-1,1),ls=' ')
plt.axis([1 ,34, -20, 20])

In [ ]:
# test that the noise covariance matrix is correct
datamap = np.zeros((numreal,24))

for i in range(numreal):
    datamap[i,:] = beatbox.You.generate_one_realization_of_noise()

In [ ]:
datamap.shape

In [ ]:
plt.subplot(1,2,1)
plt.imshow(np.cov(datamap.T))
plt.colorbar()

plt.subplot(1,2,2)
plt.imshow(np.linalg.inv(beatbox.You.inv_Cyy))
plt.colorbar()

In [ ]:


In [13]:
print 10**-102.045412774


9.00714648877e-103

In [ ]: