当前位置: 首页>>代码示例>>Python>>正文


Python tasks.flagcmd函数代码示例

本文整理汇总了Python中tasks.flagcmd函数的典型用法代码示例。如果您正苦于以下问题:Python flagcmd函数的具体用法?Python flagcmd怎么用?Python flagcmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了flagcmd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_default_cparam

 def test_default_cparam(self):
     '''Flagcmd: flag CPARAM data column'''
     flist = ["mode='clip' clipzeros=True datacolumn='CPARAM'"]
     flagcmd(vis=self.vis, inpmode='list', inpfile=flist,
             flagbackup=False)
     res = flagdata(vis=self.vis, mode='summary')
     self.assertEqual(res['flagged'], 11078, 'Should use CPARAM as the default column')
开发者ID:radio-astro,项目名称:casa,代码行数:7,代码来源:test_flagcmd.py

示例2: test_compatibility

 def test_compatibility(self):
     myinput = "observation='1' mode='manualflag'"
     filename = create_input(myinput)
     
     flagcmd(vis=self.vis, inpmode='list', inpfile=filename, action='apply', savepars=False,
             flagbackup=False)
     test_eq(flagdata(vis=self.vis, mode='summary'), 2882778, 28500)
开发者ID:radio-astro,项目名称:casa,代码行数:7,代码来源:test_flagcmd.py

示例3: test_clip_one_list

 def test_clip_one_list(self):
     '''Flagcmd: Flag one solution using one command in a list'''
     flist = ["mode='clip' clipminmax=[0,3] correlation='REAL_Sol1' datacolumn='CPARAM'"]
     flagcmd(vis=self.vis, inpmode='list', inpfile=flist)
     res = flagdata(vis=self.vis, mode='summary')
     self.assertEqual(res['flagged'], 309388)
     self.assertEqual(res['correlation']['Sol2']['flagged'], 0)
开发者ID:radio-astro,项目名称:casa,代码行数:7,代码来源:test_flagcmd.py

示例4: test_CAS4819

 def test_CAS4819(self):
     '''flagcmd: CAS-4819, Flag commands from three files'''
     self.setUp_ngc5921()
     # creat first input file
     myinput = "scan='1'\n"\
             "scan='2'\n"\
             "scan='3'"
     filename1 = 'list7a.txt'
     create_input1(myinput, filename1)
     
     # Create second input file
     myinput = "scan='5'\n"\
             "scan='6'\n"\
             "scan='7'"        
     filename2 = 'list7b.txt'
     create_input1(myinput, filename2)
     
      # Create third input file
     myinput = "scan='4' mode='clip' clipminmax=[0,4]" 
     filename3 = 'list7c.txt'
     create_input1(myinput, filename3)
    
     flagcmd(vis=self.vis, inpmode='list', inpfile=[filename1,filename2,filename3],
              flagbackup=False, action='apply')
     
     res = flagdata(vis=self.vis, mode='summary')
     self.assertEqual(res['scan']['1']['flagged'], 568134)
     self.assertEqual(res['scan']['2']['flagged'], 238140)
     self.assertEqual(res['scan']['3']['flagged'], 762048)
     self.assertEqual(res['scan']['4']['flagged'], 6696)
     self.assertEqual(res['scan']['5']['flagged'], 142884)
     self.assertEqual(res['scan']['6']['flagged'], 857304)
     self.assertEqual(res['scan']['7']['flagged'], 190512)
     self.assertEqual(res['total'],2854278)
     self.assertEqual(res['flagged'],2765718)
开发者ID:radio-astro,项目名称:casa,代码行数:35,代码来源:test_flagcmd.py

示例5: test_list_reason1

 def test_list_reason1(self):
     '''flagcmd: select by reason from two files'''
     self.setUp_ngc5921()
     # creat first input file
     myinput = "scan='1' spw='0:10~20' reason='NONE'\n"\
             "scan='2' reason='EVEN'\n"\
             "scan='3' reason='ODD'"
     filename1 = 'reasonfile1.txt'
     create_input1(myinput, filename1)
     
     # Create second input file
     myinput = "scan='5' reason='ODD'\n"\
             "scan='6' reason='EVEN'\n"\
             "scan='7' reason='ODD'"        
     filename2 = 'reasonfile2.txt'
     create_input1(myinput, filename2)
     
     # Apply flag cmds on ODD reason
     flagcmd(vis=self.vis, inpmode='list', inpfile=[filename1,filename2], reason='ODD',
              flagbackup=False, action='apply')
     
     res = flagdata(vis=self.vis, mode='summary')
     self.assertEqual(res['scan']['3']['flagged'], 762048)
     self.assertEqual(res['scan']['5']['flagged'], 142884)
     self.assertEqual(res['scan']['6']['flagged'], 0)
     self.assertEqual(res['scan']['7']['flagged'], 190512)
     self.assertEqual(res['flagged'], 762048+142884+190512)
开发者ID:radio-astro,项目名称:casa,代码行数:27,代码来源:test_flagcmd.py

示例6: test_cal_observation

 def test_cal_observation(self):
     '''Flagcmd: flag an observation from an old cal table format'''
     # Note: this cal table does not have an observation column. 
     # The column and sub-table should be added and the flagging
     # should happen after this.
     flagcmd(vis=self.vis, inpmode='list', inpfile=["observation='0'"], flagbackup=False)
     res=flagdata(vis=self.vis, mode='summary')
     self.assertEqual(res['flagged'],1248000)
     self.assertEqual(res['total'],1248000)
开发者ID:radio-astro,项目名称:casa,代码行数:9,代码来源:test_flagcmd.py

示例7: test_xml2

 def test_xml2(self):
     '''flagcmd: list xml file and save in outfile'''
     
     # The MS only contains clip and shadow commands
     
     # Apply the shadow command
     flagcmd(vis=self.vis, action='apply', reason='SHADOW', flagbackup=False)
     res = flagdata(vis=self.vis, mode='summary')
     self.assertEqual(res['flagged'], 240640)
开发者ID:radio-astro,项目名称:casa,代码行数:9,代码来源:test_flagcmd.py

示例8: test_manual_field_selection_for_bpass

 def test_manual_field_selection_for_bpass(self):
     """Flagcmd:: Manually flag a bpass-based CalTable using field selection"""
     
     flagcmd(vis=self.vis, inpmode='list', inpfile=["field='3C286_A'"], flagbackup=False)
     summary=flagdata(vis=self.vis, mode='summary')
     
     self.assertEqual(summary['field']['3C286_A']['flagged'], 499200.0)
     self.assertEqual(summary['field']['3C286_B']['flagged'], 0)
     self.assertEqual(summary['field']['3C286_C']['flagged'], 0)
     self.assertEqual(summary['field']['3C286_D']['flagged'], 0)
开发者ID:radio-astro,项目名称:casa,代码行数:10,代码来源:test_flagcmd.py

示例9: test_action_plot_table

 def test_action_plot_table(self):
     '''flagcmd: Test action=plot, nothing plotted'''
     outplot = 'noplot.png'
     flagcmd(vis=self.vis, inpmode='list', 
         inpfile=["intent='CAL*POINT*' field=''","scan='5'"], 
         action='list', savepars=True)
     
     flagcmd(vis=self.vis, inpmode='table', useapplied=True, action='plot',
             plotfile=outplot)
     
     self.assertTrue(os.path.exists(outplot),'Plot file was not created')
开发者ID:radio-astro,项目名称:casa,代码行数:11,代码来源:test_flagcmd.py

示例10: test_action_plot_list

 def test_action_plot_list(self):
     '''flagcmd: Test action=plot to plot 4 antennas and no timerange'''
     outplot = 'fourplot.png'
     cmds = ["antenna='ea01' reason='none'",
             "antenna='ea11' reason='no_reason'",
             "antenna='ea19' reason='none'",
             "antenna='ea24' reason='other'"]
     
     flagcmd(vis=self.vis, inpmode='list', inpfile=cmds, action='plot',plotfile=outplot)
             
     self.assertTrue(os.path.exists(outplot),'Plot file was not created')
开发者ID:radio-astro,项目名称:casa,代码行数:11,代码来源:test_flagcmd.py

示例11: test_MS_flagcmds

 def test_MS_flagcmds(self):
     """Flagcmd:: Save flags to MS and apply to cal table"""
     self.setUp_data4rflag()
     msfile = self.vis
     flagcmd(vis=msfile, action='clear', clearall=True)
     flagdata(vis=msfile, antenna='ea09', action='', savepars=True)
     
     self.setUp_bpass_case()
     flagcmd(vis=self.vis, inpfile=msfile, action='apply', flagbackup=False)
     summary=flagdata(vis=self.vis, mode='summary')
     self.assertEqual(summary['antenna']['ea09']['flagged'], 48000.0)
     self.assertEqual(summary['antenna']['ea10']['flagged'], 0.0)
开发者ID:radio-astro,项目名称:casa,代码行数:12,代码来源:test_flagcmd.py

示例12: test_list_field_Selection_for_bpass

    def test_list_field_Selection_for_bpass(self):
        """Flagcmd:: Manually flag a bpass-based CalTable using file in list mode """
        
        myinput = "field='3C286_A'"
        filename = create_input(myinput)

        flagcmd(vis=self.vis, inpmode='list', inpfile=filename, flagbackup=False)
        summary=flagdata(vis=self.vis, mode='summary')
        self.assertEqual(summary['field']['3C286_A']['flagged'], 499200.0)
        self.assertEqual(summary['field']['3C286_B']['flagged'], 0)
        self.assertEqual(summary['field']['3C286_C']['flagged'], 0)
        self.assertEqual(summary['field']['3C286_D']['flagged'], 0)
开发者ID:radio-astro,项目名称:casa,代码行数:12,代码来源:test_flagcmd.py

示例13: test_cmd

 def test_cmd(self):
     '''flagcmd: inpmode=list with empty parameter'''
     
     # Test the correct parsing with empty parameter such as antenna=''
     flagcmd(vis=self.vis, inpmode='list', 
              inpfile=["intent='CAL*POINT*' field=''","scan='1,8' antenna=''","scan='10'"], 
              action='apply', savepars=False, flagbackup=False)
     res = flagdata(vis=self.vis,mode='summary')
     self.assertEqual(res['scan']['1']['flagged'], 192416)
     self.assertEqual(res['scan']['8']['flagged'], 39096)
     self.assertEqual(res['scan']['10']['flagged'], 39096)
     self.assertEqual(res['flagged'], 270608)
开发者ID:radio-astro,项目名称:casa,代码行数:12,代码来源:test_flagcmd.py

示例14: test_apply4

    def test_apply4(self):
        """importevla: Save online flags to FLAG_CMD and file; do not apply"""

        # Use default msname and outfile
        msname = "xosro4.ms"
        cmdfile = msname.replace(".ms", "_cmd.txt")
        if os.path.exists(msname):
            os.system("rm -rf " + msname)
        if os.path.exists(cmdfile):
            os.system("rm -rf " + cmdfile)

        importevla(
            asdm=self.asdm,
            vis=msname,
            scans="2",
            online=True,
            shadow=False,
            flagzero=False,
            applyflags=False,
            savecmds=True,
            flagbackup=False,
        )

        # No flags were applied
        res = flagdata(vis=msname, mode="summary")
        self.assertEqual(res["flagged"], 0)

        # Apply only row 213 using flagcmd
        # The command in row 213 is the following:
        # antenna='ea06' timerange='2012/02/22/22:30:55.200~2012/02/22/22:35:08.199'
        # spw='EVLA_X#A0C0#0' correlation='LL,LR,RL
        flagcmd(vis=msname, action="apply", tablerows=213)

        # Check flags. RR should no be flagged
        res = flagdata(vis=msname, mode="summary")
        self.assertEqual(res["correlation"]["RR"]["flagged"], 0, "RR should not be flagged")
        self.assertEqual(res["correlation"]["LL"]["flagged"], 29440)
        self.assertEqual(res["correlation"]["LR"]["flagged"], 29440)
        self.assertEqual(res["correlation"]["RL"]["flagged"], 29440)
        self.assertEqual(res["antenna"]["ea06"]["flagged"], 88320)
        self.assertEqual(res["antenna"]["ea07"]["flagged"], 3840, "Only a few baselines should be flagged")
        self.assertEqual(res["antenna"]["ea08"]["flagged"], 3840, "Only a few baselines should be flagged")

        # Check output file existence
        self.assertTrue(os.path.exists(cmdfile))

        # Check file content
        ff = open(cmdfile, "r")
        cmdlist = ff.readlines()
        ncmds = cmdlist.__len__()
        ff.close()
        self.assertEqual(ncmds, 214, "Only Online cmds should have been saved to file")
开发者ID:radio-astro,项目名称:casa,代码行数:52,代码来源:test_importevla.py

示例15: test_utfcrop

    def test_utfcrop(self):
        '''flagcmd: unapply tfcrop agent'''
        # Remove any cmd from table
        flagcmd(vis=self.vis, action='clear', clearall=True)

        # Flag using manual agent
        myinput = "scan='1'"
        filename = create_input(myinput)
        flagcmd(vis=self.vis, inpmode='list', inpfile=filename, action='apply', savepars=True)
        
        # Flag using tfcrop agent from file
        # Note : For this test, scan=4 gives identical flags on 32/64 bit machines,
        #           and one flag difference on a Mac (32)
        #           Other scans give differences at the 0.005% level.
        myinput = "scan='4' mode=tfcrop correlation='ABS_RR' extendflags=False"
        filename = create_input(myinput)
        flagcmd(vis=self.vis, inpmode='list', inpfile=filename, action='apply', savepars=True,
                flagbackup=False)
        res = flagdata(vis=self.vis,mode='summary')
        self.assertEqual(res['scan']['1']['flagged'], 568134, 'Whole scan=1 should be flagged')
        #self.assertEqual(res['scan']['4']['flagged'], 1201, 'scan=4 should be partially flagged')
        self.assertTrue(res['scan']['4']['flagged']>= 1200 and res['scan']['4']['flagged']<= 1204, \
                        'scan=4 should be partially flagged')
        
        # Unapply only the tfcrop line
        flagcmd(vis=self.vis, action='unapply', useapplied=True, tablerows=1, savepars=False)
        result = flagdata(vis=self.vis,mode='summary',scan='4')
        self.assertEqual(result['flagged'], 0, 'Expected 0 flags, found %s'%result['flagged'])
        self.assertEqual(result['total'], 95256,'Expected total 95256, found %s'%result['total'])
开发者ID:radio-astro,项目名称:casa,代码行数:29,代码来源:test_flagcmd.py


注:本文中的tasks.flagcmd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。