diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
index fd95ceaa8458e4f875b37f994d696c4f071f6182..441f137d9cc2abe4f0e779264b85b75e42265f6a 100644
--- a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
+++ b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
@@ -1,13 +1,14 @@
-from .holography_specification import HolographySpecification
-from .holography_dataset_definitions import *
-
-from lofar.calibration.common.datacontainers.holography_observation import HolographyObservation
 import logging
-import numpy
+
 import h5py
 
+from lofar.calibration.common.datacontainers.holography_observation import HolographyObservation
+from .holography_dataset_definitions import *
+from .holography_specification import HolographySpecification
+
 logger = logging.getLogger(__name__)
 
+
 class HolographyDataset():
     def __init__(self):
         '''
@@ -39,18 +40,18 @@ class HolographyDataset():
         self.rotation_matrix = None  # array(3,3), translation matrix for
         # (RA, DEC) <-> (l, m) conversion
 
-        self.beamlets = list() # list of beamlet numbers
+        self.beamlets = list()  # list of beamlet numbers
         # coordinates of the antenna position in the target
         self.antenna_field_position = []
         # station
         self.reference_stations = list()  # list of reference station names
         self.frequencies = list()  # list of frequencies
-        self.ra_dec = dict() # array(Nfrequency, Nbeamlets) contains the ra_dec of which a beam
+        self.ra_dec = dict()  # array(Nfrequency, Nbeamlets) contains the ra_dec of which a beam
         # points at given a frequency and a beamlet number
         # numpy.dtype([('RA', numpy.float64),
         #              ('DEC',numpy.float64),
         #              ('EPOCH', 'S10')]) 
-        self.data = dict() # array(NreferenceStations, Nfrequencies, Nbeamlets) that contains the
+        self.data = dict()  # array(NreferenceStations, Nfrequencies, Nbeamlets) that contains the
         # 4 polarization crosscorrelation for the 4 polarizations, the l and m coordinates, and
         # the timestamp in mjd of the sample, and whether or not the data has been flagged
         # numpy.dtype([('XX', numpy.float),
@@ -79,7 +80,8 @@ class HolographyDataset():
                 if isinstance(dict1[key], dict) and isinstance(dict2[key], dict):
                     result = result and HolographyDataset.compare_dicts(dict1[key], dict2[key])
                 else:
-                    if isinstance(dict1[key], numpy.ndarray) and isinstance(dict2[key], numpy.ndarray):
+                    if isinstance(dict1[key], numpy.ndarray) and isinstance(dict2[key],
+                                                                            numpy.ndarray):
                         # Compares element by element the two arrays
                         return numpy.array_equal(dict1[key], dict2[key])
                     else:
@@ -88,7 +90,7 @@ class HolographyDataset():
 
                 return False
         return result
-    
+
     def __eq__(self, hds=None):
         '''
         This comparison operator compares the values of the relevant members of
@@ -107,10 +109,13 @@ class HolographyDataset():
                 other_value = getattr(hds, attribute_name)
                 this_equality = True
                 try:
-                    if isinstance(attribute_value, numpy.ndarray) is True and isinstance(other_value, numpy.ndarray) is True:
+                    if isinstance(attribute_value, numpy.ndarray) is True and isinstance(
+                            other_value, numpy.ndarray) is True:
                         this_equality = numpy.array_equal(attribute_value, other_value)
-                    elif isinstance(attribute_value, dict) is True and isinstance(other_value, dict) is True:
-                        this_equality = HolographyDataset.compare_dicts(attribute_value, other_value)
+                    elif isinstance(attribute_value, dict) is True and isinstance(other_value,
+                                                                                  dict) is True:
+                        this_equality = HolographyDataset.compare_dicts(attribute_value,
+                                                                        other_value)
                     elif attribute_value != other_value:
                         this_equality = False
                 except Exception as e:
@@ -141,7 +146,6 @@ class HolographyDataset():
         self.__collect_preliminary_information(station_name, list_of_hbs_ms_tuples)
         self.__read_data(station_name, list_of_hbs_ms_tuples)
 
-
     def __read_data(self, station_name, list_of_hbs_ms_tuples):
         """
 
@@ -158,12 +162,15 @@ class HolographyDataset():
                 frequency_string = str(frequency)
                 for beamlet in self.beamlets:
                     beamlet_string = str(beamlet)
-                    reference_station_names, cross_correlation =\
-                        ho.ms_for_a_given_beamlet_number[beamlet].\
-                        read_cross_correlation_time_flags_per_station_names(station_name,
-                                                                 self.reference_stations)
-
-                    for reference_station_index, reference_station in\
+                    reference_station_names, cross_correlation = \
+                        ho.ms_for_a_given_beamlet_number[
+                            beamlet].read_cross_correlation_time_flags_lm_per_station_name(
+                            station_name,
+                            self.reference_stations,
+                            self.ra_dec[frequency_string][beamlet_string],
+                            self.rotation_matrix)
+
+                    for reference_station_index, reference_station in \
                             enumerate(reference_station_names):
 
                         if reference_station not in self.data:
@@ -175,7 +182,6 @@ class HolographyDataset():
                         self.data[reference_station][frequency_string][beamlet_string] = \
                             cross_correlation[reference_station_index, :]
 
-
     def __collect_preliminary_information(self, station_name, list_of_hbs_ho_tuples):
         """
         This routines reads both the holography beam specifications files and the holography
@@ -216,7 +222,7 @@ class HolographyDataset():
                         (beam_specification.station_pointing['ra'],
                          beam_specification.station_pointing['dec'],
                          beam_specification.station_pointing['coordinate_system']
-                        ))
+                         ))
                     if start_mjd is None or start_mjd > ho.start_mjd:
                         start_mjd = ho.start_mjd
 
@@ -237,7 +243,7 @@ class HolographyDataset():
 
                     beamlets.add(single_beamlet)
 
-                    virtual_pointing[(ho.frequency, single_beamlet)] =\
+                    virtual_pointing[(ho.frequency, single_beamlet)] = \
                         (beam_specification.virtual_pointing['ra'],
                          beam_specification.virtual_pointing['dec'],
                          beam_specification.virtual_pointing['coordinate_system'])
@@ -252,10 +258,10 @@ class HolographyDataset():
         self.rcu_list = list(rcu_list)
 
         self.ra_dec = dict()
-        coordinate_type = numpy.dtype([('RA', numpy.float64), 
+        coordinate_type = numpy.dtype([('RA', numpy.float64),
                                        ('DEC', numpy.float64),
                                        ('EPOCH', 'S10')])
-             
+
         for frequency in self.frequencies:
             frequency_string = str(frequency)
             if frequency not in self.ra_dec:
@@ -266,12 +272,11 @@ class HolographyDataset():
                     virtual_pointing[(frequency, beamlet)],
                     dtype=coordinate_type)
 
-
         # reads the target station position and the coordinate of its axes
         # and does this only once since the coordinate will not change
         first_holography_observation = list_of_hbs_ho_tuples[0][1]
         first_ms = first_holography_observation.ms_for_a_given_beamlet_number.values()[0]
-        station_position, tile_offset, axes_coordinates = first_ms.\
+        station_position, tile_offset, axes_coordinates = first_ms. \
             get_station_position_tile_offsets_and_axes_coordinate_for_station_name(
             station_name)
 
@@ -285,7 +290,7 @@ class HolographyDataset():
                          ' The target stations for this observation are %s',
                          station_name, target_stations)
             raise Exception('Station %s was not involved in the observation.'
-                            % station_name,)
+                            % station_name, )
 
         if len(mode) > 1:
             raise ValueError('Multiple RCUs mode are not supported')
@@ -304,7 +309,7 @@ class HolographyDataset():
             self.source_name = source_name.pop()
 
     @staticmethod
-    def print_info(hds, text = None):
+    def print_info(hds, text=None):
         if text is not None and isinstance(text, str):
             print("%s" % (text))
         if hds is not None and isinstance(hds, HolographyDataset) is True:
@@ -342,7 +347,7 @@ class HolographyDataset():
 
             result = HolographyDataset()
             result.version = f.attrs[HDS_VERSION]
-            result.mode= f.attrs[HDS_MODE]
+            result.mode = f.attrs[HDS_MODE]
             result.rcu_list = list(f.attrs[HDS_RCU_LIST])
             result.sas_ids = list(f.attrs[HDS_SAS_ID])
             result.target_station_name = f.attrs[HDS_TARGET_STATION_NAME]
@@ -374,11 +379,14 @@ class HolographyDataset():
                             result.data[reference_station] = dict()
                         if frequency not in result.data[reference_station]:
                             result.data[reference_station][frequency] = dict()
-                        result.data[reference_station][frequency][beamlet] = numpy.array(f["CROSSCORRELATION"][reference_station][frequency][beamlet])
+                        result.data[reference_station][frequency][beamlet] = numpy.array(
+                            f["CROSSCORRELATION"][reference_station][frequency][beamlet])
 
             result.beamlets = list(beamlets)
         except Exception as e:
-            logger.exception("Cannot read the Holography Data Set data from the HDF5 file \"%s\".  This is the exception that was thrown:  %s", path, e)
+            logger.exception(
+                "Cannot read the Holography Data Set data from the HDF5 file \"%s\".  This is the exception that was thrown:  %s",
+                path, e)
             raise e
         finally:
             if f is not None:
@@ -408,15 +416,15 @@ class HolographyDataset():
 
             # Moan...  Again this needs to be stored like that.
             f.attrs[HDS_SAS_ID] = numpy.array(self.sas_ids,
-                                              dtype = h5py.special_dtype(vlen=str))
+                                              dtype=h5py.special_dtype(vlen=str))
             f.attrs[HDS_TARGET_STATION_NAME] = self.target_station_name
             f.attrs[HDS_TARGET_STATION_POSITION] = self.target_station_position
             f.attrs[HDS_SOURCE_NAME] = self.source_name
-            
-            coordinate_type = numpy.dtype([('RA', numpy.float64), 
+
+            coordinate_type = numpy.dtype([('RA', numpy.float64),
                                            ('DEC', numpy.float64),
                                            ('EPOCH', 'S10')])
-            
+
             f.attrs[HDS_SOURCE_POSITION] = numpy.array(self.source_position,
                                                        dtype=coordinate_type)
             f.attrs[HDS_OBSERVATION_TIME] = numpy.array([self.start_time, self.end_time])
@@ -433,7 +441,7 @@ class HolographyDataset():
             # in an array.  The reference station name, the frequency and the
             # beamlet number (index of the data sample array) allow random
             # access of the data.
-            
+
             f.create_group("RA_DEC")
             for frequency in self.ra_dec.keys():
                 f["RA_DEC"].create_group(frequency)
@@ -446,10 +454,12 @@ class HolographyDataset():
                 for frequency in self.data[reference_station].keys():
                     f["CROSSCORRELATION"][reference_station].create_group(frequency)
                     for beamlet in self.data[reference_station][frequency].keys():
-                        
-                        f["CROSSCORRELATION"][reference_station][frequency][beamlet] = self.data[reference_station][frequency][beamlet]
+                        f["CROSSCORRELATION"][reference_station][frequency][beamlet] = \
+                            self.data[reference_station][frequency][beamlet]
         except Exception as e:
-            logger.exception("Cannot write the Holography Data Set data to the HDF5 file \"%s\".  This is the exception that was thrown:  %s", path, e)
+            logger.exception(
+                "Cannot write the Holography Data Set data to the HDF5 file \"%s\".  This is the exception that was thrown:  %s",
+                path, e)
             raise e
         finally:
             if f is not None: