Commits
Yohei Hayashi authored 407e5408b93
524 524 | of specifycal() executed within gencal(), the values loaded from a csv file |
525 525 | with factors or obtained from the Jy/K Web API are given as the 'parameter' |
526 526 | argument. |
527 527 | |
528 528 | Details are as follows. |
529 529 | https://open-jira.nrao.edu/browse/CAS-12236 |
530 530 | """ |
531 531 | test_tmp_dir = 'tmp_test_gencal' |
532 532 | |
533 533 | ms_key = 'uid___A002_X85c183_X36f.ms' |
534 - | vis = os.path.join(self.test_tmp_dir, ms_key) |
534 + | vis = os.path.join(test_tmp_dir, ms_key) |
535 535 | test_data_path = ctsys.resolve('measurementset/almasd') |
536 536 | test_data_path = 'test_data' # should move test data collection |
537 537 | |
538 + | caltable = os.path.join(test_tmp_dir, 'generated_caltable_by_gencal.cal') |
539 + | |
540 + | def setUp(self): |
541 + | self._delete_dir(self.caltable) |
542 + | |
543 + | def tearDown(self): |
544 + | self._delete_dir(self.caltable) |
545 + | |
538 546 | |
539 547 | def setUpClass(cls): |
540 548 | if os.path.exists(cls.test_tmp_dir): |
541 549 | shutil.rmtree(cls.test_tmp_dir) |
542 550 | |
543 551 | os.mkdir(cls.test_tmp_dir) |
544 552 | |
545 553 | original_vis = os.path.join(cls.test_data_path, '.'.join([cls.ms_key, 'sel'])) |
546 554 | shutil.copytree(original_vis, cls.vis, symlinks=False) |
547 555 | |
568 576 | def test_jyperk_gencal_for_factor_file(self): |
569 577 | """Test to check that the factors in the csv file are applied to the caltable. |
570 578 | |
571 579 | The following arguments are required for this test. |
572 580 | * caltype='jyperk' |
573 581 | * infile |
574 582 | """ |
575 583 | jyperk_factor_csv = self._copy_file('jyperk_factor.csv') |
576 584 | reference_caltable = self._copy_dir('ref_caltable_for_jyperk_with_factor_file.cal') |
577 585 | |
578 - | caltable = '/'.join([self.test_tmp_dir, 'caltable_for_jyperk_with_factor_file.cal']) |
579 - | self._delete_dir(caltable) |
580 - | |
581 586 | gencal(vis=self.vis, |
582 - | caltable=caltable, |
587 + | caltable=self.caltable, |
583 588 | caltype='jyperk', |
584 589 | infile=jyperk_factor_csv, |
585 590 | uniform=False |
586 591 | ) |
587 - | self.assertTrue(os.path.exists(caltable)) |
588 - | self.assertTrue(th.compTables(caltable, reference_caltable, ['WEIGHT'])) |
592 + | self.assertTrue(os.path.exists(self.caltable)) |
593 + | self.assertTrue(th.compTables(self.caltable, reference_caltable, ['WEIGHT'])) |
589 594 | |
590 595 | |
591 596 | def suite(): |
592 597 | return [gencal_antpostest, |
593 598 | test_gencal_antpos_alma, |
594 599 | gencal_test_tec_vla, |
595 600 | gencal_gaincurve_test, |
596 601 | gencal_tsys_test] |
597 602 | |
598 603 | if is_CASA6: |