Пример #1
0
def compute_meanMassIon(infile, densfile, double_precision, isPadded,
                        inputIsDouble, gridsize):
    ion = rf.read_ion(infile, isPadded, inputIsDouble, gridsize)
    dens = rf.read_dens(densfile, isPadded, double_precision, gridsize)

    meanIon = np.mean(ion * dens, dtype=np.float64) / np.mean(dens,
                                                              dtype=np.float64)
    return meanIon
Пример #2
0
    meanIon = np.zeros(len(redshift))

    minimum = 1.e10
    maximum = 1.e-10

    counter = 0
    for i in range(len(redshift) - 1):
        z = redshift[i + 1]

        if (i < 10):
            infile = ionfile + '_0' + str(i)
        else:
            infile = ionfile + '_' + str(i)

        #ionization field
        ion = rf.read_ion(infile, isPadded, inputIsDouble, gridsize)
        if (os.path.isfile(infile) == False):
            continue

        meanIon[i] = np.mean(ion, dtype=np.float64)
        print "z =", z, "\tXHII =", meanIon[i]

        if (snap[i] != 0):
            if (counter < 10):
                dinfile = densfile + '_00' + str(counter)
            else:
                dinfile = densfile + '_0' + str(counter)
            counter = counter + 1

        dens = rf.read_dens(dinfile, isPadded, double_precision, gridsize)
Пример #3
0
def compute_meanIon(infile, isPadded, inputIsDouble, gridsize):
    ion = rf.read_ion(infile, isPadded, inputIsDouble, gridsize)

    meanIon = np.mean(ion, dtype=np.float64)
    return meanIon
Пример #4
0
    'figure.subplot.right': 0.97
})
plt.rcParams["figure.figsize"] = (6, 5)

for i in range(len(redshift) - 1):

    str_redshift = "z = " + str("%3.1f" % redshift[i])
    str_time = "t = " + str("%4.0f" % (time[i] / 1.e6)) + " Myr"

    if (i < 10):
        infile = ionfile + '_0' + str(i)
    else:
        infile = ionfile + '_' + str(i)

    #ionization field
    ion = rf.read_ion(infile, isPadded, inputIsDouble, gridsize)
    toPlot = np.log10(1. - ion)
    str_mean = "$\langle\chi_\mathrm{HI}\\rangle$ =" + str(
        "%4.2f" % (np.mean(1. - ion, dtype=np.float64)))
    plot_field(infile, i, toPlot, cut_slice, str_time, str_redshift, str_mean)

    if (solve_he == 1):
        if (i < 10):
            HeIIinfile = HeIIionfile + '_0' + str(i)
            HeIIIinfile = HeIIIionfile + '_0' + str(i)
        else:
            HeIIinfile = HeIIionfile + '_' + str(i)
            HeIIIinfile = HeIIIionfile + '_' + str(i)

        ion_HeII = rf.read_ion(HeIIinfile, isPadded, inputIsDouble, gridsize)
        ion_HeIII = rf.read_ion(HeIIIinfile, isPadded, inputIsDouble, gridsize)