def update(val): w_x = Decimal(sw_x.val).quantize(Decimal('0.1'),rounding=ROUND_DOWN) z = Decimal(int(sz.val)).quantize(Decimal('0.0'),rounding=ROUND_DOWN) eff_f_NL1 = var.f_NL_eff(z, w_x) l.set_xdata(eff_f_NL1) draw()
def gfnl(): gamma = cc.gamma; for j in range(len(cc.w_x)): for i in range(len(cc.z)): fNL = var.f_NL_eff(cc.z[i], cc.w_x[j]); alpha = 1.21 plot(fNL, gamma, '-.o', linewidth = 2, label = "DXT - z: %s, $w_x$: %s" %(cc.z[i], cc.w_x[j])) #plot(fNL, gamma, next(linecycler), linewidth = 2, label = "DXT - z: %s, $w_x$: %s" %(cc.z[i], cc.w_x[j])) #plot(gamma, alpha * gamma, '--', linewidth = 2, label = '$f^{eff}_{NL}$ = 1.2 $\Gamma/H_0$') legend(loc = 'best', prop = {'size':7}) xlabel('$f_{NL}$') ylabel('$\Gamma/H_0$')
def IN_gfnl_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) eff_f_NL0 = var.f_NL_eff(cc.z[0], cc.w_x[0]) l, = plot(eff_f_NL0, cc.gamma, '-.o', linewidth = 2) xlabel('$f^{eff}_{NL}$') ylabel('$\Gamma$/$H_0$') axcolor = 'lightgoldenrodyellow' axz = axes([0.25, 0.05, 0.65, 0.03], axisbg=axcolor) axw_x = axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor) sz = DiscreteSlider(axz,'z', cc.z[0], cc.z[-1], valfmt='%1.1f' , allowed_vals = cc.z, valinit = cc.z[0]) sw_x = DiscreteSlider(axw_x, '$w_x$', cc.w_x[0], cc.w_x[-1], allowed_vals = cc.w_x , valfmt='%1.1f', valinit = cc.w_x[0]) def update(val): w_x = Decimal(sw_x.val).quantize(Decimal('0.1'),rounding=ROUND_DOWN) z = Decimal(int(sz.val)).quantize(Decimal('0.0'),rounding=ROUND_DOWN) eff_f_NL1 = var.f_NL_eff(z, w_x) l.set_xdata(eff_f_NL1) draw() sw_x.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): sw_x.reset() sz.reset() button.on_clicked(reset) show() return