Пример #1
0
import os

if __name__ == '__main__':
    t = Table.read(sys.argv[1])
    if 'Dec' in t.colnames:
        t['Dec'].name = 'DEC'
    outfilename = sys.argv[1].replace('.fits', '-list.txt')
    if not (os.path.isfile(outfilename)):
        startpoint = 0
        outfile = open(outfilename, 'w')
    else:
        startpoint = len(open(outfilename).readlines())
        outfile = open(outfilename, 'a')

    lm = LofarMaps(stay_in_imagedir=True)

    # now work in downloads dir
    os.chdir('downloads')

    for r in t[startpoint:]:
        print r['Source_Name']
        print r['RA'], r['DEC']
        lofarname = lm.find(r['RA'], r['DEC'])
        legacyname = get_legacy(r['RA'], r['DEC'], bands='zrg')
        #wisename=get_wise(r['RA'],r['DEC'],1)
        #firstname=get_first(r['RA'],r['DEC'])
        print >> outfile, r[
            'Source_Name'], lofarname, legacyname  #,wisename,firstname

    outfile.close()
Пример #2
0
        record = sql.get_object(sourcename, create=True)
        if 'legacyfile' in record and record['legacyfile'] is not None:
            continue
        if sourcename not in s.sd:
            print('Skipping source', sourcename, 'with no record')
            continue
        if 'RA' not in s.sd[sourcename]:
            print('Skipping source', sourcename,
                  'with no RA in record: record follows')
            print(s.sd[sourcename])
            continue
        ra = s.sd[sourcename]['RA']
        dec = s.sd[sourcename]['DEC']
        record['lofarfile'] = lm.find(ra, dec)
        try:
            record['legacyfile'] = get_legacy(ra, dec, bands='zrg')
        except RuntimeError as e:  # assume catching a 500 here
            if '500' in e.args[0]:
                print('Caught a 500, no image!')
                record['legacyfile'] = None
            else:
                raise
        wisename = w.find_pos(ra, dec)
        if wisename is None:
            wisename = get_wise(ra, dec, 1)
        record['wisefile'] = wisename
        sql.set_object(sourcename, record)

    # back to zoom dir
    os.chdir(wd)
Пример #3
0
    wisefiles={}
    w=WISE()
    if not os.path.isfile('blend-list.txt'):
        outfile=open('blend-list.txt','w')
        # now work in downloads dir
        wd=os.getcwd() # the zoom directory
        lm=LofarMaps(stay_in_imagedir=True)
        os.chdir('downloads')

        print('Making images')
        for r in t:
            sourcename=r['Source_Name']
            ra=r['RA']
            dec=r['Dec']
            lofarfiles[sourcename]=os.environ['IMAGEDIR']+'/'+lm.find(ra,dec)
            legacyfiles[sourcename]=os.environ['IMAGEDIR']+'/downloads/'+get_legacy(ra,dec,bands='zrg')
            wisename=w.find_pos(ra,dec)
            if wisename is None:
                wisename=get_wise(ra,dec,1)
            wisefiles[sourcename]=os.environ['IMAGEDIR']+'/downloads/'+wisename
            print(sourcename,lofarfiles[sourcename],legacyfiles[sourcename],wisefiles[sourcename],file=outfile)
        outfile.close()
        # back to zoom dir
        os.chdir(wd)
    else:
        lines=open('blend-list.txt').readlines()
        for l in lines:
            bits=l.rstrip().split()
            sourcename=bits[0]
            lofarfiles[sourcename]=bits[1]
            legacyfiles[sourcename]=bits[2]
Пример #4
0
    sourcelist += s.zoomneeded

    # now download any images we need!
    wd = os.getcwd()  # the zoom directory
    lm = LofarMaps(stay_in_imagedir=True)

    # now work in downloads dir
    os.chdir('downloads')

    for sourcename in sourcelist:
        ra = s.sd[sourcename]['RA']
        dec = s.sd[sourcename]['DEC']
        s.sd[sourcename]['lofarfile'] = os.environ['IMAGEDIR'] + '/' + lm.find(
            ra, dec)
        s.sd[sourcename]['legacyfile'] = os.environ[
            'IMAGEDIR'] + '/downloads/' + get_legacy(ra, dec, bands='zrg')
        s.sd[sourcename][
            'wisefile'] = os.environ['IMAGEDIR'] + '/downloads/' + get_wise(
                ra, dec, 1)

    # back to zoom dir
    os.chdir(wd)

    mode = 'wise'
    for sourcename in sourcelist:
        if len(sourcelist) > 1 and os.path.isfile(sourcename + '.txt'):
            print sourcename, 'already has a zoom file'
            continue
        if len(s.get_comps(sourcename)) == 0:
            print sourcename, 'has no components!'
            continue