Beispiel #1
0
            data = nlab.ArrayCatalog(data)

            print "stacked data"

            # Convert to MeshSource object, BoxSize in Mpc/h
            mesh = data.to_mesh(window='tsc',
                                Nmesh=Nmesh,
                                BoxSize=BoxSize,
                                compensated=True,
                                position='Position')
            print "converted data"

            # Get void correlation function from the simulation
            # Do the Fourier transform
            t = nlab.FFTCorr(mesh, mode='1d', Nmesh=Nmesh,
                             BoxSize=BoxSize)  #, dr = 9.0)

            gg = t.corr
            Xigg = gg['corr']
            Xir = gg['r']

            xi[w + str(realization)] = Xigg

            # Voids
            # Do correlation function
            os.chdir('/')

            #print(type(realization))
            #if not (os.path.exists('/tigress/isk/Documents/research/projects/COLA_runs/plot_data/'+cola+'z'+redshift+sim+'/Xivv_'+crazy+w+d+'_nbodykit_'+sim+realization+c+'_'+scale+binlab+'.dat')):

            if not os.path.exists(os.path.dirname(filewrite)):
                
                data = {}

                data['Position'] = da.from_array(np.column_stack((gadget_format[1], gadget_format[2], gadget_format[3])), chunks=(100,3))
                data['Velocity'] = da.from_array(np.column_stack((gadget_format[4], gadget_format[5], gadget_format[6])), chunks=(100,3)) #transform.StackColumns
                    
                data = nlab.ArrayCatalog(data)
                
                print "stacked data"

                # Convert to MeshSource object, BoxSize in Mpc/h
                mesh = data.to_mesh(window='tsc', Nmesh=Nmesh, BoxSize = BoxSize, compensated=True, position='Position')

                # Halos
                # Do correlation function
                t = nlab.FFTCorr(mesh, mode='1d', Nmesh=Nmesh, BoxSize = BoxSize, dr = 1.0)

                gg = t.corr
                Xigg = gg['corr']
                Xir = gg['r']

                if not os.path.exists(os.path.dirname(file4)):
                    os.makedirs(os.path.dirname(file4))
                f = open(file4, 'w+')
                f.write('# r Xi(r) Xi(r)-ShotNoise\n')
                f.write('# z = '+zlab +'\n')
                        
                datacc = np.array([gg['r'],gg['corr'].real,gg['corr'].real - gg.attrs['shotnoise']])
                datacc = datacc.T
                        
                np.savetxt(f, datacc)