Esempio n. 1
0
Catalog mk_random_cat(int np)
{
  //////
  // Returns random catalog with np particles
  // (with normalized radii for angular corr)
  int ir;
  Catalog cat;

  print_info("*** Creating random catalog ");
#ifdef _VERBOSE
  print_info("with %d objects",np);
#endif
  print_info("\n");

  //Allocate memory for catalog
  cat.np=np;
  cat.red=(double *)my_malloc(cat.np*sizeof(double));
  cat.cth=(double *)my_malloc(cat.np*sizeof(double));
  cat.phi=(double *)my_malloc(cat.np*sizeof(double));
#ifdef _WITH_WEIGHTS
  cat.weight=(double *)my_malloc(cat.np*sizeof(double));
#endif //_WITH_WEIGHTS

  //Generate positions
  ir=0;
  while(ir<np) {
    double cth,phi,zz;

    if(corr_type!=1)
      zz=rand_dndz_dist();
    else
      zz=0.5*(red_max_mask+red_min_mask);
    cth=cth_min_mask+(cth_max_mask-cth_min_mask)*rand01();
    phi=phi_min_mask+(phi_max_mask-phi_min_mask)*rand01();

    if(in_mask(zz,cth,phi)) {
      cat.red[ir]=zz;
      cat.cth[ir]=cth;
      cat.phi[ir]=phi;
#ifdef _WITH_WEIGHTS
      cat.weight[ir]=1.;
#endif //_WITH_WEIGHTS
      ir++;
    }
  }

  return cat;
}
Esempio n. 2
0
Catalog_f mk_random_cat_f(int np)
{
  //////
  // Returns random catalog with np particles
  // (with normalized radii for angular corr)
  int ir;
  Catalog_f cat;

  print_info("*** Creating random catalog ");
#ifdef _VERBOSE
  print_info("with %d objects",np);
#endif
  print_info("\n");

  //Allocate memory for catalog
  cat.np=np;
  cat.pos=(float *)my_malloc(3*cat.np*sizeof(float));

  //Generate positions
  ir=0;
  while(ir<np) {
    double cth,phi,zz;

    if(corr_type!=1)
      zz=rand_dndz_dist();
    else
      zz=0.5*(red_max_mask+red_min_mask);
    cth=cth_min_mask+(cth_max_mask-cth_min_mask)*rand01();
    phi=phi_min_mask+(phi_max_mask-phi_min_mask)*rand01();

    if(in_mask(zz,cth,phi)) {
      double sth=sqrt(1-cth*cth);
      double rr;
      if(corr_type!=1) rr=z2r(zz);
      else rr=1;
      cat.pos[3*ir]=(float)(rr*sth*cos(phi));
      cat.pos[3*ir+1]=(float)(rr*sth*sin(phi));
      cat.pos[3*ir+2]=(float)(rr*cth);
      ir++;
    }
  }

  return cat;
}
Esempio n. 3
0
  IMGFOR(src_seg,x,y)
    {
      if (in_mask(x,y))
	{
	  in_quality++;
	  NetInt32 addr = cluster1(x,y);
	  ColorMap::iterator it = color_map.find(addr);
	  
	  if (it == color_map.end())
	    {
	      color_map[addr] = 0;
	      color_map2[addr] = 0;
	      it = color_map.find(addr);
	    }
	  (*it).second++;
	  if (!mask_small(x,y))
	    {
	      ref_ct++;
	      color_map2[addr]++;
	    }
	}
    }