def plot_Kulkarni(zmin, zmax, ax, num_runs=1000): method = 'Nelder-Mead' zl = (zmin, zmax) lfi = lf(quasar_files=qlumfiles, selection_maps=selnfiles, zlims=zl) g = (np.log10(1.e-6), -25.0, -3.0, -1.5) b = lfi.bestfit(g, method=method) if zmin < 0.3: lfi.prior_min_values = np.array([-14.0, -32.0, -7.0, -10.0]) else: lfi.prior_min_values = np.array([-14.0, -32.0, -7.0, -4.0]) if zmin > 5.4: # Special priors for z = 6 data. lfi.prior_max_values = np.array([-4.0, -20.0, -4.0, 0.0]) # Change result of optimize.minimize so that emcee works. lfi.bf.x[2] = -5.0 elif zmin < 0.3: lfi.prior_max_values = np.array([-1.0, -15.0, 0.0, 15.0]) else: lfi.prior_max_values = np.array([-4.0, -20.0, 0.0, 0.0]) assert (np.all(lfi.prior_min_values < lfi.prior_max_values)) lfi.run_mcmc(num_runs) bf = np.median(lfi.samples, axis=0) lfi.get_percentiles() #lfi.chains() #lfi.corner_plot() draw(lfi, ax, show_individual_fit=True) return lfi
('Data_new/kashikawa15_sel.dat', 0.05, 0.05, 6.5, 11, r'Kashikawa et al.\ 2015')] method = 'Nelder-Mead' zls = [(0.1, 0.4), (0.4, 0.6), (0.6, 0.8), (0.8, 1.0), (1.0, 1.2), (1.2, 1.4), (1.4, 1.6), (1.6, 1.8), (1.8, 2.2), (2.2, 2.4), (2.4, 2.5), (2.5, 2.6), (2.6, 2.7), (2.7, 2.8), (2.8, 2.9), (2.9, 3.0), (3.0, 3.1), (3.1, 3.2), (3.2, 3.3), (3.3, 3.4), (3.4, 3.5), (3.7, 4.1), (4.1, 4.7), (4.7, 5.5), (5.5, 6.5)] lfs = [] for i, zl in enumerate(zls): lfi = lf(quasar_files=qlumfiles, selection_maps=selnfiles, zlims=zl) print 'z =', zl print '{:d} quasars in this bin.'.format(lfi.z.size) print 'sids (samples): ' + ' '.join( ['{:2d}'.format(int(x)) for x in np.unique(lfi.sid)]) print 'sids (maps): ' + ' '.join( ['{:2d}'.format(x.sid) for x in lfi.maps]) print ' ' g = (np.log10(1.e-6), -25.0, -3.0, -1.5) b = lfi.bestfit(g, method=method) zmin, zmax = zl if zmin < 0.3:
def our_lf(zrange): lfi = lf(quasar_files=qlumfiles, selection_maps=selnfiles, zlims=zrange) return lfi