def update(val): f_NL = sf_NL.val gamma = Decimal(sgamma.val).quantize(Decimal('0.1'),rounding=ROUND_DOWN) z = Decimal(int(sz.val)).quantize(Decimal('0.0'),rounding=ROUND_DOWN) APg_Delta_m = var.galaxy_angular_power("wcdm_%s-%s-%s" %(cc.w_x, cc.c2_s, z), 1, f_NL, **cosmo) APg_Delta_m11 = var.galaxy_angular_power("gwcdm_%s-%s-%s-%s-%s" %(cc.w_x, cc.c2_s, gamma, cc.Inrct, z), 1, f_NL0, **cosmo) APg_Delta_mt = var.galaxy_angular_power("gwcdm_%s-%s-%s-%s-%s" %(cc.w_x, cc.c2_s, gamma, cc.Inrct, z), 1, f_NL, **cosmo) l.set_ydata(APg_Delta_m0) l1.set_ydata(APg_Delta_m) l2.set_ydata(APg_Delta_m11) l3.set_ydata(APg_Delta_mt) draw()
def AP_g(model, BP, f_NL, **cosmo): AP_Delta_m = var.galaxy_angular_power(model, BP, f_NL, **cosmo) semilogy(cc.l, AP_Delta_m, next(linecycler), linewidth = 2, label = model + " - $f_{NL}: %s$" %f_NL) legend(loc = 'best') xlabel('$l$') ylabel('$l(l+1)/(2\pi) C_l$(a=1)') #---------------------- END ----------------------
def IN_APg_var_plot(): #---------- Cosmo parameters ----------------- cosmo = {'omega_M_0': 0.315, 'omega_b_0': 0.045, 'omega_lambda_0': 1 - 0.315} ax = subplot(111) subplots_adjust(left=0.25, bottom=0.25) f_NL0 = cc.f_NL[0] f_NL1 = cc.f_NL[1] APg_Delta_m0 = var.galaxy_angular_power("wcdm_%s-%s-%s" %(cc.w_x, cc.c2_s, cc.z), 1, f_NL0, **cosmo) APg_Delta_m1 = var.galaxy_angular_power("wcdm_%s-%s-%s" %(cc.w_x, cc.c2_s, cc.z), 1, f_NL1, **cosmo) APg_Delta_m01 = var.galaxy_angular_power("gwcdm_%s-%s-%s-%s-%s" %(cc.w_x, cc.c2_s, cc.gamma, cc.Inrct, cc.z), 1, f_NL0, **cosmo) PPg_Delta_m01 = var.galaxy_angular_power("gwcdm_%s-%s-%s-%s-%s" %(cc.w_x, cc.c2_s, cc.gamma, cc.Inrct, cc.z), 1, f_NL0, **cosmo)[0] # f_NL = linspace(f_NL0, f_NL1, 1000) # for i in range(len(f_NL)): # PPg_Delta_m1 = var.galaxy_angular_power("wcdm_%s-%s-%s" %(cc.w_x, cc.c2_s, cc.z), 1, f_NL[i], **cosmo)[0] # if PPg_Delta_m01 >= PPg_Delta_m1: # f_NL01 = f_NL[i] # else: # exit # print "Effective f_NL: ", f_NL01 l, = semilogy(cc.l, APg_Delta_m0, '-', linewidth = 2)#, label = "wcdm - $f_{NL}$: %s" % cc.f_NL[0] ) l1, = semilogy(cc.l, APg_Delta_m1, '--', linewidth = 2, label = "wcdm - $f_{NL}$") l2, = semilogy(cc.l, APg_Delta_m01, '-.', linewidth = 2, label = "$\Gamma$-wcdm") l3, = semilogy(cc.l, APg_Delta_m01, ':', linewidth = 2, label = "$\Gamma$-wcdm + $f_{NL}$" ) #axvline(x = 0.17 * 10**-2, color='r', ls = '--') # vertical line at k_eq #axvline(x = 0.14 * 10**-1, color='b', ls = '-.') # vertical line at k_eq #xlim((cc.k_min, cc.k_max)) #xlim((10**-3, cc.k_max)) #axvline(x = 10**-3, color='g', ls = '--') # vertical line at k_eq legend(loc = 'best') xlabel('l') ylabel('$l(l+1)/(2\pi) C_l$(a=1)') axcolor = 'lightgoldenrodyellow' axf_NL = axes([0.25, 0.05, 0.65, 0.03], axisbg=axcolor) axgamma = axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor) axz = axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor) sf_NL = Slider(axf_NL, '$f_{NL}$', f_NL0, 10.0, valfmt='%1.3f', valinit = f_NL1) sgamma = Slider(axgamma, '$\Gamma$', 0.0, 1.0, valfmt='%1.1f', valinit = cc.gamma) sz = Slider(axz, '$z$', 0.0, 3.0, valfmt='%1.0f', valinit = cc.z) def update(val): f_NL = sf_NL.val gamma = Decimal(sgamma.val).quantize(Decimal('0.1'),rounding=ROUND_DOWN) z = Decimal(int(sz.val)).quantize(Decimal('0.0'),rounding=ROUND_DOWN) APg_Delta_m = var.galaxy_angular_power("wcdm_%s-%s-%s" %(cc.w_x, cc.c2_s, z), 1, f_NL, **cosmo) APg_Delta_m11 = var.galaxy_angular_power("gwcdm_%s-%s-%s-%s-%s" %(cc.w_x, cc.c2_s, gamma, cc.Inrct, z), 1, f_NL0, **cosmo) APg_Delta_mt = var.galaxy_angular_power("gwcdm_%s-%s-%s-%s-%s" %(cc.w_x, cc.c2_s, gamma, cc.Inrct, z), 1, f_NL, **cosmo) l.set_ydata(APg_Delta_m0) l1.set_ydata(APg_Delta_m) l2.set_ydata(APg_Delta_m11) l3.set_ydata(APg_Delta_mt) draw() sf_NL.on_changed(update) sgamma.on_changed(update) sz.on_changed(update) resetax = axes([0.8, 0.0, 0.1, 0.04]) button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975') def reset(event): sf_NL.reset() sgamma.reset() sz.reset() button.on_clicked(reset) show() return