# initialize the scattering class b = Brane(m,dx,wavelength=1.3e-3,nphi=(2**12,2**12),screen_res=6,r_inner=50) # points along the uv axes where to record the visibility u = np.linspace(0.,10e9,num=50) # generate a bunch of scattering instances tic = time.time() u_vis = [] v_vis = [] num_sims = 100 avg = np.zeros_like(b.isrc) for i in range(num_sims): # create a new instance of the random phases b.generatePhases() # calculate the scattered image b.scatter() # keep track of the average avg += b.iss # calculate the visibility function along the u and v axis. u_vis.append(np.array([utilities.FTElementFast(b.iss,b.dx,[u_,0]) for u_ in u])) v_vis.append(np.array([utilities.FTElementFast(b.iss,b.dx,[0,u_]) for u_ in u])) avg /= num_sims logger.info('took {0:g}s'.format(time.time()-tic)) # make figures write_figs = False fig_file = '../_static/ensemble_average/' extent=b.dx*b.nx//2*np.array([1,-1,-1,1]) ensemble = utilities.ensembleSmooth(b.isrc,b.dx,b)