Example #1
0
                        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


inifile = sys.argv[1]
inputIsDouble = np.int32(sys.argv[2])
outputfile = sys.argv[3]

lines = rp.read_inifile(inifile)

redshiftfile = rp.identify_string(lines, rp.redshiftfile_str,
                                  rp.splitting_str)  #sys.argv[4]

ionfile = rp.identify_string(lines, rp.ionfile_str,
                             rp.splitting_str)  #sys.argv[1]
densfile = rp.identify_string(lines, rp.densfile_str, rp.splitting_str)
double_precision = rp.identify_int(lines, rp.double_precision_str,
                                   rp.splitting_str)
isPadded = rp.identify_int(lines, rp.padded_str,
                           rp.splitting_str)  #np.int32(sys.argv[3])
isPadded_factor = isPadded**(1. / 3.)
if (isPadded != 0):
    gridsize = np.int32(
        rp.identify_int(lines, rp.gridsize_str, rp.splitting_str) /
        isPadded_factor)
    boxsize = rp.identify_float(lines, rp.boxsize_str,
                                rp.splitting_str) / isPadded_factor
Example #2
0

def redshift_from_time_flatuniverse(zmax, time):
    tmp = (omega_l / omega_m)**0.5
    tmp2 = np.sinh(1.5 * H0 * omega_l**0.5 * time +
                   np.arcsinh(tmp * (1. + zmax)**-1.5))
    return (tmp / tmp2)**(2. / 3.) - 1.


inifile = sys.argv[1]
inputIsDouble = np.int32(sys.argv[2])
cut_slice = int(sys.argv[3])

lines = rp.read_inifile(inifile)

redshiftfile = rp.identify_string(lines, rp.redshiftfile_str, rp.splitting_str)

ionfile = rp.identify_string(lines, rp.ionfile_str, rp.splitting_str)
double_precision = rp.identify_int(lines, rp.double_precision_str,
                                   rp.splitting_str)
isPadded = rp.identify_int(lines, rp.padded_str, rp.splitting_str)
isPadded_factor = isPadded**(1. / 3.)
if (isPadded != 0):
    gridsize = np.int32(
        rp.identify_int(lines, rp.gridsize_str, rp.splitting_str) /
        isPadded_factor)
    boxsize = rp.identify_float(lines, rp.boxsize_str,
                                rp.splitting_str) / isPadded_factor
else:
    gridsize = rp.identify_int(lines, rp.gridsize_str, rp.splitting_str)
    boxsize = rp.identify_float(lines, rp.boxsize_str, rp.splitting_str)