Beispiel #1
0
def BOSSGalaxies(sample='lowz-south'):
    ''' Read in BOSS galaxy catalog. Data can be downloaded from 
    https://data.sdss.org/sas/dr12/boss/lss/
    

    Parameters
    ----------
    sample : string
        Specify the exact BOSS sample. For options see
        https://data.sdss.org/sas/dr12/boss/lss/
        (Default: 'cmass-north')

    Returns
    -------
    data : nbodykit.lab.FITSCatalog object
        BOSS galaxy catalog  
    '''
    if sample == 'cmass-north':
        fgal = os.path.join(os.environ('BOSSSBI_DIR'), 'boss',
                            'galaxy_DR12v5_CMASS_North.fits.gz')
    elif sample == 'lowz-south':
        fgal = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dat',
                            'galaxy_DR12v5_LOWZ_South.fits.gz')
    else:
        raise NotImplementedError

    data = NBlab.FITSCatalog(fgal)
    return data
Beispiel #2
0
    random_path = None
    output_path = None
    zlim        = None
    nmesh       = None
    sys_tot     = None


galaxy_path = comm.bcast(galaxy_path, root=0)
random_path = comm.bcast(random_path, root=0)
output_path = comm.bcast(output_path, root=0)
zlim = comm.bcast(zlim, root=0) 
nmesh = comm.bcast(nmesh, root=0)
sys_tot = comm.bcast(sys_tot, root=0)  

# 
data    = nb.FITSCatalog(galaxy_path)
randoms = nb.FITSCatalog(random_path)

if rank == 0:    
    print('data    columns = ',    data.columns, data.size)
    print('randoms columns = ', randoms.columns, randoms.size)


ZMIN = zlim[0]
ZMAX = zlim[1]


# slice the data and randoms
compmin=0.5
valid = (data['Z'] >= ZMIN) & (data['Z'] <= ZMAX)
if 'IMATCH' in data.columns:
Beispiel #3
0
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

from argparse import ArgumentParser
ap = ArgumentParser(description='Neural Net regression')
ap.add_argument('--galaxy_path', default='NONE')
ap.add_argument('--output_path', default='NONE')
# ap.add_argument('--nmesh',        default=256, type=int)
ap.add_argument('--zlim', nargs='*', type=float, default=[0.8, 2.2])
# ap.add_argument('--sys_tot',      action='store_true')
ns = ap.parse_args()

#
data = nb.FITSCatalog(ns.galaxy_path)
print(data.columns)
data['Weight'] = data['WEIGHT_FKP']
#data['Weight'] = data['WEIGHT_CP']*data['WEIGHT_NOZ']*data['WEIGHT_SYSTOT']*data['WEIGHT_FKP']

ZMIN = ns.zlim[0]
ZMAX = ns.zlim[1]

# slice the data and randoms
print('before', data.size)
valid = (data['Z'] > ZMIN) & (data['Z'] < ZMAX)
data = data[valid]
print('after', data.size)

if rank == 0:
    print('data    columns = ', data.columns, data.size)
Beispiel #4
0
rmin = 0.0
rmax = 200.0
#box        = 1000      # Mpc/h
edges = np.arange(rmin, rmax + 2 * dr, dr)

#MOCKNAME   = 'UNIT'
#LASTNAME   = 'REZAIE'
#BINNING    = 'lin'
#ESTIMATOR1 = 'xi2D'
#ESTIMATOR2 = 'xil'
#version    = 1
#ouname1    = f'{ESTIMATOR1}_{BINNING}_{LASTNAME}_{MOCKNAME}_{version}.txt'
#ouname2    = f'{ESTIMATOR2}_{BINNING}_{LASTNAME}_{MOCKNAME}_{version}.txt'

# read data
catalog = nb.FITSCatalog(input_name)
for col in ['x', 'y', 'z', 'z_rsd']:
    if not col in catalog.columns: raise RuntimeError('%s not available' % col)

# redshift or real space
if action == 'ddrmu':
    catalog['Position'] = np.column_stack(
        [catalog['x'], catalog['y'], catalog['z']])
elif action == 'ddsmu':
    catalog['Position'] = np.column_stack(
        [catalog['x'], catalog['y'], catalog['z_rsd']])

# run Corrfunc
if rank == 0: t0 = time()
results = nb.SimulationBox2PCF(mode,
                               catalog,
Beispiel #5
0
    ap.add_argument('--poles', nargs='*', type=int, default=[0, 2, 4])
    ap.add_argument('--real', action='store_true')
    ns = ap.parse_args()
else:
    ns = None

ns = comm.bcast(ns, root=0)

if rank == 0:
    args = ns.__dict__
    for (a, b) in zip(args.keys(), args.values()):
        print('{:6s}{:15s} : {}'.format('', a, b))

ZMIN, ZMAX = ns.zlim

data = nb.FITSCatalog(ns.data)
randoms = nb.FITSCatalog(ns.randoms)

if ns.mask != 'None':
    mask = nb.FITSCatalog(ns.mask)['bool_index']
    data = data[mask]
else:
    mask = None

if ns.wsys != 'None':
    wsys = nb.FITSCatalog(ns.wsys)['wsys']
    if mask is None:
        raise RuntimeError('mask and weight should be used together')
    data['Weight'] = wsys

if ns.real: