本文整理汇总了Python中taskinit.aftool函数的典型用法代码示例。如果您正苦于以下问题:Python aftool函数的具体用法?Python aftool怎么用?Python aftool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了aftool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_manual_field_msSelection_layer_for_tsys_CalTable
def test_manual_field_msSelection_layer_for_tsys_CalTable(self):
"""AgentFlagger:: Manually flag a Tsys-based CalTable using MSSelection for field """
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata(field='0')
agentUnflag={'apply':True,'mode':'unflag'}
agentManual={'apply':True,'mode':'manual'}
aflocal.parseagentparameters(agentUnflag)
aflocal.parseagentparameters(agentManual)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
aflocal.open(self.vis)
aflocal.selectdata()
agentSummary={'apply':True,'mode':'summary'}
aflocal.parseagentparameters(agentSummary)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['field']['3c279']['flagged'], 9216.0)
self.assertEqual(summary['report0']['field']['Titan']['flagged'], 0)
self.assertEqual(summary['report0']['field']['TW Hya']['flagged'], 0)
self.assertEqual(summary['report0']['field']['J1037-295=QSO']['flagged'], 0)
示例2: test_display_cal_tables
def test_display_cal_tables(self):
'''AgentFlagger: Select spws, display and flag cal tables'''
self.setUp_bpass_case()
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata(spw='1')
aflocal.parsemanualparameters(spw='1:0~10;60~63')
aflocal.parsesummaryparameters(spwchan=True)
# agentManual={'apply':True,'mode':'manual'}
# agentSummary={'apply':True,'mode':'summary','spwchan':True}
agentDisplay={'mode':'display','datadisplay':True,'pause':False,'datacolumn':'CPARAM'}
# aflocal.parseagentparameters(agentManual)
# aflocal.parseagentparameters(agentSummary)
aflocal.parseagentparameters(agentDisplay)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['spw:channel']['1:0']['flagged'], 1300)
self.assertEqual(summary['report0']['spw:channel']['1:5']['flagged'], 1300)
self.assertEqual(summary['report0']['spw:channel']['1:10']['flagged'], 1300)
self.assertEqual(summary['report0']['spw:channel']['1:11']['flagged'], 0)
self.assertEqual(summary['report0']['spw:channel']['1:60']['flagged'], 1300)
self.assertEqual(summary['report0']['spw:channel']['1:59']['flagged'], 0)
self.assertEqual(summary['report0']['flagged'], 15*1300)
示例3: test_tfcrop_cparam_sol1_extension
def test_tfcrop_cparam_sol1_extension(self):
"""AgentFlagger:: Test tfcrop first calibration solution product of CPARAM column,
and then extend to the other solution for bpass CalTable"""
aflocal = aftool()
datacolumn = "CPARAM"
correlation = 'Sol1'
aflocal.open(self.vis)
aflocal.selectdata()
# Pre-clip data to avoid problems with near-zero values
agentClip={'apply':True,'mode':'clip','clipzeros':True,'datacolumn':datacolumn,'correlation':correlation}
aflocal.parseagentparameters(agentClip)
aflocal.parsetfcropparameters(datacolumn=datacolumn, correlation=correlation,
extendflags=False)
aflocal.parsesummaryparameters()
# Extend to the other solution
aflocal.parseextendparameters(extendpols=True,growfreq=0.0,growtime=0.0)
aflocal.parsesummaryparameters()
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
# flags from first summary, only tfcrop
assert abs(summary['report0']['flagged'] - 30427) <= 5
assert abs(summary['report0']['correlation']['Sol1']['flagged'] - 30427) <= 5
# flags from second summary, tfcrop+extend
assert abs(summary['report2']['flagged'] - 2*30427) <= 10
assert abs(summary['report2']['correlation']['Sol2']['flagged'] - 30427) <= 5
示例4: test_mixed_agents_tsys
def test_mixed_agents_tsys(self):
'''AgentFlagger: supported and unsupported agents in a list'''
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
aflocal.parsemanualparameters(spw='1')
aflocal.parseagentparameters({'mode':'shadow','spw':'3'}) #unsupported mode
aflocal.parseelevationparameters() # unsupported mode
aflocal.parsemanualparameters(spw='5')
aflocal.parsesummaryparameters(spw='1,3,5', fieldcnt=True)
aflocal.init()
res = aflocal.run(writeflags=True)
aflocal.done()
# Check the summary dictionary with field breakdown
fields = res['report0'].keys()
fields.remove('name')
fields.remove('type')
fflags1 = 0
fflags3 = 0
fflags5 = 0
totalflags = 0
for ff in fields:
fflags1 += res['report0'][ff]['spw']['1']['flagged']
fflags3 += res['report0'][ff]['spw']['3']['flagged']
fflags5 += res['report0'][ff]['spw']['5']['flagged']
totalflags += res['report0'][ff]['flagged']
self.assertEqual(fflags1, 32256)
self.assertEqual(fflags3, 0)
self.assertEqual(fflags5, 32256)
self.assertEqual(totalflags, 32256*2)
示例5: test_manual_field_msSelection_layer_for_bpass_CalTable
def test_manual_field_msSelection_layer_for_bpass_CalTable(self):
"""AgentFlagger:: Manually flag a bpass-based CalTable using MSSelection for field """
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata({'field':'3C286_A'})
agentUnflag={'apply':True,'mode':'unflag'}
agentManual={'apply':True,'mode':'manual'}
aflocal.parseagentparameters(agentUnflag)
aflocal.parseagentparameters(agentManual)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
aflocal.open(self.vis)
aflocal.selectdata()
agentSummary={'apply':True,'mode':'summary'}
aflocal.parseagentparameters(agentSummary)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['field']['3C286_A']['flagged'], 499200.0)
self.assertEqual(summary['report0']['field']['3C286_B']['flagged'], 0)
self.assertEqual(summary['report0']['field']['3C286_C']['flagged'], 0)
self.assertEqual(summary['report0']['field']['3C286_D']['flagged'], 0)
示例6: unflag_table
def unflag_table(self):
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
agentUnflag={'apply':True,'mode':'unflag'}
aflocal.parseagentparameters(agentUnflag)
aflocal.init()
aflocal.run(writeflags=True)
aflocal.done()
示例7: test_unsupported_elevation_tsys
def test_unsupported_elevation_tsys(self):
'''AgentFlagger: Unsupported elevation mode'''
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
aflocal.parseelevationparameters()
aflocal.init()
res = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(res, {})
示例8: test_default_cparam_bpass
def test_default_cparam_bpass(self):
'''Flagdata: flag CPARAM data column'''
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
aflocal.parseclipparameters(clipzeros=True,datacolumn='CPARAM')
aflocal.parsesummaryparameters()
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['flagged'], 11078.0, 'Should use CPARAM as the default column')
示例9: test_display_float_data
def test_display_float_data(self):
'''AgentFlagger: Select spw, display and flag single-dish MS'''
self.setUp_float_data()
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata(spw='1~4')
aflocal.parsemanualparameters()
aflocal.parsesummaryparameters(name='Single-dish')
agentDisplay={'mode':'display','datadisplay':True,'pause':False,'datacolumn':'FLOAT_DATA'}
aflocal.parseagentparameters(agentDisplay)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['flagged'], 2052)
示例10: test_flagversions
def test_flagversions(self):
"""Partition: check that the .flagversions is created"""
# Run partition and create the .flagversions
partition(vis=self.msfile, outputvis=self.mmsfile, createmms=True, disableparallel=True, datacolumn="data")
self.assertTrue(os.path.exists(self.mmsfile + ".flagversions"))
# Check that the number of backups in MMS is correct
aflocal = aftool()
aflocal.open(self.mmsfile)
nv = aflocal.getflagversionlist()
aflocal.done()
self.assertEqual(len(nv), 3)
# Run flagdata on MMS to check if it works well.
flagdata(vis=self.mmsfile, mode="unflag", flagbackup=True)
# Check that the number of backups in MMS is correct
aflocal = aftool()
aflocal.open(self.mmsfile)
nvref = aflocal.getflagversionlist()
aflocal.done()
self.assertEqual(len(nvref), 4)
示例11: test_clip_minmax_cparam_for_bpass
def test_clip_minmax_cparam_for_bpass(self):
"""AgentFlagger:: Clip all calibration solutions of CPARAM column using a minmax range"""
aflocal = aftool()
datacolumn = 'CPARAM'
aflocal.open(self.vis)
aflocal.selectdata()
aflocal.parseclipparameters(clipminmax=[0.,0.3],datacolumn=datacolumn,clipzeros=True)
aflocal.parsesummaryparameters()
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['flagged'], 11175.0)
self.assertEqual(summary['report0']['total'], 1248000)
self.assertEqual(summary['report0']['correlation']['Sol1']['flagged'], 11136.0)
self.assertEqual(summary['report0']['correlation']['Sol2']['flagged'], 39)
示例12: test_display_data_single_channel_selection
def test_display_data_single_channel_selection(self):
"""AgentFlagger:: Check nominal behaviour for single spw:chan selection """
self.setUp_4Ants()
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
agentUnflag={'apply':True,'mode':'unflag'}
agentManual={'apply':True,'mode':'manual','spw':'*:20~40'}
agentSummary={'apply':True,'mode':'summary'}
agentDisplay={'mode':'display','datadisplay':True,'pause':False}
aflocal.parseagentparameters(agentManual)
aflocal.parseagentparameters(agentSummary)
aflocal.parseagentparameters(agentDisplay)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
示例13: test_manual_antenna_selection_agent_layer_for_tsys_CalTable2
def test_manual_antenna_selection_agent_layer_for_tsys_CalTable2(self):
"""AgentFlagger:: Manually flag a Tsys-based CalTable using flag agent selection engine for antenna"""
# Run the previous test but using the specific parsing functions
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
aflocal.parsemanualparameters(apply=False)
aflocal.parsemanualparameters(antenna='DV09')
aflocal.parsesummaryparameters()
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()
self.assertEqual(summary['report0']['antenna']['DV09']['flagged'], 14336)
self.assertEqual(summary['report0']['antenna']['DV10']['flagged'], 0)
示例14: test_null_intent_selection1
def test_null_intent_selection1(self):
'''Agentflagger: handle unknown scan intent in list mode'''
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
aflocal.parsemanualparameters(intent='FOCUS') # non-existing intent
aflocal.parsemanualparameters(intent='CALIBRATE_POINTING*') # scan=1
aflocal.parsemanualparameters(intent='CALIBRATE_AMPLI_ON_SOURC') # typo
aflocal.parsemanualparameters(intent='*DELAY*') # non-existing
aflocal.parsesummaryparameters()
aflocal.init()
summary = aflocal.run()
aflocal.done()
self.assertEqual(summary['report0']['scan']['1']['flagged'], 192416)
self.assertEqual(summary['report0']['scan']['8']['flagged'], 0)
self.assertEqual(summary['report0']['flagged'], 192416)
示例15: test_display_data_different_corrs_per_spw
def test_display_data_different_corrs_per_spw(self):
"""AgentFlagger:: Check behaviour when the number of correlation products changes between SPWs """
self.setUp_CAS_4052()
aflocal = aftool()
aflocal.open(self.vis)
aflocal.selectdata()
agentUnflag={'apply':True,'mode':'unflag'}
agentManual={'apply':True,'mode':'manual','spw':'*:100~200;300~400'}
agentSummary={'apply':True,'mode':'summary'}
agentDisplay={'mode':'display','datadisplay':True,'pause':False}
aflocal.parseagentparameters(agentUnflag)
aflocal.parseagentparameters(agentManual)
aflocal.parseagentparameters(agentSummary)
aflocal.parseagentparameters(agentDisplay)
aflocal.init()
summary = aflocal.run(writeflags=True)
aflocal.done()