def calc_M_nu_sig_disc(): import physics_disc as phys gp.nu1_x = phys.nu(gp.parst.nu1) # gp.nu1_x = phys.nu_decrease(gp.xipol,gp.xipol,gp.parst.nu1) gp.d1_x = phys.delta(gp.parst.delta1) gp.dens_x = phys.dens(gp.xipol, gp.parst.dens) # means Kz, *not* surface density # gp.dens_x = gp.parst.dens+gp.blow # Kzpars with baryonic lower limit gp.M_x = phys.Sigmaz(gp.dens_x) # gp.M_x = phys.kz(gp.xipol, gp.xipol, gp.dens_x, gp.blow) # from kz, added baryons min # TODO: marginalise over lower bound, see gl_priors, kappa_DM < 0 # attention: gives sometimes unphysical decreasing surface density gp.blow = gp.dat.Mdat # npr.normal(gp.dat.Mdat,gp.dat.Merr/4.,gp.nipol) # TODO: naming Rsun = 8000.; hr = 3.0; hsig = 3.0 gp.sig1_x = phys.sigmaz(gp.xipol, gp.dens_x, gp.nu1_x, gp.parst.norm1,\ gp.parst.delta1, [Rsun,hr,hsig]) gp.kap1_x = gp.xipol*0. # set to 0 consistently if gp.pops == 2: gp.nu2_x = phys.nu(gp.parst.nu2) # gp.nu2_x = phys.nu_decrease(gp.xipol,gp.xipol,gp.parst.nu2) gp.d2_x = phys.delta(gp.parst.delta2) gp.sig2_x = phys.sigmaz(gp.xipol, gp.dens_x, gp.nu2_x, gp.parst.norm2,\ gp.parst.delta2, [Rsun,hr,hsig]) gp.kap2_x = gp.xipol*0. if gp.checkint: gp.nu1_x = gp.ipol.nudat1 Rsun = 8.; hr = 3.0; hsig = 3.0 # ^--- irrelevant, as long as gp.deltaprior = True gp.parst.norm1 = 17.**2 gp.sig1_x = phys.sigmaz(gp.xipol, gp.ipol.densdat, gp.blow,\ gp.ipol.nudat1,gp.parst.norm1,gp.parst.delta1,\ [Rsun,hr,hsig]) gp.kap1_x = gp.xipol*0. return
def calc_M_nu_sig_kap_sphere(): import physics_sphere as phys if not gp.checkint: '''normal case''' gp.nu1_x = phys.nu(gp.parst.nu1) # [munit/pc^3] gp.dens_x = phys.dens(gp.xipol, gp.parst.dens) # [munit/pc^3] gp.M_x = rho_SUM_Mr(gp.xipol, gp.dens_x) # [munit,3D] gp.d1_x = phys.delta(gp.parst.delta1) # pdb.set_trace() # TODO: introduce error in dens, nu, d1 here, for weights in splrep gp.sig1_x, gp.kap1_x = phys.sig_kap_los(gp.dens_x, gp.nu1_x, gp.d1_x) if gp.pops == 2: gp.nu2_x = phys.nu(gp.parst.nu2) gp.d2_x = phys.delta(gp.parst.delta2) gp.sig2_x, gp.kap2_x = phys.sig_kap_los(gp.dens_x, gp.nu2_x, gp.d2_x) # to debug almost fitting curves: # if gp.chi2 < 60: # pdb.set_trace() else: 'checkint: check integration routines for sigma, kappa' if gp.investigate == 'hernquist': ### set nu to data, or analytic value gp.nu1_x = gp.ipol.nudat1 # [Msun/pc^3] if gp.analytic: gp.nu1_x = rho_anf(gp.xipol) # [Msun/pc^3] # set dens gp.dens_x = rho_anf(gp.xipol) # [Msun/pc^3] # attention: same as gp.nu1_x in this case! # fine if potential comes from 'tracers' only gp.M_x = M_anf(gp.xipol) # [Msun] gp.d1_x = np.zeros(gp.nipol) # [1] print('set nu, dens, M, delta to analytic') gp.sig1_x, gp.kap1_x = phys.sig_kap_los(gp.dens_x, gp.nu1_x, gp.d1_x) # still checkint, but for walker now elif gp.investigate == 'walker': rhodm, rhostar1, rhostar2 = rhowalker_3D(gp.xipol) gp.nu1_x = rhostar1 if gp.pops == 2: gp.nu2_x = rhostar2 # gp.ipol.nudat2 # data gp.dens_x = rhowalkertot_3D(gp.xipol) # [msun/pc^3] gp.M_x = Mwalkertot(gp.xipol) # should really be this thing here! # gp.M_x = rho_SUM_Mr(gp.ipol.Mx, gp.dens_x) # [msun] # gp.M_x = rho_SUM_Mr(gp.ipol.binmax, gp.dens_x) # [msun] gp.d1_x = walker_delta(1) # [1], actual delta if gp.pops == 2: gp.d2_x = walker_delta(2) # [1] # set sigma_LOS, by calculating expected values # for both (spherical) cases simultaneously gp.sig1_x,gp.kap1_x = phys.sig_kap_los(gp.dens_x, gp.nu1_x, \ gp.d1_x) # [km/s], [1] # takes [munit, 3D], [munit/pc^3], [1] # normalization of nu does not matter, is divided out if gp.pops == 2: gp.sig2_x, gp.kap2_x = phys.sig_kap_los(gp.dens_x,gp.nu2_x,\ gp.d2_x) # [km/s], [1] return