def _get_good(self): #Update April 2015 to use the flagging task task_args = { 'vis': self.vis, 'mode': 'summary', 'field': self.field, 'spw': self.spw, 'intent': self.intent, 'display': '', 'flagbackup': False, 'savepars': False } d = flagdata(**task_args) # Calculate the number of good data for each antenna and return # them antenna = d['antenna'] good = dict() for a in antenna.keys(): good[a] = antenna[a]['total'] - antenna[a]['flagged'] return (good)
def statsFlag(active_ms, field='', scan='', note=''): t = flagdata(vis=active_ms, mode='summary', field=field, scan=scan, action='calculate') log = 'Flag statistics ('+note+'):' log += '\nAntenna, ' for k in sorted(t['antenna']): log += k +': %.2f%% - ' % (100.*t['antenna'][k]['flagged']/t['antenna'][k]['total']) log += '\nCorrelation, ' for k, v in t['correlation'].items(): log += k +': %.2f%% - ' % (100.*v['flagged']/v['total']) log += '\nSpw, ' for k, v in t['spw'].items(): log += k +': %.2f%% - ' % (100.*v['flagged']/v['total']) log += '\nTotal: %.2f%%' % (100.*t['flagged']/t['total']) correctedlog = log.replace(' - \n','\n') logging.debug(correctedlog) return correctedlog