Esempio n. 1
0
def update_status(name,status):
    if not use_database():
        return
    if name is None:
        # work it out
        id=get_id(workdir=os.getcwd())
    else:
        id=name
        
    with SurveysDB() as sdb:
      idd=sdb.get_field(id)
      if idd is None:
          raise RuntimeError('Unable to find database entry for field "%s".' % id)
      idd['vlow_reprocess']=status
      sdb.set_field(idd)
    print 'An estimate of the image noise is %.3f muJy/beam' % rms
    drs=do_dr_checker(o['catprefix']+'.cat.fits',o['pbimage'],verbose=False,peak=0.4)
    dr=np.median(drs)
    print 'Median dynamic range is',dr

    # fit source counts
    if o['fit_sourcecounts']:
        from fit_sourcecounts import do_fit_sourcecounts
        sc_norm,sc_index,scale=do_fit_sourcecounts(rms=imagenoise)
    else:
        sc_norm=sc_index=scale=None
    
    print rms,dr,catsources,first_ra,first_dec,tgss_scale,nvss_scale,sc_norm,sc_index,scale

    if use_database():
        id=get_id()
        with SurveysDB() as sdb:
            result=sdb.create_quality(id)
            result['rms']=rms
            result['dr']=dr
            result['catsources']=catsources
            result['first_ra']=first_ra
            result['first_dec']=first_dec
            result['tgss_scale']=tgss_scale
            result['nvss_scale']=nvss_scale
            result['sc_norm']=sc_norm
            result['sc_index']=sc_index
            result['scale']=scale
            
            sdb.set_quality(result)
Esempio n. 3
0
                        verbose=False,
                        peak=0.4)
    dr = np.median(drs)
    print 'Median dynamic range is', dr

    # fit source counts
    if o['fit_sourcecounts']:
        from fit_sourcecounts import do_fit_sourcecounts
        sc_norm, sc_index, scale = do_fit_sourcecounts(rms=imagenoise)
    else:
        sc_norm = sc_index = scale = None

    print rms, dr, catsources, first_ra, first_dec, tgss_scale, nvss_scale, sc_norm, sc_index, scale

    if use_database():
        id = get_id()
        with SurveysDB() as sdb:
            result = sdb.create_quality(id)
            result['rms'] = rms
            result['dr'] = dr
            result['catsources'] = catsources
            result['first_ra'] = first_ra
            result['first_dec'] = first_dec
            result['tgss_scale'] = tgss_scale
            result['nvss_scale'] = nvss_scale
            result['sc_norm'] = sc_norm
            result['sc_index'] = sc_index
            result['scale'] = scale

            sdb.set_quality(result)