diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py index 57df89efc08f6b8e318353bdd3adda373aec7c1e..56dace9c2663e8d42c70226a0e374133b3cc823f 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py @@ -2,7 +2,6 @@ from .holography_specification import HolographySpecification from lofar.calibration.common.datacontainers.holography_observation import HolographyObservation import logging import numpy -from collections import defaultdict import h5py logger = logging.getLogger(__name__) @@ -57,8 +56,8 @@ class HolographyDataset(): :return: """ - self.data = defaultdict(defaultdict) - self.flags = defaultdict(defaultdict) + self.data = dict() + self.flags = dict() for hbs, ho in list_of_hbs_ms_tuples: if station_name in hbs.target_station_names: frequency = ho.frequency @@ -68,10 +67,22 @@ class HolographyDataset(): ho.ms_for_a_given_beamlet_number[beamlet].\ read_cross_correlation_time_flags_per_station_names(station_name, self.reference_stations) - + print(reference_station_names) for reference_station_index, reference_station in\ enumerate(reference_station_names): - print(reference_station_index) + + if reference_station not in self.data: + self.data[reference_station] = dict() + + if reference_station not in self.flags: + self.flags[reference_station] = dict() + + if frequency not in self.data[reference_station]: + self.data[reference_station][frequency] = dict() + + if frequency not in self.flags[reference_station]: + self.flags[reference_station][frequency] = dict() + self.data[reference_station][frequency][beamlet] = \ cross_correlation[reference_station_index, :, :] self.flags[reference_station][frequency][beamlet] = \ diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py index bb8eb59866cba3c9d1d905557417ba0ca6e04c23..efd360e3df4ec6feb0aafb083730a8205699a6ce 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py @@ -133,9 +133,6 @@ class HolographyMeasurementSet(object): antennas_table = self.get_antenna_table() try: - - antenna_name_index = antennas_table.index('NAME') - baseline_selection = ','.join(reference_stations) baseline_selection += '&' + target_station @@ -155,13 +152,13 @@ class HolographyMeasurementSet(object): flags = table.getcol('FLAG_ROW') crosscorrelations = numpy.squeeze(table.getcol('DATA')) - antenna1 = table.getcol('ANTENNA1') - antenna2 = table.getcol('ANTENNA2') + n_reference_stations = len(reference_stations) + antenna1 = table.getcol('ANTENNA_NAME1')[:n_reference_stations] + antenna2 = table.getcol('ANTENNA_NAME2')[:n_reference_stations] reference_stations_names = [a2 if a1 == target_station else a1 - for a1, a2 in zip(antenna1, antenna2)] + for a1, a2 in zip(antenna1, antenna2)] - n_reference_stations = len(reference_stations) timestamps = timestamps[::n_reference_stations]