def zeroVelocityMocks(): sigmastar2 = 250.0 ** 2 # -------------------- Read in 6dFGSv data ---------------------- Dz, xerr, x_arr, y_arr, z_arr, xobs, r_arr, ngal = readin6dFGSvData() # Calculate velocity uncertainties sigma_v from Eq. (10) of Scrimgeour et al. (2015) sigma_v = 0.324 * 100.0 * Dz # Calculate Dec (np array) Dec = getDec(x_arr, y_arr, z_arr) # Index of galaxies in Great Circle. inC = np.where(Dec > -20.0)[0] # ---------------------- Convert Dz to z ------------------------- zfile = "/Users/Morag/Cosmology_codes/redshift_OM0.3175.dat" zo = cc.z_x_arr(Dz, zfile) # -------- Assign each galaxy zero x, perturbed by xerr ---------- # Give all galaxies v=0 but perturb x by xerr # Generate array of num random deltax values with std dev = xerr[gal] BFArr = [] for i in xrange(100): print i x = xerr * np.random.standard_normal(ngal) ## Calibrate zeropoint to 0 # Mean x in Great Circle # meanx = np.mean(x[inC]) # Subtract this from all galaxies # x -= meanx # Calculate derived Dr Dr_der = Dz / 10 ** x # Calculate new derived redshifts zr_der = cc.z_x_arr(Dr_der, zfile) vp_rand = speedlight * ((zo - zr_der) / (1.0 + zr_der)) # ------------------------- Calculate BF --------------------------- # u = MLE_BF(x_arr, y_arr, z_arr, r_arr, vp_rand, sigma_v, sigmastar2) u = MV_BF_6dFGSv(vp_rand) BFArr.append((u[0], u[1], u[2])) print "" meanBF, stdBF = meanVector(BFArr) print "Mean spurious BF: (%d pm %d, %d pm %d, %d pm %d)" % ( meanBF[0], stdBF[0], meanBF[1], stdBF[1], meanBF[2], stdBF[2], ) return
def x_to_v(x, z_obs, Dz, zfile): Dr_der = Dz / 10.**x zr_der = cc.z_x_arr(Dr_der, zfile) v = speedlight * ((z_obs - zr_der)/(1.+zr_der)) return v