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

SSB-42: fixing antenna names return function and getting rid of default

dicts
parent 585442fb
No related branches found
No related tags found
1 merge request!44Merge back holography to master
...@@ -2,7 +2,6 @@ from .holography_specification import HolographySpecification ...@@ -2,7 +2,6 @@ from .holography_specification import HolographySpecification
from lofar.calibration.common.datacontainers.holography_observation import HolographyObservation from lofar.calibration.common.datacontainers.holography_observation import HolographyObservation
import logging import logging
import numpy import numpy
from collections import defaultdict
import h5py import h5py
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -57,8 +56,8 @@ class HolographyDataset(): ...@@ -57,8 +56,8 @@ class HolographyDataset():
:return: :return:
""" """
self.data = defaultdict(defaultdict) self.data = dict()
self.flags = defaultdict(defaultdict) self.flags = dict()
for hbs, ho in list_of_hbs_ms_tuples: for hbs, ho in list_of_hbs_ms_tuples:
if station_name in hbs.target_station_names: if station_name in hbs.target_station_names:
frequency = ho.frequency frequency = ho.frequency
...@@ -68,10 +67,22 @@ class HolographyDataset(): ...@@ -68,10 +67,22 @@ class HolographyDataset():
ho.ms_for_a_given_beamlet_number[beamlet].\ ho.ms_for_a_given_beamlet_number[beamlet].\
read_cross_correlation_time_flags_per_station_names(station_name, read_cross_correlation_time_flags_per_station_names(station_name,
self.reference_stations) self.reference_stations)
print(reference_station_names)
for reference_station_index, reference_station in\ for reference_station_index, reference_station in\
enumerate(reference_station_names): 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] = \ self.data[reference_station][frequency][beamlet] = \
cross_correlation[reference_station_index, :, :] cross_correlation[reference_station_index, :, :]
self.flags[reference_station][frequency][beamlet] = \ self.flags[reference_station][frequency][beamlet] = \
......
...@@ -133,9 +133,6 @@ class HolographyMeasurementSet(object): ...@@ -133,9 +133,6 @@ class HolographyMeasurementSet(object):
antennas_table = self.get_antenna_table() antennas_table = self.get_antenna_table()
try: try:
antenna_name_index = antennas_table.index('NAME')
baseline_selection = ','.join(reference_stations) baseline_selection = ','.join(reference_stations)
baseline_selection += '&' + target_station baseline_selection += '&' + target_station
...@@ -155,13 +152,13 @@ class HolographyMeasurementSet(object): ...@@ -155,13 +152,13 @@ class HolographyMeasurementSet(object):
flags = table.getcol('FLAG_ROW') flags = table.getcol('FLAG_ROW')
crosscorrelations = numpy.squeeze(table.getcol('DATA')) crosscorrelations = numpy.squeeze(table.getcol('DATA'))
antenna1 = table.getcol('ANTENNA1') n_reference_stations = len(reference_stations)
antenna2 = table.getcol('ANTENNA2') 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 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] timestamps = timestamps[::n_reference_stations]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment