# sp_ax.plot(nu, b, 'k--') (nu, b, _) = calc_mo_white_nu(1000, cosmo) st_ax.plot(nu, b, 'k-') sp_ax.plot(nu, b, 'k-') (nu, b, _) = calc_sheth_tormen_nu(1000, cosmo) st_ax.plot(nu, b, 'g-') sp_ax.plot(nu, b, 'g-') age_bins = 5 mass_bins = 7 ifile = 'properties.dat' agelabel = 'Sub-Max-Form. Age' overall_data = ([],[]) for (i, s) in enumerate(snaps): snap_dir = 'snap{0}{1}'.format(s, snap_id) direc = '{0}Desktop/age-clustering-data/{1}/attempt1_sub_form_jp/'.format(home, snap_dir) data = readfile('{0}{1}'.format(direc, ifile), col = 28, delim = ' ', skip = 1) col_j = ['k', 'b', 'c', 'g', 'm', 'r'] #Colors of Age bins that are plotted for age_i in range(0, age_bins + 1): bias = [] mass = [] for mass_i in range(1, mass_bins + 1): b_data = readfile('{0}bias/bias_{1}_{2}'.format(direc, mass_i, age_i), col = 2, delim = ',', skip = 1) idx1 = where(logical_and(b_data[0] >= 5 * h, b_data[0] <= 15 * h))[0] idx2 = where(logical_and(data[0] == mass_i, data[1] == age_i))[0] bias.append(sum(b_data[1][idx1]) / len(b_data[1][idx1])) mass.append(data[4][idx2][0]) bias = array(bias) mass = array(mass) if symbs[i] == 'p' or symbs[i] == '*': symsize = 5. else:
elif sys.argv[6] == 'True' or sys.argv[6] == 'true' or sys.argv[ 6] == '1': log_flag = True else: raise TypeError( 'Log-flag should be be some type of boolean value such as (true, false, 1, or 0).' ) except IndexError: print 'No Log-flag given assuming linear space.' if not check_max_min_step(low, high, step): raise RuntimeError( 'Given min, max, step don\'t make sense: minimum: {0} maximum: {1} ' 'step: {2}'.format(low, high, step)) ##Setup and Input Error check complete #Create new radius values if not log_flag: r_new = np.linspace(low, high, (high - low) / step + 1.) else: r_new = np.logspace(low, high, (high - low) / step + 1.) zeros = np.zeros(len(r_new)) #Read in old correlation file. ##THE FOLLOWING ONLY WORKS WITH BOYLAN-KOLCHIN'S CORREL FILES infile_data = readfile(infile, col=4, delim=' ', skip=2) new_cf_func = inter.splrep(infile_data[0], infile_data[1]) new_corr = create_corr_struct(r_new, inter.splev(r_new, new_cf_func), zeros, zeros, zeros, 0) plt.loglog(infile_data[0], infile_data[1]) plt.loglog(new_corr['data'].r, new_corr['data'].cf, '*') plt.show() write_corr_file(outfile, new_corr) print 'File {0} saved.'.format(outfile)
titles = ('Max-Formation-FOF Age', 'Root-Formation-FOF Age', 'Max-Assembly-FOF Age', 'Root-Assembly-FOF Age', 'Max-Formation-subhalo Age', 'Root-Formation-subhalo Age', 'Max-Assembly-subhalo Age', 'Root-Assembly-subhalo Age') outs = ('prop_table_fof_form_jp.tex', 'prop_table_fof_form_gao.tex', 'prop_table_fof_assem_jp.tex', 'prop_table_fof_assem_gao.tex', 'prop_table_sub_form_jp.tex', 'prop_table_sub_form_gao.tex', 'prop_table_sub_assem_jp.tex', 'prop_table_sub_assem_gao.tex') snaps = (22, 27, 31, 36, 40, 45, 51, 67) zs = (6.196857, 4.179475, 3.060424, 2.0700316, 1.5036374, 0.98870987, 0.5641763, 0.) snap_postfix = '-1' files = 'properties.dat' for (t, l, o, tt) in zip(tables, table_labels, outs, titles): o_direc = join(b_o_direc, o) of = setup_file(o_direc) for (sn, z) in zip(snaps, zs): t_direc = join(b_t_direc, 'snap{0}{1}'.format(sn, snap_postfix), t) #data = [] #for f in files: fn = join(t_direc, files) try: #data.append(readfile(fn, col = 28, delim = ' ', skip = 1)) data = readfile(fn, col = 28, delim = ' ', skip = 1) data.extend((z, t_direc)) except IOError: print('Unable to open: ', fn, file=stderr) data = None if data != None: write_tex(of, l, data, sn == snaps[-1]) close_file(of)
st_ax.plot(nu, b, 'k--') sp_ax.plot(nu, b, 'k--') (nu, b, _) = calc_mo_white_nu(1000, cosmo) st_ax.plot(nu, b, 'k-') sp_ax.plot(nu, b, 'k-') (nu, b, _) = calc_sheth_tormen_nu(1000, cosmo) st_ax.plot(nu, b, 'g-') sp_ax.plot(nu, b, 'g-') age_bins = 5 mass_bins = 7 ifile = 'properties.dat' agelabel = 'Sub-Max-Form. Age' for (i, s) in enumerate(snaps): snap_dir = 'snap{0}{1}'.format(s, snap_id) direc = '{0}Desktop/age-clustering-data/{1}/attempt1_sub_form_jp/'.format(home, snap_dir) data = readfile('{0}{1}'.format(direc, ifile), col = 28, delim = ' ', skip = 1) col_j = ['k', 'b', 'c', 'g', 'm', 'r'] #Colors of Age bins that are plotted for age_i in range(0, age_bins + 1): bias = [] mass = [] for mass_i in range(1, mass_bins + 1): b_data = readfile('{0}bias/bias_{1}_{2}'.format(direc, mass_i, age_i), col = 2, delim = ',', skip = 1) idx1 = where(logical_and(b_data[0] >= 5 * h, b_data[0] <= 15 * h))[0] idx2 = where(logical_and(data[0] == mass_i, data[1] == age_i))[0] bias.append(sum(b_data[1][idx1]) / len(b_data[1][idx1])) mass.append(data[4][idx2][0]) bias = array(bias) mass = array(mass) if symbs[i] == 'p' or symbs[i] == '*': symsize = 5. else:
print 'Check your minimum, maximum and step inputs: minimum: {0} maximum: {1} ' 'step: {2}'.format(sys.argv[3], sys.argv[4], sys.argv[5]) try: if sys.argv[6] == 'False' or sys.argv[6] == 'false' or sys.argv[6] == '0': log_flag = False elif sys.argv[6] == 'True' or sys.argv[6] == 'true' or sys.argv[6] == '1': log_flag = True else: raise TypeError('Log-flag should be be some type of boolean value such as (true, false, 1, or 0).') except IndexError: print 'No Log-flag given assuming linear space.' if not check_max_min_step(low, high, step): raise RuntimeError('Given min, max, step don\'t make sense: minimum: {0} maximum: {1} ' 'step: {2}'.format(low, high, step)) ##Setup and Input Error check complete #Create new radius values if not log_flag: r_new = np.linspace(low, high, (high - low) / step + 1.) else: r_new = np.logspace(low, high, (high - low) / step + 1.) zeros = np.zeros(len(r_new)) #Read in old correlation file. ##THE FOLLOWING ONLY WORKS WITH BOYLAN-KOLCHIN'S CORREL FILES infile_data = readfile(infile, col = 4, delim = ' ', skip = 2) new_cf_func = inter.splrep(infile_data[0], infile_data[1]) new_corr = create_corr_struct(r_new, inter.splev(r_new, new_cf_func), zeros, zeros, zeros, 0) plt.loglog(infile_data[0], infile_data[1]) plt.loglog(new_corr['data'].r, new_corr['data'].cf, '*') plt.show() write_corr_file(outfile, new_corr) print 'File {0} saved.'.format(outfile)