/* Calculate and output the galaxy-galaxy clustering signal 
 * in the user-defined stellar mass bins.
 */
void shmr_clustering()
{
  int i,j;
  double mlo, mhi, x1, x2, x3, x4, r, dr;
  FILE *fp;
  char fname[1000];

  if(COLOR)return shmr_color_clustering();

  wpl.reset_inversion = 1;
  for(i=1;i<=wpl.nsamples;++i)
    {
      sprintf(fname,"%s.clustering_bin%d",Task.root_filename,i);
      fp = fopen(fname,"w");
      // make a header:
      fprintf(fp,"# %e %e\n",wpl.mstar_wplo[0][i],wpl.mstar_wphi[0][i]);
      fflush(fp);
      mlo = pow(10.0,wpl.mstar_wplo[0][i]);
      mhi = pow(10.0,wpl.mstar_wphi[0][i]);
      set_up_hod_for_shmr(mlo,mhi,wpl.a);

      GALAXY_DENSITY = qromo(func_galaxy_density,log(HOD.M_low),log(HOD.M_max),midpnt);
      GALAXY_BIAS = qromo(func_galaxy_bias,log(HOD.M_low),log(HOD.M_max),midpnt)/GALAXY_DENSITY;
      fprintf(stdout,"%e %e\n",GALAXY_DENSITY,GALAXY_BIAS);
      RESET_FLAG_1H = RESET_FLAG_2H = 1;
      RESET_KAISER++;

      dr=(log(70.0)-log(0.01))/49.0;
      for(j=0;j<50;++j)
	{
	  r = exp(j*dr+log(0.01));
	  x1 = one_halo_real_space(r);
	  x2 = two_halo_real_space(r);
	  x3 = projected_xi(r);
	  x4 = projected_xi_1halo(r);
	  fprintf(fp,"%f %e %e %e %e %e\n",r,x1,x2,x1+x2,x3,x4);
	  fflush(fp);
	}
      fclose(fp);      
    }
}
Beispiel #2
0
void output_wp(char fname[])
{
  FILE *fp;
  double r,dr,x1,x2,x3,x4,x5;
  int j;

  fp=fopen(fname,"w");
  dr=(log(70.0)-log(0.05))/49.0;
  for(j=0;j<50;++j)
    {
      r=exp(j*dr+log(0.05));
      x1=one_halo_real_space(r);
      x2=two_halo_real_space(r);
      x3=projected_xi(r);
      //x4 = projected_xi1h(r);
      //x5 = projected_xi2h(r);
      fprintf(fp,"%f %e %e %e %e\n",r,x1,x2,x1+x2,x3);
      fflush(fp);
    }
  fclose(fp);
}
void shmr_color_clustering(void)
{  
  int i,j;
  double mlo, mhi, x1, x2, x3, x4, r, dr;
  FILE *fp;
  char fname[1000];

  BLUE_FLAG = 1;
  for(i=1;i<=wpl.nsamples;++i)
    {
      wpl.reset_inversion = 1;
      RESET_FLAG_1H = 1;
      RESET_FLAG_2H = 1;
      sprintf(fname,"%s.blue_clustering_bin%d",Task.root_filename,i);
      fp = fopen(fname,"w");
      // make a header:
      fprintf(fp,"# %e %e\n",wpl.mstar_wplo[0][i],wpl.mstar_wphi[0][i]);
      fflush(fp);
      mlo = pow(10.0,wpl.mstar_wplo[0][i]);
      mhi = pow(10.0,wpl.mstar_wphi[0][i]);
      set_up_hod_for_shmr(mlo,mhi,wpl.a);
      dr=(log(70.0)-log(0.01))/49.0;
      for(j=0;j<50;++j)
	{
	  r = exp(j*dr+log(0.01));
	  x1 = one_halo_real_space(r);
	  x2 = two_halo_real_space(r);
	  x3 = projected_xi(r);
	  x4 = 0;//projected_xi_1halo(r);
	  fprintf(fp,"%f %e %e %e %e %e\n",r,x1,x2,x1+x2,x3,x4);
	  fflush(fp);
	}
      fclose(fp);      
    }

  BLUE_FLAG = 0;
  for(i=1;i<=wpl.nsamples;++i)
    {
      wpl.reset_inversion = 1;
      RESET_FLAG_1H = 1;
      RESET_FLAG_2H = 1;
      sprintf(fname,"%s.red_clustering_bin%d",Task.root_filename,i);
      fp = fopen(fname,"w");
      // make a header:
      fprintf(fp,"# %e %e\n",wpl.mstar_wplo[0][i],wpl.mstar_wphi[0][i]);
      fflush(fp);
      mlo = pow(10.0,wpl.mstar_wplo[0][i]);
      mhi = pow(10.0,wpl.mstar_wphi[0][i]);
      set_up_hod_for_shmr(mlo,mhi,wpl.a);
      dr=(log(70.0)-log(0.01))/49.0;
      for(j=0;j<50;++j)
	{
	  r = exp(j*dr+log(0.01));
	  x1 = one_halo_real_space(r);
	  x2 = two_halo_real_space(r);
	  x3 = projected_xi(r);
	  x4 = projected_xi_1halo(r);
	  fprintf(fp,"%f %e %e %e %e %e\n",r,x1,x2,x1+x2,x3,x4);
	  fflush(fp);
	}
      fclose(fp);      
    }

  return;
}