diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py index 2a8782ac50c7b4eb22dc8e7486ae399d2584a9d9..20ba1e2623f5bf3a61487adae34b37b773e5d5af 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py @@ -7,7 +7,7 @@ from .calibration_table import CalibrationTable from .holography_dataset_definitions import * from .holography_observation import HolographyObservation from .holography_specification import HolographySpecification - +from numpy import isnan logger = logging.getLogger(__file__) @@ -201,6 +201,8 @@ class HolographyDataset(): # and iterate over the beamlets. for beamlet in beamlets: beamlet_string = str(beamlet) + if beamlet_string not in ra_dec[frequency_string]: + continue ra = ra_dec[frequency_string][beamlet_string]['RA'] dec = ra_dec[frequency_string][beamlet_string]['DEC'] @@ -289,6 +291,12 @@ class HolographyDataset(): frequency_string = str(frequency) for beamlet in self.beamlets: beamlet_string = str(beamlet) + if beamlet_string not in self.ra_dec[frequency_string]: + logger.error('missing pointing %s at frequency %s for station %s skipping', + beamlet_string, + frequency_string, + station_name) + continue reference_station_names, cross_correlation = \ ho.ms_for_a_given_beamlet_number[ beamlet].read_cross_correlation_time_flags_lm_per_station_name( @@ -392,6 +400,13 @@ class HolographyDataset(): self.ra_dec[frequency_string] = dict() for beamlet in self.beamlets: beamlet_string = str(beamlet) + ra, dec, _ = virtual_pointing[(frequency, beamlet)] + if isnan(ra) or isnan(dec): + logger.error('skipping pointing %s for frequency %s malformed : %s', + beamlet_string, frequency_string, virtual_pointing[(frequency, beamlet)]) + # skip if the pointing is ill specified + continue + self.ra_dec[frequency_string][beamlet_string] = numpy.array( virtual_pointing[(frequency, beamlet)], dtype=HDS_coordinate_type) diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py b/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py index 55a5ac10b1028ff83b6a0caf22918ef59e77b569..ce432c430512325021cb8903e65977f5f4c8c997 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py @@ -165,7 +165,7 @@ def _split_line(line): :rtype: dict """ range_regex = '(\d*\:\d*)|(\d*)' - ra_dec_regex = '\d*\.\d*,-?\d*\.\d*,\w*' + ra_dec_regex = '(\d*\.\d*|nan),(-?\d*\.\d*|nan),(\w*)' regex = r'^(?P<station_name>\w*)\s*' \ r'(?P<mode_description>\w*)\s*' \ r'(?P<sub_band>[\d,]*)\s*' \