bins_vel = np.linspace(
    vel_start,
    vel_end,
    n_bins,
)

distribution = {}

snapshots = [6, 7]

for nSnap in snapshots:

    distribution[nSnap] = {}

    distribution[nSnap]['enzo'] = {}
    data_enzo = load_snapshot_enzo(nSnap, enzo_dir, particles=True)
    current_z_enzo = data_enzo['current_z']
    dens_enzo = data_enzo['gas']['density'][...]
    vel_enzo = np.abs(data_enzo['gas']['momentum_x'][...] /
                      dens_enzo).flatten()
    vel_dm_enzo = np.abs(data_enzo['dm']['vel_x'][...]).flatten()
    hist_vel_enzo, bin_egdes = np.histogram(vel_enzo, bins_vel, density=True)
    hist_vel_dm_enzo, bin_egdes = np.histogram(vel_dm_enzo,
                                               bins_vel,
                                               density=True)
    distribution[nSnap]['enzo']['vel_gas'] = hist_vel_enzo
    distribution[nSnap]['enzo']['vel_dm'] = hist_vel_dm_enzo

    distribution[nSnap]['cholla'] = {}
    data_cholla = load_snapshot_data(nSnap, cholla_dir)
    current_z_cholla = data_cholla['current_z']
Exemplo n.º 2
0
    temp_ramses = data_ramses['gas']['temperature'][...]
    t_rm = (dens_ramses * temp_ramses).sum() / dens_ramses.sum()
    print(' Ramses: ', current_z_ramses)
    z_rm_list.append(current_z_ramses)
    t_rm_list.append(t_rm)

enzoDir = dataDir + 'cosmo_sims/enzo/256_hydro_50Mpc_HLLC_grav4/h5_files/'

z_en_list = []
t_en_list = []
for nSnap in range(34):
    #Load Enzo data
    data_enzo = load_snapshot_enzo(nSnap,
                                   enzoDir,
                                   dm=True,
                                   particles=False,
                                   cool=False,
                                   metals=False,
                                   hydro=True)
    current_a_enzo = data_enzo['current_a']
    current_z_enzo = data_enzo['current_z']
    dens_enzo = data_enzo['gas']['density'][...]
    gas_U_en = data_enzo['gas']['GasEnergy'][...] / dens_enzo
    temp_enzo = get_temp(gas_U_en * 1e6)
    t_en = (dens_enzo * temp_enzo).sum() / dens_enzo.sum()
    print(' enzo: ', current_z_enzo)
    z_en_list.append(current_z_enzo)
    t_en_list.append(t_en)

enzoDir = dataDir + 'cosmo_sims/enzo/256_hydro_50Mpc_HLLC_grav4/h5_files/'
Exemplo n.º 3
0
                                       proj_offset,
                                       proj_depth,
                                       log=False)
    proj_weight = get_projection(weight, proj_offset, proj_depth, log=False)
    proj = proj_data_wheight / proj_weight
    proj = np.log10(proj)
    # proj = get_projection( data, proj_offset, proj_depth )
    data_ch[field] = {}
    data_ch[field]['proj'] = proj
    data_ch[field]['max'] = proj.max()
    data_ch[field]['min'] = proj.min()

data_en = {}
data_enzo = load_snapshot_enzo(nSnap,
                               enzoDir_uv,
                               dm=True,
                               cool=True,
                               metals=metals,
                               temp=True)
current_a_enzo = data_enzo['current_a']
current_z_enzo = data_enzo['current_z']
for i, field in enumerate(fields):
    if field == 'density_dm':
        data = data_enzo['dm']['density'][...]
        weight = data_enzo['dm']['density'][...]

    else:
        data = data_enzo['gas'][field][...]
        if field == 'HI_density':
            data[data > data.mean() * 2000] = data.mean() * 2000
        weight = data_enzo['gas']['density']
    data_weight = data * weight
matplotlib.rcParams['mathtext.rm'] = 'serif'

data_dir = '/home/bruno/Desktop/data/'
# data_dir = '/home/bruno/Desktop/ssd_0/data/'
# data_dir = '/raid/bruno/data/'
enzo_dir = data_dir + 'cosmo_sims/enzo/256_cool_uv_50Mpc_HLLC_grav4/h5_files/'
cholla_dir = data_dir + 'cosmo_sims/256_cool_uv_50Mpc/snapshots/'

# output_dir = '/home/bruno/Desktop/'
output_dir = data_dir + 'cosmo_sims/figures/'
create_directory(output_dir)

data = {}
types = ['enzo', 'cholla']
# types = [ 'enzo' ]
data['enzo'] = load_snapshot_enzo(33, enzo_dir, hydro=True, temp=True)
data['cholla'] = load_cholla_snapshot_file(33, cholla_dir, dm=False)

current_z = data['enzo']['current_z']

#Get Bin Egdes for the histogram
dens_start, dens_end = -2, 5
temp_start, temp_end = 2, 8
nbins = 800
bins_dens = np.logspace(dens_start, dens_end, nbins, base=10)
bins_temp = np.logspace(temp_start, temp_end, nbins, base=10)

fit_values = {
    'enzo': {
        'T0': 2.898,
        'gamma': 0.567,