c-------------------------------------------------------------------- c Generates Random Galaxy positions. c c c Input: c iseed = random number seed (should be a negative integer) c zlimit = redshift at which to truncate the catalogue eg z=0.5 c selfile = name of file containing the tabulated selection function c eg om1:lam0:strc:a/sel1.2df_sgp c (or 00002df_sgp for a volume limited catalogue) c vlim = set .TRUE. if a volume limited cat is required c c vran = 1-dimensional random velocity dispersion in units c of km/s (set in parameter statement) c c Output: c x,y,z = Galaxy redshift space position c d = Galaxy redshift if on pure Hubble Flow. NB Will equal c sqrt(x^2+y^2+z^2) if vran = 0.0 km/s . c c Method: c subroutine ran_cat(x,y,z,d,iseed,zlimit,selfile,vlim) implicit none integer iseed,ifirst,lnblnk character selfile*(*), cat*4 real x,y,z,d,vx,vy,vz,zlimit,z_gal,z_hub,v_dot_rhat,vran,d2 parameter (vran=300.0) logical in,vlim real ran3,gasdev save ifirst,cat data ifirst/1/ c c On the first call read the specified selection function file c and identify whether it is "sdss" or 2dF "_sgp" or "_ngp" so c that the appropriate geometrical boudaries can be applied. if (ifirst.eq.1) then cat=selfile(lnblnk(selfile)-3:lnblnk(selfile)) write(*,*) 'cat=',cat,' selfile=',selfile if ((cat.ne.'sdss').and.(cat.ne.'_sgp').and. & (cat.ne.'_ngp').and.(cat.ne.'pscz') ) & stop 'Unrecognised selection function' call read_sel(selfile,zlimit,vlim) ifirst=0 end if c c c We now loop until we find a galaxy in the catalogue in=.FALSE. do while (.not.in) c Generate a random real-space position in a cubic box x = (ran3(iseed)-0.5)*2.0 y = (ran3(iseed)-0.5)*2.0 z = (ran3(iseed)-0.5)*2.0 d2= x**2 + y**2 + z**2 c Apply constraint to retain only an isotropic distribution if (d2.lt.1.0) then c Apply Geometric constraint of specific survey d=sqrt(d2) if (cat.eq.'sdss') then call geometry_sdss(in,x,y,z,d) else if (cat.eq.'_sgp') then call geometry_2df_sgp(in,x,y,z,d) else if (cat.eq.'_ngp') then call geometry_2df_ngp(in,x,y,z,d) else if (cat.eq.'pscz') then call geometry_pscz(in,x,y,z,d) end if if (in) then c Select a random velocity. if (vran.gt.0.0) then c Each component chosen from a Gaussian of c sigma=vran km/s vx=gasdev(iseed)*vran vy=gasdev(iseed)*vran vz=gasdev(iseed)*vran else vx=0.0 vy=0.0 vz=0.0 end if c Generate redshift randomly from the tabulated N(