示例#1
0
文件: sigp.py 项目: RafiKueng/glass
def sigp(objmodel, lightC, lpars, aperture, beta, alphalim=3.5, interpnts=None, intpnts=None, rspan=None):

    obj, data = objmodel

    arcsec2kpc = convert('arcsec to kpc', 1, obj.dL, data['nu'])

    rho3d(objmodel, alphalim=alphalim, interpnts=interpnts, intpnts=intpnts,rspan=rspan)
    r       = data['rho3d:r'   ]
    rho     = data['rho3d:rho' ]
    drho    = data['rho3d:drho']
    mass3d  = data['rho3d:mass']
    mass2d  = data['M(<R)']
    R       = data['R']['kpc']
    sigma   = data['Sigma(R)']

    aperture_phys = aperture * arcsec2kpc
    lpars_phys    = lpars[:]
    #lpars_phys[1] = lpars_phys[1] * arcsec2kpc

    #print aperture_phys, lpars_phys


    #-------------------------------------------------------------------------
    # Calculate the integral to obtain sigp(r)
    #-------------------------------------------------------------------------
    #units of M=Msun, L=kpc, V=km/s:
    Gsp      = 6.67e-11 * 1.989e30 / 3.086e19
    #light.set_pars(lpars_phys)
    light = lightC(lpars_phys, intpnts)

    sigp = sigpsolve(r,  rho,mass3d, 
                     R,sigma,mass2d,
                     integrator,intpnts,alphalim,Gsp,
                     light,beta)/1000
    sigpsing = sigpsingle(r,sigp,light,aperture_phys,integrator)

    #rhint   = rhoint(imagemin,imagemax,alphalim,r,rho,mass3d,r)

#   sigpa     = sigpsolve(r,rhoa,mass3da,integrator,intpnts,alphalim,Gsp,light,lpars_phys,beta) / 1000
#   sigpsinga = sigpsingle(r,sigpa,light,lpars_phys,aperture_phys,integrator)
#   rhinta   = rhoint(imagemin,imagemax,alphalim,r,rhoa,mass3da,r)
#   drhoa    = dlnrhodlnr(r,rhinta)

    #data['sigp:rhoint'   ] = rhint
    data['sigp:sigp'     ] = sigp
    data['sigp:sigp_sing'] = sigpsing
    data['sigp:scale-factor'] = lpars_phys[1]

#   data['sigp:rhoa'      ] = rhoa
#   data['sigp:rhointa'   ] = rhinta
#   data['sigp:drhoa'     ] = drhoa
#   data['sigp:mass3da'   ] = mass3da
#   data['sigp:sigpa'     ] = sigpa
#   data['sigp:sigp_singa'] = sigpsinga

    #print data['R_phys']
    #print data['sigma_phys']
    #print data['encmass_phys']

    Log( 'Final rms mean projected vel. dispersion: %f' % sigpsing )
示例#2
0
文件: sigp.py 项目: phdenzel/glass
def sigp(objmodel,
         lightC,
         lpars,
         aperture,
         beta,
         alphalim=3.5,
         interpnts=None,
         intpnts=None,
         rspan=None):

    obj, data = objmodel

    arcsec2kpc = convert('arcsec to kpc', 1, obj.dL, data['nu'])

    rho3d(objmodel,
          alphalim=alphalim,
          interpnts=interpnts,
          intpnts=intpnts,
          rspan=rspan)
    r = data['rho3d:r']
    rho = data['rho3d:rho']
    drho = data['rho3d:drho']
    mass3d = data['rho3d:mass']
    mass2d = data['M(<R)']
    R = data['R']['kpc']
    sigma = data['Sigma(R)']

    aperture_phys = aperture * arcsec2kpc
    lpars_phys = lpars[:]
    #lpars_phys[1] = lpars_phys[1] * arcsec2kpc

    #print aperture_phys, lpars_phys

    #-------------------------------------------------------------------------
    # Calculate the integral to obtain sigp(r)
    #-------------------------------------------------------------------------
    #units of M=Msun, L=kpc, V=km/s:
    Gsp = 6.67e-11 * 1.989e30 / 3.086e19
    #light.set_pars(lpars_phys)
    light = lightC(lpars_phys, intpnts)

    sigp = sigpsolve(r, rho, mass3d, R, sigma, mass2d, integrator, intpnts,
                     alphalim, Gsp, light, beta) / 1000
    sigpsing = sigpsingle(r, sigp, light, aperture_phys, integrator)

    #rhint   = rhoint(imagemin,imagemax,alphalim,r,rho,mass3d,r)

    #   sigpa     = sigpsolve(r,rhoa,mass3da,integrator,intpnts,alphalim,Gsp,light,lpars_phys,beta) / 1000
    #   sigpsinga = sigpsingle(r,sigpa,light,lpars_phys,aperture_phys,integrator)
    #   rhinta   = rhoint(imagemin,imagemax,alphalim,r,rhoa,mass3da,r)
    #   drhoa    = dlnrhodlnr(r,rhinta)

    #data['sigp:rhoint'   ] = rhint
    data['sigp:sigp'] = sigp
    data['sigp:sigp_sing'] = sigpsing
    data['sigp:scale-factor'] = lpars_phys[1]

    #   data['sigp:rhoa'      ] = rhoa
    #   data['sigp:rhointa'   ] = rhinta
    #   data['sigp:drhoa'     ] = drhoa
    #   data['sigp:mass3da'   ] = mass3da
    #   data['sigp:sigpa'     ] = sigpa
    #   data['sigp:sigp_singa'] = sigpsinga

    #print data['R_phys']
    #print data['sigma_phys']
    #print data['encmass_phys']

    Log('Final rms mean projected vel. dispersion: %f' % sigpsing)
示例#3
0
import sys
sys.path.append('..')

from spherical_deproject import sigpsingle
from numpy import loadtxt


files = sys.argv[1:]

if not files:
    dir  = '/smaug/data/theorie/justin/Backup/Mylaptop/Scratch/Lensing/Cuspcore/CMerger1'
    files.append(dir + '/cmerger_1_sigpx.txt')

for f in files:
    data = loadtxt(f,
                   dtype = {'names': ('R', 'sigp', 'err'),
                            'formats': ('f8', 'f8', 'f8')})

    import massmodel.hernquist as light
    from scipy.integrate.quadrature import simps as integrator

    intpnts = 100 
    lpars = [1,25,1,intpnts]
    beta = 0
    aperture = 400

    print sigpsingle(data['R'],data['sigp'],light,lpars,aperture,integrator)

示例#4
0
import sys
sys.path.append('..')

from spherical_deproject import sigpsingle
from numpy import loadtxt

files = sys.argv[1:]

if not files:
    dir = '/smaug/data/theorie/justin/Backup/Mylaptop/Scratch/Lensing/Cuspcore/CMerger1'
    files.append(dir + '/cmerger_1_sigpx.txt')

for f in files:
    data = loadtxt(f,
                   dtype={
                       'names': ('R', 'sigp', 'err'),
                       'formats': ('f8', 'f8', 'f8')
                   })

    import massmodel.hernquist as light
    from scipy.integrate.quadrature import simps as integrator

    intpnts = 100
    lpars = [1, 25, 1, intpnts]
    beta = 0
    aperture = 400

    print sigpsingle(data['R'], data['sigp'], light, lpars, aperture,
                     integrator)