Example #1
0
    def testflag02(self):
        """Testflag: verify proper handling of flag information for scaletsys=False"""
        scaletsys=False
        res=sdscaleold(infile=self.rawfile,factor=self.factor,scaletsys=scaletsys,outfile=self.outfile)
        self.assertEqual(res, None, msg='Any error occurred during calibration')

        self._check_flags_no_change()
        self._check_values(scaletsys)
Example #2
0
 def test304(self):
     """Test 304: 2D array ([nrow,1]) factor with Tsys scaling"""
     factor = [[2.0],[3.0]]
     scaletsys=True
     res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
     self.assertEqual(res,None,
                      msg='Any error occurred during calibration')
     self._compare(self.outfile,self.rawfile,factor,scaletsys)
Example #3
0
 def test407(self):
     """Test 407: 2D array ([nrow,nchan]) factor without Tsys scaling"""
     factor = [[2.0,4.0,6.0,8.0],[3.0]]
     scaletsys=False
     res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
     self.assertEqual(res,None,
                      msg='Any error occurred during calibration')
     self._compare(self.outfile,self.rawfile,factor,scaletsys)
Example #4
0
 def test401(self):
     """Test 401: scalar factor without Tsys scaling"""
     factor = 2.0
     scaletsys=False
     res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
     self.assertEqual(res,None,
                      msg='Any error occurred during calibration')
     self._compare(self.outfile,self.rawfile,factor,scaletsys)
Example #5
0
 def test203(self):
     """Test 203: 1D array factor without Tsys scaling"""
     factor = [2.0,3.0,4.0,5.0]
     scaletsys=False
     res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
     self.assertEqual(res,None,
                      msg='Any error occurred during calibration')
     self._compare(self.outfile,self.rawfile,factor,scaletsys)
Example #6
0
 def test003(self):
     """Test 003: Try to scale non-conform Tsys"""
     factor=[1.0,2.0,3.0,4.0]
     try:
         res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=True,outfile=self.outfile)
         self.assertTrue(False,
                         msg='The task must throw exception')
     except Exception, e:
         pos=str(e).find('SPECTRA and TSYS must conform in shape if you want to apply operation on Tsys.')
         self.assertNotEqual(pos,-1,
                             msg='Unexpected exception was thrown: %s'%(str(e)))
Example #7
0
 def test002(self):
     """Test 002: Bad shaped factor"""
     factor = [2.0,3.0]
     try:
         res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=False,outfile=self.outfile)
         self.assertTrue(False,
                         msg='The task must throw exception')
     except Exception, e:
         pos=str(e).find('Vector size must be 1 or be same as number of channel.')
         self.assertNotEqual(pos,-1,
                             msg='Unexpected exception was thrown: %s'%(str(e)))
Example #8
0
 def test001(self):
     """Test 001: Existing outfile with overwrite=False"""
     os.system('cp -r %s %s'%(self.rawfile,self.outfile))
     try:
         res=sdscaleold(infile=self.rawfile,factor=2.0,outfile=self.outfile)
         self.assertTrue(False,
                         msg='The task must throw exception')
     except Exception, e:
         pos=str(e).find('Output file \'%s\' exists.'%(self.outfile))
         self.assertNotEqual(pos,-1,
                             msg='Unexpected exception was thrown: %s'%(str(e)))
Example #9
0
 def test406(self):
     """Test 406: 2D array ([nrow,nchan]) factor with Tsys scaling (must fail)"""
     factor = [[2.0,4.0,6.0,8.0],[3.0]]
     scaletsys=True
     try:
         res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
         self.assertTrue(False,
                         msg='The task must throw exception')
     except Exception, e:
         pos=str(e).find('SPECTRA and TSYS must conform in shape if you want to apply operation on Tsys.')
         self.assertNotEqual(pos,-1,
                             msg='Unexpected exception was thrown: %s'%(str(e)))            
Example #10
0
 def test403(self):
     """Test 403: 1D array factor without Tsys scaling (must fail)"""
     factor = [2.0,3.0,4.0,5.0]
     scaletsys=False
     try:
         res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
         self.assertTrue(False,
                         msg='The task must throw exception')
     except Exception, e:
         pos=str(e).find('All spectra in the input scantable must have the same number of channel for vector operation.')
         self.assertNotEqual(pos,-1,
                             msg='Unexpected exception was thrown: %s'%(str(e)))
Example #11
0
 def test402(self):
     """Test 402: 1D array factor with Tsys scaling (must fail)"""
     factor = [2.0,3.0,4.0,5.0]
     scaletsys=True
     try:
         res=sdscaleold(infile=self.rawfile,factor=factor,scaletsys=scaletsys,outfile=self.outfile)
         self.assertTrue(False,
                         msg='The task must throw exception')
     except Exception, e:
         pos=str(e).find('ArrayColumn::getColumn cannot be done for column SPECTRA; the array shapes vary: Table array conformance error')
         self.assertNotEqual(pos,-1,
                             msg='Unexpected exception was thrown: %s'%(str(e)))
Example #12
0
 def test000(self):
     """Test 000: Default parameters"""
     # argument verification error
     res=sdscaleold()
     self.assertFalse(res)