예제 #1
0
    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
else:
    gridsize = rp.identify_int(lines, rp.gridsize_str, rp.splitting_str)
    boxsize = rp.identify_float(lines, rp.boxsize_str, rp.splitting_str)

solve_he = rp.identify_int(lines, rp.solve_he_str, rp.splitting_str)
HeIIionfile = rp.identify_string(lines, rp.HeIIionfile_str, rp.splitting_str)
예제 #2
0
    if num < 0:
        return -np.ceil(abs(num))
    else:
        return np.int32(num)

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
else:
    gridsize = rp.identify_int(lines, rp.gridsize_str, rp.splitting_str)
    boxsize = rp.identify_float(lines, rp.boxsize_str, rp.splitting_str)

Omegab = rp.identify_float(lines, rp.omega_b_str, rp.splitting_str)
Omegam = rp.identify_float(lines, rp.omega_m_str, rp.splitting_str)
h = rp.identify_float(lines, rp.h_str, rp.splitting_str)

redshift, snap = np.loadtxt(redshiftfile, unpack='True', skiprows=0, usecols=(0,1))
snap = np.int32(snap)
예제 #3
0
import sys
import ntpath
import os

import read_parameterfile as rp

def path_leaf(path):
    head, tail = ntpath.split(path)
    return tail or ntpath.basename(head)

#def create_result_dir(infile):
inifile = sys.argv[1]

lines = rp.read_inifile(inifile)
solve_he = rp.identify_int(lines, rp.solve_he_str, rp.splitting_str)

directory = rp.get_directory(inifile)
basename = os.path.splitext(path_leaf(inifile))[0]

if(directory==''):
    newdir = 'results_' + basename
else:
    newdir = directory + '/results_' + basename

if not os.path.exists(newdir):
    os.makedirs(newdir)
    
dir_21cm = newdir + '/21cm'
if not os.path.exists(dir_21cm):
    os.makedirs(dir_21cm)
    
예제 #4
0
def round_down(num):
    if num < 0:
        return -np.ceil(abs(num))
    else:
        return np.int32(num)

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

lines = rp.read_inifile(inifile)

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

solve_he = rp.identify_int(lines, rp.solve_he_str, rp.splitting_str)

if(specie > 0 and solve_he == 0):
    sys.exit()

if(specie == 0):
    ionfile = rp.identify_string(lines, rp.ionfile_str, rp.splitting_str)
elif(specie == 1):
    ionfile = rp.identify_string(lines, rp.HeIIionfile_str, rp.splitting_str)
elif(specie == 2):
    ionfile = rp.identify_string(lines, rp.HeIIIionfile_str, rp.splitting_str)
else:
    sys.exit()
    
densfile = rp.identify_string(lines, rp.densfile_str, rp.splitting_str)
double_precision = rp.identify_int(lines, rp.double_precision_str, rp.splitting_str)