Commits
239 239 | else: |
240 240 | self.fail('Data does not exist -> '+fpath) |
241 241 | |
242 242 | default('fluxscale') |
243 243 | |
244 244 | |
245 245 | def tearDown(self): |
246 246 | shutil.rmtree(self.msfile, ignore_errors=True) |
247 247 | os.system('rm -rf ngc4826*.gcal') |
248 248 | os.system('rm -rf ngc4826*.fcal') |
249 - | pass |
250 249 | |
251 250 | def test_spws(self): |
252 251 | '''Fluxscale 2: Create a fluxscale table for an MS with many spws''' |
253 252 | # Input |
254 253 | gtable = self.gtable |
255 254 | |
256 255 | # Output |
257 256 | outtable = self.msfile + '.fcal' |
258 257 | |
259 258 | # torelance for value tests |
447 446 | fpath = os.path.join(datapath,self.gtable) |
448 447 | shutil.copytree(fpath, self.gtable, symlinks=True) |
449 448 | fpath = os.path.join(datapath,self.reffile) |
450 449 | shutil.copytree(fpath, self.reffile, symlinks=True) |
451 450 | else: |
452 451 | self.fail('Data does not exist -> '+fpath) |
453 452 | |
454 453 | default('fluxscale') |
455 454 | |
456 455 | def tearDown(self): |
457 - | #shutil.rmtree(self.msfile, ignore_errors=True) |
458 - | #os.system('rm -rf twhya*.gcal') |
459 - | #os.system('rm -rf twhya*.fcal') |
460 - | pass |
456 + | shutil.rmtree(self.msfile, ignore_errors=True) |
457 + | os.system('rm -rf twhya*.gcal') |
458 + | os.system('rm -rf twhya*.fcal') |
461 459 | |
462 460 | def test_spectralfit1(self): |
463 461 | '''Fluxscale spectral fit test1''' |
464 462 | # Input |
465 463 | gtable = self.gtable |
466 464 | |
467 465 | # Output |
468 466 | outtable = self.prefix + '.fittest.fcal' |
469 467 | |
470 468 | # torelance for value test |
549 547 | |
550 548 | |
551 549 | diff_fluxd=abs(refdict['0']['0']['fluxd'][0]-thisdict['0']['0']['fluxd'][0])/refdict['0']['0']['fluxd'][0] |
552 550 | self.assertTrue(diff_fluxd<tol) |
553 551 | |
554 552 | diff_covar=abs(refdict['3']['covarMat'][0][0]-thisdict['3']['covarMat'][0][0])/refdict['3']['covarMat'][0][0] |
555 553 | self.assertTrue(diff_covar<tol) |
556 554 | |
557 555 | |
558 556 | def test_spectralfit2(self): |
559 - | '''Fluxscale spectral fit test2: fit order higer than 2 (fitorder=4) ''' |
557 + | '''Fluxscale spectral fit test2: fit order higher than 2 (fitorder=4) ''' |
560 558 | # Input |
561 559 | gtable = self.gtable |
562 560 | |
563 561 | # Output |
564 562 | outtable = self.prefix + '.fittest.fcal' |
565 563 | |
566 564 | # torelance for value test |
567 565 | tol = 1.e-5 |
568 566 | |
569 567 | thisdict = fluxscale(vis=self.msfile, caltable=gtable, fluxtable=outtable, reference='1', |