################################################# ################################################# # for each bin in delta compute vmax mean and its std pcs = [0, 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 99, 100] bins = n.hstack((0,n.logspace(-3, 4, 60))) vmaxBar = n.empty(len(bins)-1) vmaxStd = n.empty(len(bins)-1) distrib = n.empty((len(bins)-1, len(pcs))) Nbins = 10 bbs = n.empty((len(bins)-1, Nbins+1)) N = n.empty((len(bins)-1, Nbins)) for ii in range(len(bins)-1): sel = (hd['DF']>bins[ii]) & (hd['DF']<bins[ii+1]) y = hd['Vmax'][sel] vmaxBar[ii], vmaxStd[ii], distrib[ii] = n.mean(y), n.std(y), sc(y,pcs) N[ii],bbs[ii] = n.histogram(y, bins= Nbins ) ok = (vmaxBar>0)&(vmaxStd>0)&(bins[1:]>0.4)&(bins[:-1]<100)&(N.sum(axis=1)>100) x = n.log10(1.+(bins[1:]*bins[:-1])**0.5)[ok] y = n.log10(vmaxBar)[ok] yerr = vmaxStd[ok] / vmaxBar[ok] f= lambda x,a,b : a*x+b out, cov = curve_fit(f, x, y, (1,0), yerr ) p.figure(0) p.plot(n.log10(1+hd['DF']), n.log10(hd['Vmax']),'r.',alpha=0.1, label='QSO z=0.7',rasterized = True) p.errorbar(x,y,yerr=yerr/2.,label='mean - std') p.plot(x, f(x,out[0],out[1]),'k--',lw=2,label='fit y='+str(n.round(out[0],3))+'x+'+str(n.round(out[1],3))) p.xlabel(r'$log_{10}(1+\delta)$')
################################################# ################################################# # for each bin in delta compute vmax mean and its std pcs = [0, 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 99, 100] bins = n.hstack((0, n.logspace(-3, 4, 60))) vmaxBar = n.empty(len(bins) - 1) vmaxStd = n.empty(len(bins) - 1) distrib = n.empty((len(bins) - 1, len(pcs))) Nbins = 10 bbs = n.empty((len(bins) - 1, Nbins + 1)) N = n.empty((len(bins) - 1, Nbins)) for ii in range(len(bins) - 1): sel = (hd['DF'] > bins[ii]) & (hd['DF'] < bins[ii + 1]) y = hd['Vmax'][sel] vmaxBar[ii], vmaxStd[ii], distrib[ii] = n.mean(y), n.std(y), sc(y, pcs) N[ii], bbs[ii] = n.histogram(y, bins=Nbins) ok = (vmaxBar > 0) & (vmaxStd > 0) & (bins[1:] > 0.4) & (bins[:-1] < 100) & ( N.sum(axis=1) > 100) x = n.log10(1. + (bins[1:] * bins[:-1])**0.5)[ok] y = n.log10(vmaxBar)[ok] yerr = vmaxStd[ok] / vmaxBar[ok] f = lambda x, a, b: a * x + b out, cov = curve_fit(f, x, y, (1, 0), yerr) p.figure(0) p.plot(n.log10(1 + hd['DF']), n.log10(hd['Vmax']), 'r.',
dex02 = (dex04) & (-n.log10(catalog[prefix + 'stellar_mass_low_1sig']) + n.log10(catalog[prefix + 'stellar_mass_up_1sig']) < 0.4) #target_bits program_names = n.array(list(set(catalog['PROGRAMNAME']))) program_names.sort() sourcetypes = n.array(list(set(catalog['SOURCETYPE']))) sourcetypes.sort() length = lambda selection: len(selection.nonzero()[0]) pcs_ref = list(n.arange(0., 101, 5)) g = lambda key, s1, pcs=pcs_ref: n.hstack( (length(s1), sc(catalog[key][s1], pcs))) sel_pg = lambda pgr: (catalog_zOk) & (catalog['PROGRAMNAME'] == pgr) sel_st = lambda pgr: (catalog_zOk) & (catalog['SOURCETYPE'] == pgr) sel0_pg = lambda pgr: (catalog_0) & (catalog['PROGRAMNAME'] == pgr) sel0_st = lambda pgr: (catalog_0) & (catalog['SOURCETYPE'] == pgr) all_galaxies = [] tpps = [] for pg in sourcetypes: sel_all = sel_st(pg)
delta_i = catalog['fiberMag_i'] - catalog['modelMag_i'] delta_m = n.array([delta_g, delta_r, delta_i]) #target_bits program_names = n.array(list(set(catalog['PROGRAMNAME']))) program_names.sort() sourcetypes = n.array(list(set(catalog['SOURCETYPE']))) sourcetypes.sort() length = lambda selection: len(selection.nonzero()[0]) pcs_ref = n.arange(0., 101, 5) g = lambda key, s1, pcs=pcs_ref: n.hstack( (length(s1), sc(catalog[key][s1], pcs))) sel_pg = lambda pgr: (catalog_zOk) & (catalog['PROGRAMNAME'] == pgr) sel_st = lambda pgr: (catalog_zOk) & (catalog['SOURCETYPE'] == pgr) sel0_pg = lambda pgr: (catalog_0) & (catalog['PROGRAMNAME'] == pgr) sel0_st = lambda pgr: (catalog_0) & (catalog['SOURCETYPE'] == pgr) all_galaxies = [] tpps = [] for pg in sourcetypes: print(pg)
dex04 = (converged) & (catalog[prefix+'stellar_mass'] < 10**14. ) & (catalog[prefix+'stellar_mass'] > 0 ) & (catalog[prefix+'stellar_mass'] > catalog[prefix+'stellar_mass_low_1sig'] ) & (catalog[prefix+'stellar_mass'] < catalog[prefix+'stellar_mass_up_1sig'] ) & ( - n.log10(catalog[prefix+'stellar_mass_low_1sig']) + n.log10(catalog[prefix+'stellar_mass_up_1sig']) < 0.8 ) dex02 = (dex04) & ( - n.log10(catalog[prefix+'stellar_mass_low_1sig']) + n.log10(catalog[prefix+'stellar_mass_up_1sig']) < 0.4 ) #target_bits program_names = n.array(list(set( catalog['PROGRAMNAME'] ))) program_names.sort() sourcetypes = n.array(list(set( catalog['SOURCETYPE'] ))) sourcetypes.sort() length = lambda selection : len(selection.nonzero()[0]) g = lambda key, s1, pcs = n.array([10., 25., 50., 75., 90. ]) : n.hstack(( length(s1), sc(catalog[key][s1], pcs) )) sel_pg = lambda pgr : (catalog_zOk) & (catalog['PROGRAMNAME']==pgr) sel_st = lambda pgr : (catalog_zOk) & (catalog['SOURCETYPE']==pgr) sel0_pg = lambda pgr : (catalog_0) & (catalog['PROGRAMNAME']==pgr) sel0_st = lambda pgr : (catalog_0) & (catalog['SOURCETYPE']==pgr) all_galaxies = [] tpps = [] for pg in sourcetypes: n_targets = length( (catalog['SOURCETYPE']==pg))