コード例 #1
0
ファイル: read.py プロジェクト: eddienko/SamPy
def GFBasicData(path):
    """
    Reads Rachel's SAMs output data.
    If AB = True then the function converts
    Johnson U, B, V, and K bands to Vega system.

    :note: This is really ineffective way of reading in
           data and should be used only when a rather
           small simulation is being processed.

    :param path: path in which the files are located
    :param AB: whether Johnson U, B, V, and K bands are converted to Vega system or not.

    :type path: string
    :type AB: boolean

    """
    AB = SamPy.astronomy.basics.JohnsonToABmagnitudes()

    print 'Reading files from {0:>s}'.format(path)

    galfile = path + 'galphot.dat'
    galdustfile = path + 'galphotdust.dat'
    profile = path + 'galprop.dat'
    halofile = path + 'halos.dat'

    g = su.se_catalog(galfile)
    gdust = su.se_catalog(galdustfile)
    p = su.se_catalog(profile)
    h = su.se_catalog(halofile)

    print 'Found {0:d} haloes'.format(len(h))
    print 'Found {0:d} galaxies'.format(len(g))

    if AB:
        print 'Coverting Johnson U, B, V, and K bands to vega system'
        g.uj = g.uj - AB['AB_vega_U']
        g.bj = g.bj - AB['AB_vega_B']
        g.vj = g.vj - AB['AB_vega_V']
        g.k = g.k - AB['AB_vega_K']
        #bulge
        g.uj_bulge = g.uj_bulge - AB_vega_U
        g.bj_bulge = g.bj_bulge - AB_vega_B
        g.vj_bulge = g.vj_bulge - AB_vega_V
        g.k_bulge = g.k_bulge - AB_vega_K
        #dusty
        gdust.uj = gdust.uj - AB_vega_U
        gdust.bj = gdust.bj - AB_vega_B
        gdust.vj = gdust.vj - AB_vega_V
        gdust.j = gdust.k - AB_vega_K

    return g, gdust, p, h
コード例 #2
0
ファイル: read.py プロジェクト: RainW7/SamPy
def GFBasicData(path):
    """
    Reads Rachel's SAMs output data.
    If AB = True then the function converts
    Johnson U, B, V, and K bands to Vega system.

    :note: This is really ineffective way of reading in
           data and should be used only when a rather
           small simulation is being processed.

    :param path: path in which the files are located
    :param AB: whether Johnson U, B, V, and K bands are converted to Vega system or not.

    :type path: string
    :type AB: boolean

    """
    AB = SamPy.astronomy.basics.JohnsonToABmagnitudes()

    print 'Reading files from {0:>s}'.format(path)

    galfile = path + 'galphot.dat'
    galdustfile = path + 'galphotdust.dat'
    profile = path + 'galprop.dat'
    halofile = path + 'halos.dat'

    g = su.se_catalog(galfile)
    gdust = su.se_catalog(galdustfile)
    p = su.se_catalog(profile)
    h = su.se_catalog(halofile)

    print 'Found {0:d} haloes'.format(len(h))
    print 'Found {0:d} galaxies'.format(len(g))

    if AB:
        print 'Coverting Johnson U, B, V, and K bands to vega system'
        g.uj = g.uj - AB['AB_vega_U']
        g.bj = g.bj - AB['AB_vega_B']
        g.vj = g.vj - AB['AB_vega_V']
        g.k = g.k - AB['AB_vega_K']
        #bulge
        g.uj_bulge = g.uj_bulge - AB_vega_U
        g.bj_bulge = g.bj_bulge - AB_vega_B
        g.vj_bulge = g.vj_bulge - AB_vega_V
        g.k_bulge = g.k_bulge - AB_vega_K
        #dusty
        gdust.uj = gdust.uj - AB_vega_U
        gdust.bj = gdust.bj - AB_vega_B
        gdust.vj = gdust.vj - AB_vega_V
        gdust.j = gdust.k - AB_vega_K

    return g, gdust, p, h
コード例 #3
0
ファイル: prepareSlitless.py プロジェクト: eddienko/SamPy
def make_ds9_regions_file(inputfile, outputfile,
                          size=10,
                          xcolumn='x_image', ycolumn='y_image'):
    '''
    '''

    data = su.se_catalog(inputfile + '.cat')
    xarray = eval('data.' + xcolumn)
    yarray = eval('data.' + ycolumn)

    out = open(outputfile, 'w')
    for x, y in zip(xarray, yarray):
        circ = 'circle(%f, %f, %f)\n' % (x, y, size)
        out.write(circ)
    out.close()
コード例 #4
0
def make_ds9_regions_file(inputfile,
                          outputfile,
                          size=10,
                          xcolumn='x_image',
                          ycolumn='y_image'):
    '''
    '''

    data = su.se_catalog(inputfile + '.cat')
    xarray = eval('data.' + xcolumn)
    yarray = eval('data.' + ycolumn)

    out = open(outputfile, 'w')
    for x, y in zip(xarray, yarray):
        circ = 'circle(%f, %f, %f)\n' % (x, y, size)
        out.write(circ)
    out.close()