Esempio n. 1
0
 def test203(self):
     """Test 203: 1D array factor without Tsys scaling"""
     factor = [2.0, 3.0, 4.0, 5.0]
     scaletsys = False
     res = sdscale(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)
Esempio n. 2
0
 def test304(self):
     """Test 304: 2D array ([nrow,1]) factor with Tsys scaling"""
     factor = [[2.0], [3.0]]
     scaletsys = True
     res = sdscale(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)
Esempio n. 3
0
 def test401(self):
     """Test 401: scalar factor without Tsys scaling"""
     factor = 2.0
     scaletsys = False
     res = sdscale(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)
Esempio n. 4
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 = sdscale(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)
Esempio n. 5
0
    def testflag02(self):
        """Testflag: verify proper handling of flag information for scaletsys=False"""
        scaletsys = False
        res = sdscale(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)
Esempio n. 6
0
 def test001(self):
     """Test 001: Existing outfile with overwrite=False"""
     os.system("cp -r %s %s" % (self.rawfile, self.outfile))
     try:
         res = sdscale(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)))
Esempio n. 7
0
 def test002(self):
     """Test 002: Bad shaped factor"""
     factor = [2.0, 3.0]
     try:
         res = sdscale(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)))
Esempio n. 8
0
 def test003(self):
     """Test 003: Try to scale non-conform Tsys"""
     factor = [1.0, 2.0, 3.0, 4.0]
     try:
         res = sdscale(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)))
Esempio n. 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 = sdscale(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)))
Esempio n. 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 = sdscale(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)))
Esempio n. 11
0
 def test203(self):
     """Test 203: 1D array factor without Tsys scaling"""
     factor = [2.0, 3.0, 4.0, 5.0]
     scaletsys = False
     res = sdscale(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)
Esempio n. 12
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 = sdscale(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)))
Esempio n. 13
0
 def test401(self):
     """Test 401: scalar factor without Tsys scaling"""
     factor = 2.0
     scaletsys = False
     res = sdscale(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)
Esempio n. 14
0
 def test304(self):
     """Test 304: 2D array ([nrow,1]) factor with Tsys scaling"""
     factor = [[2.0], [3.0]]
     scaletsys = True
     res = sdscale(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)
Esempio n. 15
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 = sdscale(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)
Esempio n. 16
0
    def testflag02(self):
        """Testflag: verify proper handling of flag information for scaletsys=False"""
        scaletsys = False
        res = sdscale(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)
Esempio n. 17
0
 def test001(self):
     """Test 001: Existing outfile with overwrite=False"""
     os.system('cp -r %s %s' % (self.rawfile, self.outfile))
     try:
         res = sdscale(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)))
Esempio n. 18
0
 def test002(self):
     """Test 002: Bad shaped factor"""
     factor = [2.0, 3.0]
     try:
         res = sdscale(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)))
Esempio n. 19
0
 def test003(self):
     """Test 003: Try to scale non-conform Tsys"""
     factor = [1.0, 2.0, 3.0, 4.0]
     try:
         res = sdscale(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)))
Esempio n. 20
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 = sdscale(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)))
Esempio n. 21
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 = sdscale(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)))
Esempio n. 22
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 = sdscale(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)))
Esempio n. 23
0
 def test000(self):
     """Test 000: Default parameters"""
     # argument verification error
     res = sdscale()
     self.assertFalse(res)
Esempio n. 24
0
 def test000(self):
     """Test 000: Default parameters"""
     # argument verification error
     res = sdscale()
     self.assertFalse(res)