Exemplo n.º 1
0
def calc_veldist_2d(
    ulinspace,
    vlinspace,
    R=1.0,
    t=-4.0,
    pot="bar",
    beta=0.0,
    potparams=(0.9, 0.01, 25.0 * _degtorad, 0.8, None),
    dfparams=(1.0 / 3.0, 1.0, 0.2),
    dftype="dehnen",
    correct=True,
):
    """
    NAME:
       calc_veldist_2d
    PURPOSE:
       calculate the velocity distribution at a given R on a grid in (u,v)
    INPUT:
       ulinspace, vlinspace - build the grid using scipy's linspace with
                              these arguments
       R - Galactocentric Radius
       t - time to integrate backwards for 
           (interpretation depends on potential)
       pot - type of non-axisymmetric, time-dependent potential
       beta - power-law index of rotation curve
       potparams - parameters for this potential
       dfparams - parameters of the DF (xD,xS,Sro)
       dftype - type of DF ('dehnen' or 'shu')
    OUTPUT:
       f(u,v) on the grid
    HISTORY:
       2010-03-08 - Written - Bovy (NYU)
    """
    us = sc.linspace(*ulinspace)
    vs = sc.linspace(*vlinspace)
    nus = len(us)
    nvs = len(vs)
    out = sc.zeros((nus, nvs))
    if dftype == "dehnen":
        thisDF = dehnenDF
    df = thisDF(profileParams=dfparams, beta=beta, correct=correct, niter=_NCORRECT)
    for ii in range(nus):
        for jj in range(nvs):
            E, L = uvToELz(UV=(-us[ii], vs[jj]), R=R, t=t, pot=pot, potparams=potparams, beta=beta)
            out[ii, jj] = df.eval(E, L)
    return out
Exemplo n.º 2
0
def calc_meanR_2d(
    ulinspace,
    vlinspace,
    R=1.0,
    t=-4.0,
    pot="bar",
    beta=0.0,
    potparams=(0.9, 0.01, 25.0 * _degtorad, 0.8, None),
    correct=True,
    xE=True,
):
    """
    NAME:
       calc_meanR_2d
    PURPOSE:
       calculate the mean-radii distribution at a given R on a grid in (u,v)
    INPUT:
       ulinspace, vlinspace - build the grid using scipy's linspace with
                              these arguments
       R - Galactocentric Radius
       t - time to integrate backwards for 
           (interpretation depends on potential)
       pot - type of non-axisymmetric, time-dependent potential
       beta - power-law index of rotation curve
       potparams - parameters for this potential
       xE - if True, calculate mean radius based on energy, 
            else calculate mean radius based on angular momentum 
            (default: True)
    OUTPUT:
       f(u,v) on the grid
    HISTORY:
       2010-05-03 - Written - Bovy (NYU)
    """
    us = sc.linspace(*ulinspace)
    vs = sc.linspace(*vlinspace)
    nus = len(us)
    nvs = len(vs)
    out = sc.zeros((nus, nvs))
    for ii in range(nus):
        for jj in range(nvs):
            E, L = uvToELz(UV=(-us[ii], vs[jj]), R=R, t=t, pot=pot, potparams=potparams, beta=beta)
            out[ii, jj] = calc_meanR(E, L, beta, xE=xE)
    return out
Exemplo n.º 3
0
def integrandSinAlphaSmall(u,cosalpha,tanalpha,vlos,R,t,potparams,beta,df,
                            pot):
    return df.eval(*uvToELz(UV=(tanalpha*u-vlos/cosalpha,u),R=R,t=t,pot=pot,potparams=potparams,beta=beta))
Exemplo n.º 4
0
        

if __name__ == '__main__':
    print interpret_as_df((0.54636764432720319, 0.99999999999999989),type='dehnen')

    from integrate_orbits import uvToELz
    """
    step=0.1
    EL= uvToELz((0.,0.))
    print "step= ", step
    print "(0,0):",EL, interpret_as_df(EL)

    EL= uvToELz((step,0.))
    print "(1,0):",EL, interpret_as_df(EL)

    EL= uvToELz((0.,step))
    print "(0,1):",EL, interpret_as_df(EL)

    EL= uvToELz((-step,0.))
    print "(-1,0):",EL, interpret_as_df(EL)

    EL= uvToELz((0.,-step))
    print "(0,-1):",EL, interpret_as_df(EL)
    """

    _degtorad= sc.pi/180.
    print interpret_as_df(uvToELz((0,0),potparams=(1.,0.01,25.*_degtorad,.8,None)))
    print interpret_as_df(uvToELz((-.1,-.1),potparams=(1.,0.01,25.*_degtorad,.8,None)))


Exemplo n.º 5
0
def integrandSinAlphaLarge(u,sinalpha,cotalpha,vlos,R,t,potparams,beta,df,pot):
    return df.eval(*uvToELz(UV=(-u,-cotalpha*u+vlos/sinalpha),R=R,t=t,pot=pot,potparams=potparams,beta=beta))