Пример #1
0
def xy_pos(pos, centre, H0=100.0):

    da = cosmo2.d_angdi(centre[2], *const.BASE) * \
      cosmo2.d_H(H0)

    x = da *astro.deg2rad((centre[0] - pos[0]) * \
                           np.cos(astro.deg2rad(pos[1])))
    y = da * astro.deg2rad(pos[1] - centre[1])

    return x, y
Пример #2
0
def xy_pos(pos, centre, H0 = 100.0):

    da = cosmo2.d_angdi(centre[2], *const.BASE) * \
      cosmo2.d_H(H0)
      
    x = da *astro.deg2rad((centre[0] - pos[0]) * \
                           np.cos(astro.deg2rad(pos[1])))
    y = da * astro.deg2rad(pos[1] - centre[1])
    
    return x, y
Пример #3
0
def xy_centre(data, centre=None, H0=100.0):

    if not centre:
        centre = (data.ra.median(), data.dec.median(), data.z.median())

    da = cosmo2.d_angdi(centre[2], *const.BASE) * \
      cosmo2.d_H(H0)

    x = da *astro.deg2rad((centre[0] - data.ra) * \
                           np.cos(astro.deg2rad(data.dec)))
    y = da * astro.deg2rad(data.dec - centre[1])
    r = np.sqrt(x**2 + y**2)

    return data.join(pd.DataFrame({'x': x, 'y': y, 'r': r}))
Пример #4
0
def xy_centre(data, centre = None,  H0 = 100.0):

    if not centre:
        centre = (data.ra.median(), data.dec.median(),
                  data.z.median())

    da = cosmo2.d_angdi(centre[2], *const.BASE) * \
      cosmo2.d_H(H0)
      
    x = da *astro.deg2rad((centre[0] - data.ra) * \
                           np.cos(astro.deg2rad(data.dec)))
    y = da * astro.deg2rad(data.dec - centre[1])
    r = np.sqrt(x ** 2 + y ** 2)
    
    return data.join(pd.DataFrame({'x' : x, 'y' : y, 'r' : r}))
Пример #5
0
cluster = np.genfromtxt(sys.argv[2], unpack = True,
                             dtype = 'float')
cluster_num = float(sys.argv[3])
sncl = data[8, data[0] == cluster_num]

index = cluster[0] == cluster_num

# cluster properties
racl = np.median(cluster[4, index])
decl = np.median(cluster[5, index])
zcl = np.median(cluster[6, index])
dists = astro.ang_sep([cluster[4, index], cluster[5, index]], [racl,  decl]) * 60.0
area = np.pi * np.mean(dists) ** 2 # arcmin^2

# Mpc per arcmin scale
da = cosmo2.d_angdi(zcl, omega_m, omega_l) * cosmo2.d_H(h0)
mpca = astro.deg2rad(da / 60.0)

# coordinates wrt cluster center
gx = 60. * (racl - cluster[4, index]) * np.cos(astro.deg2rad(cluster[5, index]))
gy = 60. * (cluster[5, index] - decl)   # arcmin      

# adaptive kernel density map
gadk = ss.gaussian_kde(np.vstack([gx * mpca, gy * mpca]), bw_method = 'silverman')

xedges = np.linspace(-0.6, 0.6, 100)
yedges = np.linspace(-1.0, 1.0, 100)
xx, yy = np.meshgrid(xedges, yedges)
gridpoints = np.array([xx.ravel(), yy.ravel()])
zz = np.reshape(gadk(gridpoints), xx.shape)
indices = np.unravel_index(zz.argmax(), zz.shape)
Пример #6
0
u_dict = dict(zip(*u_id))

# DEFINE CONSTANTS

H0 = 100 #km/s/Mpc

# PRINT HALO FILE INFO

for i in range(len(u_id[0])):
    
    x = (u_id[0][i] == data[opts.columns[0] - 1])

    id = data[opts.columns[0] - 1, x][0]
    central = data[opts.columns[2] - 1, x][0]
    ra = np.median(np.array(data[opts.columns[3] - 1, x], dtype = 'f'))
    min_ra = np.min(np.array(data[opts.columns[3] - 1, x], dtype = 'f'))
    max_ra = np.max(np.array(data[opts.columns[3] - 1, x], dtype = 'f'))
    dec = np.median(np.array(data[opts.columns[4] - 1, x], dtype = 'f'))
    min_dec = np.min(np.array(data[opts.columns[4] - 1, x], dtype = 'f'))
    max_dec = np.max(np.array(data[opts.columns[4] - 1, x], dtype = 'f'))
    z = np.median(np.array(data[opts.columns[5] - 1, x], dtype = 'f'))
    rich = u_dict[id]
    mass = np.array(data[opts.columns[1] - 1, x][0], dtype = 'float')
    r200_val = r200(mass, H0, 0.0, *const.BASE) #Mpc
    da = cosmo2.d_angdi(z, *const.BASE) * cosmo2.d_H(H0) #Mpc
    r200_val_arcmin = astro.rad2deg(r200_val / da) * 60.0 #arcmin
    
    if rich >= opts.mem_limit:
        print id, central, ra, dec, z, rich, mass, r200_val_arcmin, min_ra, max_ra, min_dec, max_dec
Пример #7
0
u_dict = dict(zip(*u_id))

# DEFINE CONSTANTS

H0 = 100  #km/s/Mpc

# PRINT HALO FILE INFO

for i in range(len(u_id[0])):

    x = (u_id[0][i] == data[opts.columns[0] - 1])

    id = data[opts.columns[0] - 1, x][0]
    central = data[opts.columns[2] - 1, x][0]
    ra = np.median(np.array(data[opts.columns[3] - 1, x], dtype='f'))
    min_ra = np.min(np.array(data[opts.columns[3] - 1, x], dtype='f'))
    max_ra = np.max(np.array(data[opts.columns[3] - 1, x], dtype='f'))
    dec = np.median(np.array(data[opts.columns[4] - 1, x], dtype='f'))
    min_dec = np.min(np.array(data[opts.columns[4] - 1, x], dtype='f'))
    max_dec = np.max(np.array(data[opts.columns[4] - 1, x], dtype='f'))
    z = np.median(np.array(data[opts.columns[5] - 1, x], dtype='f'))
    rich = u_dict[id]
    mass = np.array(data[opts.columns[1] - 1, x][0], dtype='float')
    r200_val = r200(mass, H0, 0.0, *const.BASE)  #Mpc
    da = cosmo2.d_angdi(z, *const.BASE) * cosmo2.d_H(H0)  #Mpc
    r200_val_arcmin = astro.rad2deg(r200_val / da) * 60.0  #arcmin

    if rich >= opts.mem_limit:
        print id, central, ra, dec, z, rich, mass, r200_val_arcmin, min_ra, max_ra, min_dec, max_dec