當前位置: 首頁>>代碼示例>>Python>>正文


Python parallel_data_helper.ParallelDataHelper類代碼示例

本文整理匯總了Python中parallel.parallel_data_helper.ParallelDataHelper的典型用法代碼示例。如果您正苦於以下問題:Python ParallelDataHelper類的具體用法?Python ParallelDataHelper怎麽用?Python ParallelDataHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ParallelDataHelper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_default_cols

    def test_default_cols(self):
        '''hanningsmooth2: Default datacolumn=all and MMS output'''
        
        self.createMMS(self.msfile,column='all')
        self.outputms = 'hannall.ms'

        hanningsmooth2(vis=self.testmms, outputvis=self.outputms)
        self.assertTrue(ParallelDataHelper.isParallelMS(self.outputms), 'Output should be an MMS')
        
        # Should have all scratch columns in output
        cd = th.getColDesc(self.outputms, 'DATA')
        self.assertGreater(len(cd), 0, 'DATA column does not exist')
        cc = th.getColDesc(self.outputms, 'CORRECTED_DATA')
        self.assertGreater(len(cc), 0, 'CORRECTED_DATA does not exist')
        
        # Now repeat the above steps but create an output MS by setting keepmms=False
        os.system('rm -rf '+self.outputms)
        hanningsmooth2(vis=self.testmms, outputvis=self.outputms, keepmms=False)
        self.assertFalse(ParallelDataHelper.isParallelMS(self.outputms), 'Output should be a normal MS')
        
        # Should have all scratch columns in output
        cd = th.getColDesc(self.outputms, 'DATA')
        self.assertGreater(len(cd), 0, 'DATA column does not exist')
        cc = th.getColDesc(self.outputms, 'CORRECTED_DATA')
        self.assertGreater(len(cc), 0, 'CORRECTED_DATA does not exist')
開發者ID:schiebel,項目名稱:casa,代碼行數:25,代碼來源:test_hanningsmooth2.py

示例2: split2

def split2(vis, 
          outputvis, 
          keepmms,
          field,
          spw, 
          scan, 
          antenna, 
          correlation,
          timerange, 
          intent,
          array,
          uvrange,
          observation,
          feed,
          datacolumn, 
          keepflags,
          width, 
          timebin, 
          combine 
          ):
    
    """Create a visibility subset from an existing visibility set"""

    casalog.origin('split2')
    
    # Initialize the helper class  
    pdh = ParallelDataHelper("split2", locals()) 
        
    # Validate input and output parameters
    try:
        pdh.setupIO()
    except Exception, instance:
        casalog.post('%s'%instance,'ERROR')
        return False
開發者ID:schiebel,項目名稱:casa,代碼行數:34,代碼來源:task_split2.py

示例3: test_default_cols

    def test_default_cols(self):
        """hanningsmooth: Default datacolumn=all and MMS output"""

        self.createMMS(self.msfile, column="all")
        self.outputms = "hannall.ms"

        hanningsmooth(vis=self.testmms, outputvis=self.outputms)
        self.assertTrue(ParallelDataHelper.isParallelMS(self.outputms), "Output should be an MMS")

        # Should have all scratch columns in output
        cd = th.getColDesc(self.outputms, "DATA")
        self.assertGreater(len(cd), 0, "DATA column does not exist")
        cc = th.getColDesc(self.outputms, "CORRECTED_DATA")
        self.assertGreater(len(cc), 0, "CORRECTED_DATA does not exist")

        # Now repeat the above steps but create an output MS by setting keepmms=False
        os.system("rm -rf " + self.outputms)
        hanningsmooth(vis=self.testmms, outputvis=self.outputms, keepmms=False)
        self.assertFalse(ParallelDataHelper.isParallelMS(self.outputms), "Output should be a normal MS")

        # Should have all scratch columns in output
        cd = th.getColDesc(self.outputms, "DATA")
        self.assertGreater(len(cd), 0, "DATA column does not exist")
        cc = th.getColDesc(self.outputms, "CORRECTED_DATA")
        self.assertGreater(len(cc), 0, "CORRECTED_DATA does not exist")
開發者ID:radio-astro,項目名稱:casa,代碼行數:25,代碼來源:test_hanningsmooth.py

示例4: hanningsmooth

def hanningsmooth(
    vis=None,
    outputvis=None,
    keepmms=None,
    field=None,
    spw=None,
    scan=None,
    antenna=None,
    correlation=None,
    timerange=None,
    intent=None,
    array=None,
    uvrange=None,
    observation=None,
    feed=None,
    datacolumn=None,
):

    """Hanning smooth frequency channel data to remove Gibbs ringing

    """

    casalog.origin("hanningsmooth")

    # Initiate the helper class
    pdh = ParallelDataHelper("hanningsmooth", locals())

    # Validate input and output parameters
    try:
        pdh.setupIO()
    except Exception, instance:
        casalog.post("%s" % instance, "ERROR")
        return False
開發者ID:radio-astro,項目名稱:casa,代碼行數:33,代碼來源:task_hanningsmooth.py

示例5: test_mms5

 def test_mms5(self):
     '''test_mms5: Create 2 MMS, 2 flagversions and 2 online flag files'''
     myasdmname = 'uid___A002_X71e4ae_X317_short'
     themsname = myasdmname+".ms"
     wvrmsname = myasdmname+'-wvr-corrected.ms'
     flagfile1 = myasdmname+'_cmd.txt'
     flagfile2 = myasdmname+'-wvr-corrected'+'_cmd.txt'
     
     importasdm(myasdmname, vis=themsname, lazy=True, scans='0:1~4', wvr_corrected_data='both', savecmds=True,
                createmms=True)
     self.assertTrue(ParallelDataHelper.isParallelMS(themsname), 'Output is not a Multi-MS')
     self.assertTrue(ParallelDataHelper.isParallelMS(wvrmsname), 'Output is not a Multi-MS')
     self.assertTrue(os.path.exists(flagfile1))
     self.assertTrue(os.path.exists(flagfile2))
開發者ID:radio-astro,項目名稱:casa,代碼行數:14,代碼來源:test_importasdm_mms.py

示例6: test_MMS1

    def test_MMS1(self):
        '''mstransform: input MMS should be the same as output MMS'''
        
        # Create an MMS in the setup
        self.createMMS(self.vis, axis='scan', spws='0,1')
                
        # Create another MS and compare. They should be the same
        self.outputms = 'thesame.mms'
        mstransform(vis=self.testmms, outputvis=self.outputms, datacolumn='data')
        
        self.assertTrue(ParallelDataHelper.isParallelMS(self.outputms),'Output is not an MMS')
                
        # Sort the MSs so that they can be compared
        myms = mstool()
        
        myms.open(self.testmms)
        myms.sort('input_sorted.ms',['OBSERVATION_ID','ARRAY_ID','SCAN_NUMBER','FIELD_ID','DATA_DESC_ID','ANTENNA1','ANTENNA2','TIME'])
        myms.done()
        
        myms.open(self.outputms)
        myms.sort('output_sorted.ms',['OBSERVATION_ID','ARRAY_ID','SCAN_NUMBER','FIELD_ID','DATA_DESC_ID','ANTENNA1','ANTENNA2','TIME'])
        myms.done()

        # Compare both tables. Ignore the DATA column and compare it in next line
        self.assertTrue(th.compTables('input_sorted.ms','output_sorted.ms', 
                                      ['FLAG_CATEGORY','FLAG','WEIGHT_SPECTRUM','SIGMA_SPECTRUM','DATA']))
        
        # Compare the DATA column
        self.assertTrue(th.compVarColTables('input_sorted.ms','output_sorted.ms','DATA'))
        
        # The separation axis should be copied to the output MMS
        in_sepaxis = ph.axisType(self.testmms)
        out_sepaxis = ph.axisType(self.outputms)
        self.assertEqual(in_sepaxis, out_sepaxis, 'AxisTypes from input and output MMS do not match')
開發者ID:schiebel,項目名稱:casa,代碼行數:34,代碼來源:test_mstransform_mms.py

示例7: test_output_mms4

 def test_output_mms4(self):
     '''mstransform: timeaverage=True, output axis=scan, timespan=scan'''
     self.outputms = 'outmms4.mms'
     # Just give a WARNING
     mstransform(self.vis, outputvis=self.outputms, datacolumn='corrected', createmms=True, timeaverage=True, spw='12,13',
                 separationaxis='scan',timebin='10s',timespan='scan')
     self.assertTrue(ParallelDataHelper.isParallelMS(self.outputms),'Output should be an MMS')
開發者ID:schiebel,項目名稱:casa,代碼行數:7,代碼來源:test_mstransform_mms.py

示例8: test_mms2

    def test_mms2(self):
        '''test_mms2: Create an MMS with default name and lazy=True'''
        myasdmname = 'uid___A002_X71e4ae_X317_short'
        themsname = myasdmname+".ms"

        importasdm(myasdmname, createmms=True, lazy=True, scans='2')
        self.assertTrue(ParallelDataHelper.isParallelMS(themsname), 'Output is not a Multi-MS')
開發者ID:radio-astro,項目名稱:casa,代碼行數:7,代碼來源:test_importasdm_mms.py

示例9: test_combspws_timespan

 def test_combspws_timespan(self):
     '''mstransform: combinespws=True, timespan=scan axis=auto'''
     self.createMMS(self.vis, axis='auto',spws='3')
     self.outputms = "2transformations.mms"
     # This should work. 
     mstransform(vis=self.testmms, outputvis=self.outputms, datacolumn='data',
                     combinespws=True, timeaverage=True, timebin='40s',timespan='scan')
     self.assertFalse(ParallelDataHelper.isParallelMS(self.outputms),'Output should be an MS')
開發者ID:schiebel,項目名稱:casa,代碼行數:8,代碼來源:test_mstransform_mms.py

示例10: test_sd_data_mms

    def test_sd_data_mms(self):
        '''importasdm: Create an MMS from a single-dish MS and DATA column '''
        myasdmname = 'uid___A002_X6218fb_X264'
        themsname = myasdmname+".ms"

        importasdm(myasdmname, vis=themsname, scans='1,4', createmms=True, separationaxis='scan', numsubms=2, flagbackup=False)
        self.assertTrue(ParallelDataHelper.isParallelMS(themsname), 'Output is not a Multi-MS')
        self.assertTrue(len(th.getColDesc(themsname, 'DATA')) > 0)
開發者ID:radio-astro,項目名稱:casa,代碼行數:8,代碼來源:test_importasdm_mms.py

示例11: test_mms3

    def test_mms3(self):
        '''test_mms3: Create MMS with separationaxis=spw and lazy=True'''
        myasdmname = 'uid___A002_X71e4ae_X317_short'
        themsname = myasdmname+".ms"

        importasdm(myasdmname, createmms=True, lazy=True, scans='1,2', separationaxis='spw', flagbackup=False,
                   process_flags=False)
        self.assertTrue(ParallelDataHelper.isParallelMS(themsname), 'Output is not a Multi-MS')
        self.assertEqual(ph.axisType(themsname), 'spw', 'Separation axis of MMS should be spw')
開發者ID:radio-astro,項目名稱:casa,代碼行數:9,代碼來源:test_importasdm_mms.py

示例12: test_float_data_mms

    def test_float_data_mms(self):
        '''importasdm: Create an MMS from a FLOAT_DATA MS '''
        myasdmname = 'uid___A002_X6218fb_X264'
        themsname = myasdmname+".ms"

        # The ocorr_mode='ao' option will create a FLOAT_DATA column instead of DATA
        importasdm(myasdmname, vis=themsname, ocorr_mode='ao', createmms=True, scans='1')
        self.assertTrue(ParallelDataHelper.isParallelMS(themsname), 'Output is not a Multi-MS')        
        self.assertTrue(len(th.getColDesc(themsname, 'FLOAT_DATA')) > 0)
開發者ID:radio-astro,項目名稱:casa,代碼行數:9,代碼來源:test_importasdm_mms.py

示例13: cvel2

def cvel2(
    vis,
    outputvis,
    keepmms,
    passall,  # hidden parameter for backwards compatibiliy
    field,
    spw,
    scan,
    antenna,
    correlation,
    timerange,
    intent,
    array,
    uvrange,
    observation,
    feed,
    datacolumn,
    mode,
    nchan,
    start,
    width,
    interpolation,
    phasecenter,
    restfreq,
    outframe,
    veltype,
    hanning,
):

    """ This task used the MSTransform framework. It needs to use the ParallelDataHelper
        class, implemented in parallel.parallel_data_helper.py. 
    """

    # Initialize the helper class
    pdh = ParallelDataHelper("cvel2", locals())

    casalog.origin("cvel2")

    # Validate input and output parameters
    try:
        pdh.setupIO()
    except Exception, instance:
        casalog.post("%s" % instance, "ERROR")
        return False
開發者ID:radio-astro,項目名稱:casa,代碼行數:44,代碼來源:task_cvel2.py

示例14: test_combspws_timespan_scan_axis

 def test_combspws_timespan_scan_axis(self):
     '''mstransform: combinespws=True, timespan=scan axis=scan'''
     self.createMMS(self.vis, axis='scan',spws='0')
     self.outputms = "scanaxiserror.mms"
     # subMSs do not have all scans. Create an MS.
     try:
         mstransform(vis=self.testmms, outputvis=self.outputms, datacolumn='data',
                     combinespws=True, timeaverage=True, timebin='20s',timespan='scan')
         self.assertTrue((ParallelDataHelper.isParallelMS(self.outputms),'Output should be an MMS'))
     
     except Exception, instance:
         print 'Expected error: %s'%instance
開發者ID:schiebel,項目名稱:casa,代碼行數:12,代碼來源:test_mstransform_mms.py

示例15: test_combspws_timespan_spw_axis

 def test_combspws_timespan_spw_axis(self):
     '''mstransform: combinespws=True, timespan=scan axis=spw'''
     self.createMMS(self.vis, axis='spw',scans='30',spws='10')
     self.outputms = "spwaxisok.mms"
     # This should work
     try:
         mstransform(vis=self.testmms, outputvis=self.outputms, datacolumn='data',
                     combinespws=True, timeaverage=True, timebin='20s',timespan='scan')
         self.assertTrue((ParallelDataHelper.isParallelMS(self.outputms),'Output should be an MMS'))
     
     except Exception, instance:
         print 'This error should have not happened %s'%instance
開發者ID:schiebel,項目名稱:casa,代碼行數:12,代碼來源:test_mstransform_mms.py


注:本文中的parallel.parallel_data_helper.ParallelDataHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。