Ejemplo n.º 1
0
def analytic_betastar(x):
    ba = ga.beta_gaia(x, gp)[0]
    ba = phys.beta2betastar(ba)
    return ba
Ejemplo n.º 2
0
 def set_analytic(self, x0, gp):
     r0 = x0 # [pc], spherical case
     self.analytic.x0 = r0
     anbeta = []; annu = [];  anSig = []
     if gp.investigate == 'gaia':
         anrho = ga.rho_gaia(r0, gp)[0]
         anM = gip.rho_SUM_Mr(r0, anrho)
         annr = ga.nr3Dtot_gaia(r0, gp)
         tmp_annu = ga.rho_gaia(r0, gp)[1]
         annu.append( tmp_annu )
         anSig.append( gip.rho_INT_Sig(r0, tmp_annu, gp) )
         for pop in np.arange(1, gp.pops+1):
             beta = ga.beta_gaia(r0, gp)[pop]
             anbeta.append(beta)
             nu = ga.rho_gaia(r0,gp)[pop]
             annu.append(nu)
             anSig.append(gip.rho_INT_Sig(r0, nu, gp))
     elif gp.investigate == 'walk':
         anrho = ga.rho_walk(r0, gp)[0]
         anM = gip.rho_SUM_Mr(r0, anrho)
         annr = ga.nr3Dtot_deriv_walk(r0, gp) # TODO too high in case of core
         tmp_annu = ga.rho_walk(r0, gp)[1]
         annu.append( tmp_annu )
         anSig.append( gip.rho_INT_Sig(r0, tmp_annu, gp) )
         for pop in np.arange(1, gp.pops+1):
             beta = ga.beta_walk(r0, gp)[pop]
             anbeta.append(beta)
             nu = ga.rho_walk(r0, gp)[pop]
             dum,dum,dum,nudat,nuerr = np.transpose(np.loadtxt(gp.files.nufiles[pop], unpack=False, skiprows=1))
             locrhalf = np.argmin(abs(gp.xipol-gp.Xscale[pop]))
             nuhalf = nudat[locrhalf]*gp.nu0pc[pop]
             annuhalf = nu[np.argmin(abs(r0-locrhalf))]
             annu.append(nu*nuhalf/annuhalf)
             dum,dum,dum,Sigdat,Sigerr = np.transpose(np.loadtxt(gp.files.Sigfiles[pop], unpack=False, skiprows=1))
             locrhalf = np.argmin(abs(gp.xipol-gp.Xscale[pop]))
             Sighalf = Sigdat[locrhalf]*gp.Sig0pc[pop]
             Sig = gip.rho_INT_Sig(r0, nu, gp)
             anSighalf = Sig[np.argmin(abs(r0-locrhalf))]
             anSig.append(Sig*Sighalf/anSighalf)
     elif gp.investigate == 'triax':
         anrho = ga.rho_triax(r0, gp) # one and only
         anM = gip.rho_SUM_Mr(r0, anrho)
         annr = ga.nr3Dtot_deriv_triax(r0, gp)
         tmp_annu = ga.rho_triax(r0, gp) # TODO, M/L=1 assumed here, wrong
         annu.append(tmp_annu)
         anSig.append( gip.rho_INT_Sig(r0, tmp_annu, gp))
         for pop in np.arange(1, gp.pops+1):
             beta = ga.beta_triax(r0)
             anbeta.append(beta)
             nu = ga.rho_triax(r0, gp) # TODO, assumes M/L=1
             annu.append(nu)
             anSig.append( gip.rho_INT_Sig(r0, nu, gp))
     self.analytic.set_prof('rho', anrho, 0, gp)
     self.analytic.set_prof('M', anM, 0, gp)
     self.analytic.set_prof('nr', annr, 0, gp)
     self.analytic.set_prof('nu', annu[0], 0, gp)
     self.analytic.set_prof('nrnu', -gh.derivipol(np.log(annu[0]), np.log(r0)), 0, gp)
     self.analytic.set_prof('Sig', anSig[0], 0, gp)
     for pop in np.arange(1, gp.pops+1):
         self.analytic.set_prof('beta', anbeta[pop-1], pop, gp)
         self.analytic.set_prof('betastar', anbeta[pop-1]/(2.-anbeta[pop-1]), pop, gp)
         self.analytic.set_prof('nu', annu[pop], pop, gp)
         nrnu = -gh.derivipol(np.log(annu[pop]), np.log(r0))
         self.analytic.set_prof('nrnu', nrnu, pop, gp)
         self.analytic.set_prof('Sig', anSig[pop] , pop, gp)#/ Signorm, pop, gp)
         self.analytic.set_prof('sig', -np.ones(len(r0)), pop, gp)
     return
Ejemplo n.º 3
0
def analytic_beta(x, gp):
    #r_a1 = 1000
    # gaia 1 pop
    return ga.beta_gaia(x, gp)[0]