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
#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) modesIon = ifftn(ion * dens) kmid_bins, powerspec, p_err = modes_to_pspec(modesIon, boxsize=boxsize) if (minimum > np.min(powerspec[1:-1] * kmid_bins[1:-1]**3 * k)): minimum = np.min(powerspec[1:-1] * kmid_bins[1:-1]**3 * k) if (maximum < np.max(powerspec[1:-1] * kmid_bins[1:-1]**3 * k)): maximum = np.max(powerspec[1:-1] * kmid_bins[1:-1]**3 * k) #plt.xscale('log') ##plt.yscale('log') #cmap = m.cm.get_cmap('jet_r') #rgba = cmap(1.-meanIon[i])