from __future__ import division import numpy as np import matplotlib.pyplot as plt import ctypes import c2raytools as c2t # the data we want to analyse, a 3D array of floats uv = c2t.read_cbin('/home/gorgel/Documents/C2ray/dtbox_smth7.96.cbin') # the size of the data we want to analyse, a 1D array of three integers (same as the -x -y -z options) usizev = np.array([504, 504, 504]) # integer: number of bins to use (same as -b option) numbins = int(10) #float: lowest value of threshold (same as -l option) low = float(0) # float: highest values of threshold (same as -h option) high = float(10) output_array = np.zeros((3, numbins + 1, 5), dtype=np.float32) # vsumv - the output, a 3D array of floats. The size is (3,numbins+1,5) def mink(input_array, array_size, nr_bins, low, high, output_array): lib_file = '/home/gorgel/Dropbox/simon/plugg/masterarbete/minkowski_files/MINKOWSKI2_PY/testpython/Minkowski_python/minkowski_python.so' lib = ctypes.cdll.LoadLibrary(lib_file) func = lib.minkowski return func(ctypes.c_void_p(input_array.ctypes.data), ctypes.c_void_p(array_size.ctypes.data),\
out_beam_nufig = './figs/lc_b3nu44_244Mpc_f2_0_250.eps' out_all_beam_nufig = './figs/lc_b3nu44_244Mpc_all.eps' z_filename = '../1244Mpc_f2_8.2S_250_pyt/lc_pic_boxes/out0_z.dat' c2t.set_sim_constants(boxsize_cMpc = 244.) # Read in z file, set smoothing, and open output files z_arr = np.loadtxt(z_filename) nu = c2t.cosmology.z_to_nu(z_arr)[::-1] dnu = 0.44 beam = 3. mesh = 250 # Read in lightcones cbin1 = c2t.read_cbin(cbin1_file) cbin2 = c2t.read_cbin(cbin2_file) cbin3 = c2t.read_cbin(cbin3_file) cbin4 = c2t.read_cbin(cbin4_file) cb_ticks=[0,10,20,30,40,50,60,70] xtick_zlabels = np.arange(int(np.floor(z_arr.min())),int(np.ceil(z_arr.max())),2) xtick_zlocs = [] j = 0 for i in range(1,len(z_arr)): if j >= len(xtick_zlabels): break if (abs(xtick_zlabels[j] - z_arr[i-1]) > abs(xtick_zlabels[j] - z_arr[i])): continue else: xtick_zlocs.append(i-1) j += 1
beam = 3 dnu = 0.44 c2t.set_sim_constants(boxsize_cMpc = 244.) for i in range(1,len(z_arr)): output_filename = output_path+'%.3f.dat'%(z_arr[i]) out1_filename = out1_path+'%.3f.dat'%(z_arr[i]) out2_filename = out2_path+'%.3f.dat'%(z_arr[i]) out3_filename = out3_path+'%.3f.dat'%(z_arr[i]) print 'z = %.3f'% (z_arr[i]) dT_file = ''.join(glob.glob('./dT_boxes/dT_%.3f.cbin'%(z_arr[i]))) print 'dT file = %s' % dT_file dT_box = c2t.read_cbin(dT_file, bits=64, order='F') dT_rsd_file = ''.join(glob.glob('./dT_pv_boxes/dT_pv_%.3f.cbin'%(z_arr[i]))) print 'dT_pv file = %s' % dT_rsd_file dT_rsd_box = c2t.read_cbin(dT_rsd_file, bits=64, order='F') dTraw_mean = dT_box.mean() dTraw_rsd_mean = dT_rsd_box.mean() dTraw_var = np.mean(pow(dT_box-dTraw_mean,2)) dTraw_rsd_var = np.mean(pow(dT_rsd_box-dTraw_rsd_mean,2)) print 'Calculating coeval dT PDFs...' dTraw_hist, dTraw_bin_edges = np.histogram(dT_box,bins=100,density=True) dTraw_rsd_hist, dTraw_rsd_bin_edges = np.histogram(dT_rsd_box,bins=100,density=True)
from __future__ import division import numpy as np import matplotlib.pyplot as plt import ctypes import c2raytools as c2t # the data we want to analyse, a 3D array of floats uv = c2t.read_cbin('/home/gorgel/Documents/C2ray/dtbox_smth7.96.cbin') # the size of the data we want to analyse, a 1D array of three integers (same as the -x -y -z options) usizev = np.array([504,504,504]) # integer: number of bins to use (same as -b option) numbins = int(10) #float: lowest value of threshold (same as -l option) low = float(0) # float: highest values of threshold (same as -h option) high = float(10) output_array = np.zeros((3,numbins+1,5), dtype=np.float32) # vsumv - the output, a 3D array of floats. The size is (3,numbins+1,5) def mink(input_array, array_size, nr_bins, low, high, output_array): lib_file = '/home/gorgel/Dropbox/simon/plugg/masterarbete/minkowski_files/MINKOWSKI2_PY/testpython/Minkowski_python/minkowski_python.so' lib = ctypes.cdll.LoadLibrary(lib_file) func = lib.minkowski return func(ctypes.c_void_p(input_array.ctypes.data), ctypes.c_void_p(array_size.ctypes.data),\ ctypes.c_int(nr_bins), ctypes.c_float(low) , ctypes.c_float(high) ,ctypes.c_void_p(output_array.ctypes.data))