-
Thomas Jürges authoredThomas Jürges authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
t_holography_dataset_class.py 1.44 KiB
import logging
import unittest
import tempfile
import os
from lofar.calibration.common.datacontainers import HolographyDataset, HolographySpecification
from lofar.calibration.common.datacontainers import HolographyObservation
logger = logging.getLogger('t_holography_dataset_class')
# READ doc/Holography_Data_Set.md! It contains the location from which the
# test data must be downloaded.
path_to_test_data = '/data/test/HolographyObservation'
path_to_test_data = '/home/thomas/workspace.astron/data/holography'
class TestHolographyDatasetClass(unittest.TestCase):
def test_create_hds(self):
'''
Reads a Measurement Set from a file and converts it to an HDS.
'''
# Read the MS into memory.
holist = HolographyObservation.list_observations_in_path(path_to_test_data)
hbsflist = HolographySpecification.list_bsf_files_in_path(path_to_test_data)
for hbsf in hbsflist:
hbsf.read_file()
ho_per_ms = [(hbsf, ho) for hbsf, ho in zip(hbsflist, holist)]
# Now create the Holography Data Set in memory from the MS data.
holography_dataset = HolographyDataset()
holography_dataset.load_from_beam_specification_and_ms(
'CS013HBA0', ho_per_ms)
# Make sure the data in memory is OK.
self.assertEqual(holography_dataset.source_name, '3C 147')
if __name__ == '__main__':
logging.basicConfig(format='%(name)s : %(message)s')
unittest.main()