Exemplo n.º 1
0
    # select a volume complete sample of SDSS galaxies down to a given luminosity ()
    Mlim = -17.0; Dmax = 70.
    sdata = sdata[(M_r < Mlim) & (d_A < Dmax)]
    M_rs  = M_r[(M_r < Mlim) & (d_A < Dmax)]
    
    from random import randint
    import numpy as np

    # select a random galaxy from sdata
    iran = randint(0,np.size(sdata)-1)
    randobj = sdata[iran]

    # plot its image and spectrum
    plot_image_spec_sdss_galaxy(randobj)

    # print some key properties from the SDSS catalog
    print "SDSS objID=", randobj['objID']
    print "r-band absolute magnitude, M_r=", M_rs[iran]
    r50s = randobj['petroR50_r']
    print "light concentration in the r-band, c_r=", randobj['petroR90_r']/r50s
    print "fraction of light profile fit by the de Vaucouleurs (spheroidal) component in the r-band, fracdeV_r=",randobj['fracdeV_r']
    sbs = randobj['modelMag_r'] - 2.5*np.log10(0.5) + 2.5*np.log10(np.pi*(r50s)**2)
    print "r-band surface brightness, mu_r=", sbs, " mag/arcsec^2"
    print "r-band axis ratio q=b/a of ellipsoidal fit to light distribution=", randobj['expAB_r']

    import py_compile
    from setup import setup
    py_compile.compile(os.path.join(setup.code_home_dir(),'fetch_sdss_image.py'))
    
    
Exemplo n.º 2
0
            [197.505, 0, 0, 0],
        ],
        'z_uz': [
            [0, 0, 0, 0],
            [0.623441, -0.293199, 0.16293, -0.0134639],
            [-21.567, 5.93194, -1.41235, 0.0714143],
            [82.8481, -0.245694, 0.849976, 0],
            [-185.812, -7.9729, 0, 0],
            [168.691, 0, 0, 0],
        ],
    }

    c = coeff[filter_name + '_' + colour_name.replace(' - ', '')]
    kcor = 0.0

    for x, a in enumerate(c):
        for y, b in enumerate(c[x]):
            kcor += c[x][y] * redshift**x * colour_value**y

    return kcor


if __name__ == "__main__":
    import doctest
    doctest.testmod()

    import py_compile
    from setup import setup
    import os
    py_compile.compile(os.path.join(setup.code_home_dir(), 'calc_kcor.py'))
Exemplo n.º 3
0
        third row: sensitivity to extended source, airmass 1.3
        fourth row: sensitivity to extended source, airmass 0.0
        fifth row: assumed atmospheric extinction, airmass 1.0
    """
    if fname not in 'ugriz':
        raise ValueError("Unrecognized filter name '%s'" % fname)

    data_home = setup.sdss_filter_dir()
    if not os.path.exists(data_home):
        os.makedirs(data_home)

    archive_file = os.path.join(data_home, '%s.dat' % fname)

    if not os.path.exists(archive_file):
        raise ValueError(
            "Error in fetch_sdss_filter: filter file '%s' does not exist!" %
            archive_file)

    F = open(archive_file)

    return np.loadtxt(F, unpack=True)


if __name__ == '__main__':
    for f in 'ugriz':
        fetch_sdss_filters(f)

    import py_compile
    py_compile.compile(
        os.path.join(setup.code_home_dir(), 'fetch_sdss_filters.py'))
Exemplo n.º 4
0
    sdsslist['logMsun'] = np.array(dummy)
    return sdsslist

def alfalfa_sdss_crossmatch(aalist, sdsslist):
    # crossmatch them 
    # match sdsslist to aalist
    imatch = np.in1d(aalist['AGCnr'],sdsslist['AGCnr'])
    # match aalist to sdsslist
    imatch2 = np.in1d(sdsslist['AGCnr'],aalist['AGCnr'])
    aamatch = aalist[imatch]
    sdssmatch = sdsslist[imatch2]
    # carry out some basic  cuts
    aatf = aamatch[aamatch['Dist']>1.0]
    sdsstf = sdssmatch[aamatch['Dist']>1.0]
    aatf = aamatch[aamatch['Dist']<500.0]
    sdsstf = sdssmatch[aamatch['Dist']<500.0]

    aatf = aatf[sdsstf['zsdss']<10.]
    sdsstf = sdsstf[sdsstf['zsdss']<10.]
    aatf = aatf[sdsstf['zsdss']>0.0001]
    sdsstf = sdsstf[sdsstf['zsdss']>0.0001]
    return aatf, sdsstf

if __name__ == '__main__':
    
    import py_compile

    py_compile.compile(os.path.join(setup.code_home_dir(),'read_data.py'))

    sd, md, mnpd, phot_r, mdg, mnpdg, morph = read_meert_catalog(phot_type=3)