Skip to content
Snippets Groups Projects
Commit 38128abf authored by Mattia Mancini's avatar Mattia Mancini
Browse files

SSB-47: skipping undefined beamlets

parent bd6810c9
No related branches found
No related tags found
1 merge request!44Merge back holography to master
...@@ -7,7 +7,7 @@ from .calibration_table import CalibrationTable ...@@ -7,7 +7,7 @@ from .calibration_table import CalibrationTable
from .holography_dataset_definitions import * from .holography_dataset_definitions import *
from .holography_observation import HolographyObservation from .holography_observation import HolographyObservation
from .holography_specification import HolographySpecification from .holography_specification import HolographySpecification
from numpy import isnan
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
...@@ -201,6 +201,8 @@ class HolographyDataset(): ...@@ -201,6 +201,8 @@ class HolographyDataset():
# and iterate over the beamlets. # and iterate over the beamlets.
for beamlet in beamlets: for beamlet in beamlets:
beamlet_string = str(beamlet) beamlet_string = str(beamlet)
if beamlet_string not in ra_dec[frequency_string]:
continue
ra = ra_dec[frequency_string][beamlet_string]['RA'] ra = ra_dec[frequency_string][beamlet_string]['RA']
dec = ra_dec[frequency_string][beamlet_string]['DEC'] dec = ra_dec[frequency_string][beamlet_string]['DEC']
...@@ -289,6 +291,12 @@ class HolographyDataset(): ...@@ -289,6 +291,12 @@ class HolographyDataset():
frequency_string = str(frequency) frequency_string = str(frequency)
for beamlet in self.beamlets: for beamlet in self.beamlets:
beamlet_string = str(beamlet) 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 = \ reference_station_names, cross_correlation = \
ho.ms_for_a_given_beamlet_number[ ho.ms_for_a_given_beamlet_number[
beamlet].read_cross_correlation_time_flags_lm_per_station_name( beamlet].read_cross_correlation_time_flags_lm_per_station_name(
...@@ -392,6 +400,13 @@ class HolographyDataset(): ...@@ -392,6 +400,13 @@ class HolographyDataset():
self.ra_dec[frequency_string] = dict() self.ra_dec[frequency_string] = dict()
for beamlet in self.beamlets: for beamlet in self.beamlets:
beamlet_string = str(beamlet) 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( self.ra_dec[frequency_string][beamlet_string] = numpy.array(
virtual_pointing[(frequency, beamlet)], virtual_pointing[(frequency, beamlet)],
dtype=HDS_coordinate_type) dtype=HDS_coordinate_type)
......
...@@ -165,7 +165,7 @@ def _split_line(line): ...@@ -165,7 +165,7 @@ def _split_line(line):
:rtype: dict :rtype: dict
""" """
range_regex = '(\d*\:\d*)|(\d*)' 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*' \ regex = r'^(?P<station_name>\w*)\s*' \
r'(?P<mode_description>\w*)\s*' \ r'(?P<mode_description>\w*)\s*' \
r'(?P<sub_band>[\d,]*)\s*' \ r'(?P<sub_band>[\d,]*)\s*' \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment