Ejemplo n.º 1
0
def plot_halos(ax, line, quench, r200_scaled=False):

    z = 0.2
    cos_rho, cos_M, cos_r200, cos_ssfr = get_cos_halos()

    if r200_scaled:
        cos_rho = cos_rho.astype(float) * h * (1 + z)
        dist = cos_rho / cos_r200
    else:
        dist = cos_rho.copy()

    EW, EWerr = read_halos_data(line)

    EW_upper_lim = (EW < 0.)
    EW, EWerr = convert_to_log(np.abs(EW), EWerr)

    mask = np.invert(EW_upper_lim) * (cos_ssfr > quench)
    c1 = ax.errorbar(dist[mask],
                     EW[mask],
                     yerr=EWerr[mask],
                     c=cos_colors[0],
                     ls='',
                     marker='x',
                     markersize=6,
                     capsize=4,
                     label='COS-Halos SF')
    mask = np.invert(EW_upper_lim) * (cos_ssfr < quench)
    c2 = ax.errorbar(dist[mask],
                     EW[mask],
                     yerr=EWerr[mask],
                     c=cos_colors[1],
                     ls='',
                     marker='x',
                     markersize=6,
                     capsize=4,
                     label='COS-Halos Q')
    mask = EW_upper_lim * (cos_ssfr > quench)
    ax.scatter(dist[mask],
               EW[mask],
               c=cos_colors[0],
               marker='$\downarrow$',
               s=60.)
    mask = EW_upper_lim * (cos_ssfr < quench)
    ax.scatter(dist[mask],
               EW[mask],
               c=cos_colors[1],
               marker='$\downarrow$',
               s=60.)

    return c1, c2
Ejemplo n.º 2
0
def make_cos_dict(survey, mlim, r200_scaled=False):

    # read in the parameters of the COS galaxies
    cos_dict = {}
    if survey == 'halos':
        cos_dict['rho'], cos_dict['mass'], cos_dict['r200'], cos_dict[
            'ssfr'] = get_cos_halos()
        z = 0.25
    elif survey == 'dwarfs':
        cos_dict['rho'], cos_dict['mass'], cos_dict['r200'], cos_dict[
            'ssfr'] = get_cos_dwarfs()
        z = 0.

    # rescale the impact parameters into kpc/h
    if r200_scaled:
        cos_dict['rho'] = cos_dict['rho'].astype(float)
        cos_dict['rho'] *= h * (1 + z)  # get in kpc/h

    # remove COS galaxies below the mass threshold
    mass_mask = cos_dict['mass'] > mlim
    for k in cos_dict.keys():
        cos_dict[k] = cos_dict[k][mass_mask]

    return cos_dict
Ejemplo n.º 3
0
ngals_each = 5

# Ignore certain COS-Halos galaxies for which there are insufficient Simba analogs.
ignore_simba_gals, ngals_each = get_ignore_simba_gals(model, survey)
if sample_gal in ignore_simba_gals:
    print('Ignoring certain COS galaxies')
    import sys
    sys.exit()

if survey == 'dwarfs':
    from get_cos_info import get_cos_dwarfs
    cos_rho, cos_M, cos_r200, cos_ssfr = get_cos_dwarfs()
    snap = '151'
elif survey == 'halos':
    from get_cos_info import get_cos_halos
    cos_rho, cos_M, cos_r200, cos_ssfr = get_cos_halos()
    snap = '137'

data_dir = '/home/rad/data/'+model+'/'+wind+'/'

sim = caesar.load(data_dir+'Groups/'+model+'_'+snap+'.hdf5')
gal_pos = np.array([i.pos.in_units('kpc/h') for i in sim.galaxies]) # in kpc/h
h = sim.simulation.hubble_constant
redshift = sim.simulation.redshift

snapfile = data_dir + 'snap_'+model+'_'+snap +'.hdf5' 
# need PartType0 - SmoothingLength
hsml = readsnap(snapfile, 'SmoothingLength', 'gas', suppress=1, units=1)  # in kpc/h, comoving
gas_pos = readsnap(snapfile, 'pos', 'gas', suppress=1, units=1) # in kpc/h, comoving

sample_dir = '/disk01/sapple/cgm/absorption/cos_comparison/cos_samples/'+model+'/cos_'+survey+'/samples/'