Example #1
0
digits = len(sys.argv[1])

i = 0
name = ""
while i < (4 - digits):
    name += "0"

name += sys.argv[1]

# glob the raw mock files
mock_rdzs = glob("dat/mocks/ngc/*{0}*.rdz".format(name))

for i in range(len(mock_rdzs)):

    mock_rdz = mock_rdzs[i]

    # get the mock number
    name = mock_rdz.split(".")[1].split("_")[-1]

    # get the location to put the hdf5 of the mock
    mock_hier_fn = "dat/out/{0}/mocks_hierarchical/{1}.hdf5".format(survey_cap, name)

    mk_h5(mock_rdz, mock_hier_fn, "radecz", mode='w')

    # the location for the transformed coordinates of the mock galaxies
    cart_coords_fn = "dat/out/{0}/{1}/mocks/cart_coords/ascii/{2}.dat".format(survey_cap, cosmo, name)

    mk_mock_coords(mock_hier_fn, cart_coords_fn, cosmo)

        #    mock_vpf(cart_coords_fn, spheresfile, cosmo)
Example #2
0
# CMASS
# - NGC

sdss_dir = "./dat/in/sdss3"
CMASS_dir = "./dat/in/CMASS_DATA"

out_dir = "./dat/out/CMASS/NGC"
if not os.path.exists(out_dir):
    os.makedirs(out_dir)

# Get RA, Dec, and redshifts from the fits file into a HDF5 file
fits2h5("{0}/cmass-dr11v1-N-Anderson.dat.fits".format(sdss_dir),
        1, ["RA", "DEC", "Z"], "{0}/full_radecz.hdf5".format(out_dir), "radecz")

# create HDF5 of the random search RA, Dec values
mk_h5("{0}/randoms_1E6_cmass_N_dr11v1.dat".format(CMASS_dir),
      "{0}/srch_radec.hdf5".format(out_dir), "good_pts", skiprows=1, usecols=(0, 1))

# Make a unified hdf5 veto file out of the bad points files
catfiles = glob("{0}/north_block_*".format(CMASS_dir))

with open("{0}/full_veto.dat".format(out_dir), 'w') as outfile:
    for fname in catfiles:
        with open(fname) as infile:
            for line in infile:
                outfile.write(line)

mk_h5("{0}/full_veto.dat".format(out_dir), "{0}/veto.hdf5".format(out_dir),
      "bad_pts", usecols=(0, 1))


# Generate the data for specific cosmologies