Exemplo n.º 1
0
# nSnap = 0

n_power_data = 6
ps_all = np.ones([n_power_data, n_kSamples])
# ps_all *= rank

print(" Cholla: ", nSnap)

# if i not in [9]: continue
data_cholla = load_snapshot_data(nSnap, chollaDir_0, cool=True)
current_z_ch = data_cholla['current_z']
dens_dm_cholla = data_cholla['dm']['density'][...]
dens_gas_cholla = data_cholla['gas']['density'][...]
dens_gas_H_cholla = data_cholla['gas']['HI_density'][...]

ps_dm_cholla, k_vals, count_dm_cholla = get_power_spectrum(
    dens_dm_cholla, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)
ps_gas_cholla, k_vals, count_gas_cholla = get_power_spectrum(
    dens_gas_cholla, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)
ps_gas_H_cholla, k_vals, count_gas_cholla = get_power_spectrum(
    dens_gas_H_cholla, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)
# # ps_gas_HII_cholla, k_vals, count_gas_cholla = get_power_spectrum( dens_gas_HII_cholla, Lbox, nx, ny, nz, dx, dy, dz,  n_kSamples=n_kSamples)
#
ps_all[0] = ps_dm_cholla
ps_all[1] = ps_gas_cholla
ps_all[2] = ps_gas_H_cholla
# # ps_all[3] = ps_gas_HII_cholla
#
#
print(' Enzo: ', nSnap)
# data_enzo = load_snapshot_enzo( nSnap, enzoDir, dm=True, cool=True)
data_enzo = load_snapshot_data(nSnap, chollaDir_1, cool=True)
Exemplo n.º 2
0
    #   dens = data['dm']['density'][...]

    data = load_snapshot_data_particles(
        nSnap,
        chollaDir_nyx,
    )
    current_z = data['current_z']
    dens = data['density'][...]

    if current_z < 0: current_z = 0
    print(('Snap: {0}   current_z: {1:.3f}'.format(nSnap, current_z)))
    power_spectrum, k_vals, count = get_power_spectrum(dens,
                                                       Lbox,
                                                       nx,
                                                       ny,
                                                       nz,
                                                       dx,
                                                       dy,
                                                       dz,
                                                       n_kSamples=n_kSamples)
    z_list.append(current_z)
    ps_list.append(power_spectrum)

z_array = np.array(z_list)
ps_array = np.array(ps_list)

data = np.zeros([n_snapshots, n_kSamples + 1])
data[:, 0] = z_array
data[:, 1:] = ps_array

out_file_name = 'ps_{0}_dmOnly_cholla_nyx.dat'.format(nPoints)
snapshots = snapshots[::-1]

# ax1.set_prop_cycle('color', palettable.cmocean.sequential.Haline_10_r.mpl_colors)
# ax2.set_prop_cycle('color', palettable.cmocean.sequential.Haline_10_r.mpl_colors)

for n, nSnap in enumerate(snapshots):

    # inFileName = inputDir_paris + 'particles_{0:03}.h5'.format(nSnap)
    inFileName = inputDir_paris + '{0}_particles.h5'.format(nSnap)
    inFile = h5.File(inFileName, 'r')
    current_z = inFile.attrs['current_z'][0]
    dens = inFile['density'][...]
    inFile.close()

    print(('Snap: {0}   current_z: {1:.3f}'.format(nSnap, current_z)))
    power_spectrum_paris, k_vals_paris, count_paris = get_power_spectrum(
        dens, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)

    # inFileName = inputDir_pfft + 'particles_{0:03}.h5'.format(nSnap)
    inFileName = inputDir_pfft + '{0}_particles.h5'.format(nSnap)
    inFile = h5.File(inFileName, 'r')
    current_z = inFile.attrs['current_z'][0]
    dens = inFile['density'][...]
    inFile.close()

    print(('Snap: {0}   current_z: {1:.3f}'.format(nSnap, current_z)))
    power_spectrum_pfft, k_vals_pfft, count_pfft = get_power_spectrum(
        dens, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)

    #
    # inFileName = inputDir_enzo + 'grid_CIC_{0:03}.h5'.format(nSnap)
    # inFile = h5.File( inFileName, 'r' )
Exemplo n.º 4
0
# snapshots = [ 0,]
snapshots = snapshots[::-1]

# ax1.set_prop_cycle('color', palettable.cmocean.sequential.Haline_10_r.mpl_colors)
# ax2.set_prop_cycle('color', palettable.cmocean.sequential.Haline_10_r.mpl_colors)

for n, nSnap in enumerate(snapshots):

    inFileName = inputDir_paris + 'particles_{0:03}.h5'.format(nSnap)
    inFile = h5.File(inFileName, 'r')
    current_z = inFile.attrs['current_z']
    dens = inFile['density'][...]
    inFile.close()

    print(('Snap: {0}   current_z: {1:.3f}'.format(nSnap, current_z)))
    power_spectrum_paris_dm, k_vals_paris, count_paris = get_power_spectrum(
        dens, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)

    inFileName = inputDir_paris + 'grid_{0:03}.h5'.format(nSnap)
    inFile = h5.File(inFileName, 'r')
    current_z = inFile.attrs['Current_z']
    dens = inFile['density'][...]
    inFile.close()

    print(('Snap: {0}   current_z: {1:.3f}'.format(nSnap, current_z)))
    power_spectrum_paris_gas, k_vals_paris, count_paris = get_power_spectrum(
        dens, Lbox, nx, ny, nz, dx, dy, dz, n_kSamples=n_kSamples)

    inFileName = inputDir_enzo + 'grid_CIC_{0:03}.h5'.format(nSnap)
    inFile = h5.File(inFileName, 'r')
    current_z = inFile.attrs['current_z']
    dens = inFile['dm']['density'][...]