Ejemplo n.º 1
0
    def find(self, ra, dec, offset=4, verbose=False, check_obs=False):
        if check_obs:
            sdb = SurveysDB(readonly=True)

        sc = SkyCoord(ra, dec, unit='deg')
        minoffset = None
        t = self.t
        t['sep'] = sc.separation(t['sc']).value
        tdet = t[t['sep'] <= offset]
        for r in tdet:
            if check_obs:
                sdb.cur.execute('select * from observations where field="%s"' %
                                r['id'])
                count = len(sdb.cur.fetchall())
                sdb.cur.execute(
                    'select * from observations where field="%s" and status="DI_processed"'
                    % r['id'])
                proc_count = len(sdb.cur.fetchall())
            else:
                count = -1
                proc_count = -1
            if verbose:
                print('%-16s %-16s %2i %2i %8.3f %8.3f %6.3f %s' %
                      (r['id'], r['status'], count, proc_count, r['ra'],
                       r['decl'], r['sep'], r['location']))
            if r['status'] == 'Archived':
                if minoffset is None or r['sep'] < minoffset:
                    minoffset = r['sep']
                    bestfield = r
        if check_obs:
            sdb.close()

        if minoffset is None:
            return None
        else:
            return bestfield
Ejemplo n.º 2
0
        print 'Wanting to put pointing %s in mosaic'%p
        
        currentdict = sdb.get_field(p)
        for d in args.directories:
            rd=d+'/'+p
            print rd
            if os.path.isfile(rd+'/image_full_ampphase_di_m.NS_shift.int.facetRestored.fits'):
                mosaicdirs.append(rd)
                break
        else:
            print 'Pointing',p,'not found'
            missingpointing = True
        if not missingpointing and (currentdict['status'] != 'Archived' or currentdict['archive_version'] != 4):
            print 'Pointing',p,'not archived with archive_version 4'
            missingpointing = True
    sdb.close()
    if not(args.no_check) and missingpointing == True:
        raise RuntimeError('Failed to find a required pointing')

    print 'Mosaicing using directories', mosaicdirs

    # now construct the inputs for make_mosaic

    mos_args=dotdict({'save':True, 'load':True,'exact':False,'use_shifted':True,'find_noise':True})
    mos_args.astromap_blank=args.astromap_blank
    mos_args.beamcut=args.beamcut
    mos_args.directories=mosaicdirs

    header,himsize=make_header(maxsep,mospointingname,pointingdict[mospointingname][1],pointingdict[mospointingname][2],1.5,6.0)
    
    mos_args.header=header
Ejemplo n.º 3
0
    'Unpacking': 'orange',
    'Unpacked': 'orange',
    'Ready': 'yellow',
    'Queued': 'blue',
    'Running': 'cyan',
    'Complete': 'green',
    'Archiving': 'green',
    'Archived': 'olive',
    'Stopped': 'magenta',
    'Failed': 'magenta',
    'DI_started': 'white'
}
sdb = SurveysDB(readonly=True)
sdb.cur.execute('select * from fields where status!="Not started"')
fields = sdb.cur.fetchall()
sdb.close()

for f in fields:
    status = f['status']
    shortname = f['id']
    job_status = ''
    d_colour = 'black'
    if status == 'Running' or status == 'Ready' or status == 'Failed':
        if len(jobs) > 0:
            if shortname not in jobs:
                job_status = 'not queued'
                d_colour = 'red'
            elif jobs[shortname] == 'Q':
                job_status = 'queued'
                d_colour = 'orange'
            elif jobs[shortname] == 'R':