コード例 #1
0
def aplold(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b0dt91 = par.b0dt91
    c = par.c

    Rskpc = par.Rskpc
    Rs = Rskpc * par.kpctom
    Vs = par.Vs
    Vsms = 1000.0 * Vs

    l = ldeg * par.degtorad
    b = bdeg * par.degtorad

    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    be = (dkpc / Rskpc) * math.cos(b) - math.cos(l)
    t0 = math.sin(l) * math.sin(l) + be * be

    vp = Vs + b0dt91 * (Rpkpc - Rskpc)  # in km s^-1

    vp_rat_square = (vp * vp) / (Vs * Vs)

    t2 = (-1.0) * (math.cos(l) + vp_rat_square * (be / t0))  #dimensionless

    t3 = (Vsms * Vsms) / (Rs)  #in SI

    adr = t2 * t3  #m sec^-2 (divide by c to get in s^-1)
    adrc = adr / c  #sec^-1
    return adrc
コード例 #2
0
ファイル: galpyMWpl.py プロジェクト: pathakdhruv/GalDynPsr
def MWpl(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b = bdeg * par.degtorad
    l = ldeg * par.degtorad
    c = par.c
    Rskpc = par.Rskpc
    kpctom = par.kpctom
    Vs = par.Vs
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)

    Vprat = VpratioMW(Rpkpc)
    Vp = Vprat * Vs

    zkpc = dkpc * math.sin(b)

    Vsms = 1000.0 * Vs  #m/s
    Rs = Rskpc * kpctom
    be = (dkpc / Rskpc) * math.cos(b) - math.cos(l)
    t0 = math.sin(l) * math.sin(l) + be * be

    t2 = (-1.0) * (math.cos(l) + Vprat * Vprat * (be / t0))  #dimensionless
    t3 = (Vsms * Vsms) / (Rs)  #in SI
    adr = t2 * t3 * math.cos(b)  #m sec^-2 (divide by c to get in s^-1)
    Excpl = adr / c  #sec^-1
    return Excpl
コード例 #3
0
def aplmod(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b0reid14 = par.b0reid14
    c = par.c

    Rskpc = par.Rskpc
    Rs = Rskpc * par.kpctom
    Vs = par.Vs
    Vsms = 1000.0 * Vs

    l = ldeg * par.degtorad
    b = bdeg * par.degtorad

    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    be = (dkpc / Rskpc) * math.cos(b) - math.cos(l)
    t0 = math.sin(l) * math.sin(l) + be * be

    Vpratio = Vprat(Rpkpc)
    vp_rat_square = Vpratio * Vpratio

    t2 = (-1.0) * (math.cos(l) + vp_rat_square * (be / t0))  #dimensionless

    t3 = (Vsms * Vsms) / (Rs)  #in SI

    adr = t2 * t3  #m sec^-2 (divide by c to get in s^-1)
    adrc = adr / c  #sec^-1
    return adrc
コード例 #4
0
def MWBHZfo(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b = bdeg * par.degtorad
    l = ldeg * par.degtorad
    Rskpc = par.Rskpc
    Vs = par.Vs
    conversion = par.conversion
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    zkpc = dkpc * math.sin(b)
    '''
    bp= PowerSphericalPotentialwCutoff(alpha=1.8,rc=1.9/8.,normalize=0.05)
    mp= MiyamotoNagaiPotential(a=3./8.,b=0.28/8.,normalize=.6)
    np= NFWPotential(a=16./8.,normalize=.35)
    kp = KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(par.Vs,par.Rskpc))
    MWBH = [bp,mp,np,kp]
    zf1 = evaluatezforces(MWBH, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)
    '''
    MWPotential2014wBH = [
        MWPotential2014,
        KeplerPotential(amp=4 * 10**6. /
                        bovy_conversion.mass_in_msol(par.Vs, par.Rskpc))
    ]
    zf1 = evaluatezforces(MWPotential2014wBH, Rpkpc / Rskpc, zkpc /
                          Rskpc) * bovy_conversion.force_in_kmsMyr(Vs, Rskpc)
    #MWPotential2014.append(KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(Vs,Rskpc)))
    #zf1 = evaluatezforces(MWPotential2014, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)

    Excz = zf1 * conversion * math.sin(b)  #s-1
    return Excz
コード例 #5
0
ファイル: galpyMWZfo.py プロジェクト: pathakdhruv/GalDynPsr
def MWZfo(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b = bdeg*par.degtorad
    l = ldeg*par.degtorad
    Rskpc = par.Rskpc
    Vs = par.Vs
    conversion = par.conversion
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    zkpc = dkpc*math.sin(b)

    zf1 = evaluatezforces(MWPotential2014, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)
    Excz = zf1*conversion*math.sin(b)#s-1
    return Excz;
コード例 #6
0
def MWBHRfo(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b = bdeg * par.degtorad
    l = ldeg * par.degtorad
    Rskpc = par.Rskpc
    Vs = par.Vs
    conversion = par.conversion
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    zkpc = dkpc * math.sin(b)
    be = (dkpc / Rskpc) * math.cos(b) - math.cos(l)
    coslam = be * (Rskpc / Rpkpc)
    '''
    bp= PowerSphericalPotentialwCutoff(alpha=1.8,rc=1.9/8.,normalize=0.05)
    mp= MiyamotoNagaiPotential(a=3./8.,b=0.28/8.,normalize=.6)
    np= NFWPotential(a=16./8.,normalize=.35)
    kp = KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(par.Vs,par.Rskpc))
    MWBH = [bp,mp,np,kp]

    rforce1 = evaluateRforces(MWBH, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)

    rfsun = evaluateRforces(MWBH, Rskpc/Rskpc,0.0/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)
    '''

    #MWPotential2014.append(KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(Vs,Rskpc)))

    #rforce1 = evaluateRforces(MWPotential2014, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)

    #rfsun = evaluateRforces(MWPotential2014, Rskpc/Rskpc,0.0/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc)

    MWPotential2014wBH = [
        MWPotential2014,
        KeplerPotential(amp=4 * 10**6. /
                        bovy_conversion.mass_in_msol(par.Vs, par.Rskpc))
    ]
    rforce1 = evaluateRforces(MWPotential2014wBH, Rpkpc / Rskpc,
                              zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr(
                                  Vs, Rskpc)

    rfsun = evaluateRforces(MWPotential2014wBH, Rskpc / Rskpc,
                            0.0 / Rskpc) * bovy_conversion.force_in_kmsMyr(
                                Vs, Rskpc)

    #rf = (rforce1-rfsun)*conversion*math.cos(b) # s-1
    rf0 = rforce1 * coslam + rfsun * math.cos(l)
    rf = rf0 * conversion * math.cos(b)  # s-1
    return rf
コード例 #7
0
ファイル: galpyMWRfo.py プロジェクト: pathakdhruv/GalDynPsr
def MWRfo(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    b = bdeg * par.degtorad
    l = ldeg * par.degtorad
    Rskpc = par.Rskpc
    Vs = par.Vs
    conversion = par.conversion
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    zkpc = dkpc * math.sin(b)
    be = (dkpc / Rskpc) * math.cos(b) - math.cos(l)
    coslam = be * (Rskpc / Rpkpc)

    rforce1 = evaluateRforces(MWPotential2014, Rpkpc / Rskpc,
                              zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr(
                                  Vs, Rskpc)

    rfsun = evaluateRforces(MWPotential2014, Rskpc / Rskpc,
                            0.0 / Rskpc) * bovy_conversion.force_in_kmsMyr(
                                Vs, Rskpc)

    rf0 = rforce1 * coslam + rfsun * math.cos(l)
    rf = rf0 * conversion * math.cos(b)  # s-1
    return rf
コード例 #8
0
def err_DT91(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    sigVs = par.sigVs * 1000.0  #SI
    sigRs = par.sigRs * par.kpctom  #SI
    sigb0dt = par.sigb0dt  #Dimensionless
    b0dt91 = par.b0dt91  #Dimensionless
    c = par.c
    Rskpc = par.Rskpc
    Rs = Rskpc * par.kpctom  #SI
    Vs = par.Vs
    Vsms = 1000.0 * Vs  #SI
    b = bdeg * par.degtorad
    l = ldeg * par.degtorad
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    Vp = Vs * (1.0 - b0dt91 * (Rpkpc - Rskpc) / Rskpc)  # in km s^-1
    Vpms = 1000.0 * Vp  #SI
    Rp = Rpkpc * par.kpctom  #SI
    d = dkpc * par.kpctom  #SI
    beta = (dkpc * math.cos(b) / Rskpc) - math.cos(l)
    t0 = math.sin(l) * math.sin(l) + beta * beta

    def betabyd():
        a = math.cos(b) / Rs
        return a

    def betabyb():
        a = -d * math.sin(b) / Rs
        return a

    def betabyl():
        a = math.sin(l)
        return a

    def betabyRs():
        a = -d * math.cos(b) / (Rs * Rs)
        return a

    def Rpbyd():
        a = (Rs * beta * betabyd()) / pow(t0, 0.5)
        return a

    def Rpbyb():
        a = (Rs * beta * betabyb()) / pow(t0, 0.5)
        return a

    def Rpbyl():
        a = (Rs *
             (math.sin(l) * math.cos(l) + beta * betabyl())) / pow(t0, 0.5)
        return a

    def RpbyRs():
        a = pow(t0, 0.5) + (Rs * beta * betabyRs()) / pow(t0, 0.5)
        return a

    def Vpbyb():
        a = -(Vsms / Rs) * b0dt91 * Rpbyb()
        return a

    def Vpbyl():
        a = -(Vsms / Rs) * b0dt91 * Rpbyl()
        return a

    def Vpbyd():
        a = -(Vsms / Rs) * b0dt91 * Rpbyd()
        return a

    def VpbyRs():
        a = (Vsms * b0dt91 * Rp /
             (Rs * Rs)) - ((Vsms / Rs) * b0dt91 * RpbyRs())
        return a

    def VpbyVs():
        a = 1.0 - b0dt91 * (Rp - Rs) / Rs
        return a

    def Vpbyb0dt():
        a = -Vsms * (Rp - Rs) / Rs
        return a

    def diffbyb():
        term1 = math.cos(l) * math.sin(b) * Vsms * Vsms / (c * Rs)
        term2 = math.sin(b) * beta * Vpms * Vpms / (c * Rs * t0)
        term3 = -math.cos(b) * Vpms * Vpms * betabyb() / (c * Rs * t0)
        term4 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyb() / (
            c * Rs * t0 * t0)
        term5 = -2.0 * math.cos(b) * beta * Vpms * Vpbyb() / (c * Rs * t0)
        a = term1 + term2 + term3 + term4 + term5
        return a

    def diffbyl():
        term1 = math.sin(l) * math.cos(b) * Vsms * Vsms / (c * Rs)
        term2 = -math.cos(b) * Vpms * Vpms * betabyl() / (c * Rs * t0)
        term3 = -2.0 * math.cos(b) * beta * Vpms * Vpbyl() / (c * Rs * t0)
        t4a = math.sin(l) * math.cos(l)
        t4b = beta * betabyl()
        term4 = 2.0 * math.cos(b) * beta * Vpms * Vpms * (t4a + t4b) / (
            c * Rs * t0 * t0)
        a = term1 + term2 + term3 + term4
        return a

    def diffbyd():
        term1 = -math.cos(b) * Vpms * Vpms * betabyd() / (c * Rs * t0)
        term2 = -2.0 * math.cos(b) * beta * Vpms * Vpbyd() / (c * Rs * t0)
        term3 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyd() / (
            c * Rs * t0 * t0)
        a = term1 + term2 + term3
        return a

    def diffbyRs():
        term1 = math.cos(l) * math.cos(b) * Vsms * Vsms / (c * Rs * Rs)
        term2 = math.cos(b) * beta * Vpms * Vpms / (c * Rs * Rs * t0)
        term3 = -math.cos(b) * Vpms * Vpms * betabyRs() / (c * Rs * t0)
        term4 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyRs() / (
            c * Rs * t0 * t0)
        term5 = -2.0 * math.cos(b) * beta * Vpms * VpbyRs() / (c * Rs * t0)
        a = term1 + term2 + term3 + term4 + term5
        return a

    def diffbyVs():
        term1 = -2.0 * math.cos(b) * math.cos(l) * Vsms / (c * Rs)
        term2 = -2.0 * math.cos(b) * beta * Vpms * VpbyVs() / (c * Rs * t0)
        a = term1 + term2
        return a

    def diffbyb0dt():
        a = -2.0 * math.cos(b) * beta * Vpms * Vpbyb0dt() / (c * Rs * t0)
        return a

    err_plsq = pow(diffbyb(), 2.0) * pow(sigb, 2.0) + pow(diffbyl(
    ), 2.0) * pow(sigl, 2.0) + pow(diffbyd(), 2.0) * pow(sigd, 2.0) + pow(
        diffbyVs(), 2.0) * pow(sigVs, 2.0) + pow(diffbyRs(), 2.0) * pow(
            sigRs, 2.0) + pow(diffbyb0dt(), 2.0) * pow(sigb0dt, 2.0)

    err_pl = pow(err_plsq, 0.5)
    return err_pl
コード例 #9
0
def err_Reid14(ldeg, sigl, bdeg, sigb, dkpc, sigd):

    sigVs = par.sigVs * 1000.0  #SI
    sigRs = par.sigRs * par.kpctom  #SI
    sigb0r = par.sigb0r * 1000.0 / par.kpctom  #SI

    b0reid14 = par.b0reid14 * 1000.0 / par.kpctom  #SI
    c = par.c
    Rskpc = par.Rskpc
    Rs = Rskpc * par.kpctom  #SI
    Vs = par.Vs
    Vsms = 1000.0 * Vs  #SI
    b = bdeg * par.degtorad
    l = ldeg * par.degtorad
    Rpkpc = par.Rpkpc(ldeg, sigl, bdeg, sigb, dkpc, sigd)
    Vp = Vs + par.b0reid14 * (Rpkpc - Rskpc)  # in km s^-1
    Vpms = 1000.0 * Vp  #SI
    Rp = Rpkpc * par.kpctom  #SI
    d = dkpc * par.kpctom  #SI
    beta = (dkpc * math.cos(b) / Rskpc) - math.cos(l)
    t0 = math.sin(l) * math.sin(l) + beta * beta

    def betabyd():
        a = math.cos(b) / Rs
        return a

    def betabyb():
        a = -d * math.sin(b) / Rs
        return a

    def betabyl():
        a = math.sin(l)
        return a

    def betabyRs():
        a = -d * math.cos(b) / (Rs * Rs)
        return a

    def Rpbyd():
        a = (Rs * beta * betabyd()) / pow(t0, 0.5)
        return a

    def Rpbyb():
        a = (Rs * beta * betabyb()) / pow(t0, 0.5)
        return a

    def Rpbyl():
        a = (Rs *
             (math.sin(l) * math.cos(l) + beta * betabyl())) / pow(t0, 0.5)
        return a

    def RpbyRs():
        a = pow(t0, 0.5) + (Rs * beta * betabyRs()) / pow(t0, 0.5)
        return a

    def Vpbyd():
        a = b0reid14 * Rpbyd()
        return a

    def Vpbyb():
        a = b0reid14 * Rpbyb()
        return a

    def Vpbyl():
        a = b0reid14 * Rpbyl()
        return a

    def VpbyRs():
        a = b0reid14 * (RpbyRs() - 1.0)
        return a

    def VpbyVs():
        a = 1.0
        return a

    def Vpbyb0reid():
        a = Rp - Rs
        return a

    def diffbyb():
        term1 = math.cos(l) * math.sin(b) * Vsms * Vsms / (c * Rs)
        term2 = math.sin(b) * beta * Vpms * Vpms / (c * Rs * t0)
        term3 = -math.cos(b) * Vpms * Vpms * betabyb() / (c * Rs * t0)
        term4 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyb() / (
            c * Rs * t0 * t0)
        term5 = -2.0 * math.cos(b) * beta * Vpms * Vpbyb() / (c * Rs * t0)
        a = term1 + term2 + term3 + term4 + term5
        return a

    def diffbyl():
        term1 = math.sin(l) * math.cos(b) * Vsms * Vsms / (c * Rs)
        term2 = -math.cos(b) * Vpms * Vpms * betabyl() / (c * Rs * t0)
        term3 = -2.0 * math.cos(b) * beta * Vpms * Vpbyl() / (c * Rs * t0)
        t4a = math.sin(l) * math.cos(l)
        t4b = beta * betabyl()
        term4 = 2.0 * math.cos(b) * beta * Vpms * Vpms * (t4a + t4b) / (
            c * Rs * t0 * t0)
        a = term1 + term2 + term3 + term4
        return a

    def diffbyd():
        term1 = -math.cos(b) * Vpms * Vpms * betabyd() / (c * Rs * t0)
        term2 = -2.0 * math.cos(b) * beta * Vpms * Vpbyd() / (c * Rs * t0)
        term3 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyd() / (
            c * Rs * t0 * t0)
        a = term1 + term2 + term3
        return a

    def diffbyRs():
        term1 = math.cos(l) * math.cos(b) * Vsms * Vsms / (c * Rs * Rs)
        term2 = math.cos(b) * beta * Vpms * Vpms / (c * Rs * Rs * t0)
        term3 = -math.cos(b) * Vpms * Vpms * betabyRs() / (c * Rs * t0)
        term4 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyRs() / (
            c * Rs * t0 * t0)
        term5 = -2.0 * math.cos(b) * beta * Vpms * VpbyRs() / (c * Rs * t0)
        a = term1 + term2 + term3 + term4 + term5
        return a

    def diffbyVs():
        term1 = -2.0 * math.cos(b) * math.cos(l) * Vsms / (c * Rs)
        term2 = -2.0 * math.cos(b) * beta * Vpms * VpbyVs() / (c * Rs * t0)
        a = term1 + term2
        return a

    def diffbyb0reid():
        a = -2.0 * math.cos(b) * beta * Vpms * Vpbyb0reid() / (c * Rs * t0)
        return a

    err_plsq = pow(diffbyb(), 2.0) * pow(sigb, 2.0) + pow(diffbyl(
    ), 2.0) * pow(sigl, 2.0) + pow(diffbyd(), 2.0) * pow(sigd, 2.0) + pow(
        diffbyVs(), 2.0) * pow(sigVs, 2.0) + pow(diffbyRs(), 2.0) * pow(
            sigRs, 2.0) + pow(diffbyb0reid(), 2.0) * pow(sigb0r, 2.0)

    err_pl = pow(err_plsq, 0.5)
    return err_pl