From 634958f7bb9640c5012bb1a6834b3f5048896640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20J=C3=BCrges?= <jurges@astron.nl> Date: Fri, 28 Sep 2018 08:36:11 +0000 Subject: [PATCH] Task SSB-42: Added some logs where they are useful --- .../lib/datacontainers/holography_dataset.py | 4 +++- .../lib/datacontainers/holography_observation.py | 5 +++++ .../lib/datacontainers/holography_specification.py | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py index f53b7c5b062..bc53dc5b520 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py @@ -6,7 +6,7 @@ from lofar.calibration.common.datacontainers.holography_observation import Holog from .holography_dataset_definitions import * from .holography_specification import HolographySpecification -logger = logging.getLogger(__name__) +logger = logging.getLogger(__file__) class HolographyDataset(): @@ -137,8 +137,10 @@ class HolographyDataset(): :param hb_specifications: a list containing (hbs, ms) per frequency """ + logger.info("Creating a holography data set for station \"%s\"...", station_name) self.__collect_preliminary_information(station_name, list_of_hbs_ms_tuples) self.__read_data(station_name, list_of_hbs_ms_tuples) + logger.info("Creation of a holography data set for station \"%s\" done.", station_name) def __read_data(self, station_name, list_of_hbs_ms_tuples): """ diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py b/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py index 3af56f86790..14236e02c8a 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py @@ -3,6 +3,9 @@ import os import astropy.time as astrotime from datetime import datetime from .holography_measurementset import HolographyMeasurementSet +import logging + +logger = logging.getLogger(__file__) class HolographyObservation(): def __init__(self, path, sas_id, ms_for_a_given_beamlet_number, start_mjd_in_seconds, @@ -93,6 +96,7 @@ class HolographyObservation(): :return: a list of HolographyObservation :rtype: list[HolographyObservation] """ + logger.info("Loading holography observations from \"%s\"...", path) ms_dir_name_pattern = 'L(?P<sas_id>\d{6})' ms_dirs_path_pattern = '^' + os.path.join(path, ms_dir_name_pattern, 'uv$') observations_list = [] @@ -144,6 +148,7 @@ class HolographyObservation(): start_mjd_in_seconds, end_mjd_in_seconds, sub_band, frequency, source_name)) + logger.info("Holography observations were successfully loaded from \"%s\".", path) return observations_list @staticmethod diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py b/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py index 584fe3a5730..31e1092c67d 100644 --- a/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py +++ b/CAL/CalibrationCommon/lib/datacontainers/holography_specification.py @@ -3,7 +3,9 @@ import os import re from collections import defaultdict from glob import glob +import logging +logger = logging.getLogger(__file__) class HolographyStationBeamSpecification(object): """ @@ -66,6 +68,7 @@ class HolographySpecification(object): :return: the list of Holography Specifications :rtype: list[HolographySpecification] """ + logger.info("Loading holography beam specifications from \"%s\"...", path) bsf_files_name_pattern = 'Holog-*.txt' bsf_files_path_pattern = os.path.join(path, bsf_files_name_pattern) matched_path_list = glob(bsf_files_path_pattern) @@ -75,6 +78,7 @@ class HolographySpecification(object): matched_file_path_list)) holography_beam_specification = HolographySpecification.create_hs_list_from_name_list_and_path( matched_file_name_list, path) + logger.info("Loading holography beam specifications were successfully loaded from \"%s\".", path) return holography_beam_specification def get_beam_specifications_per_station_name(self, station_name): @@ -88,10 +92,12 @@ class HolographySpecification(object): return self.station_specification_map[station_name] def read_file(self): + logger.debug("Reading holography file \"%s\"...", self.path) lines = self._read_lines() self._parse_header(lines[0]) self._parse_lines(lines[1:]) self._update_class_attributes() + logger.debug("Reading holography file \"%s\" done.", self.path) @staticmethod def create_hs_list_from_name_list_and_path(name_list, path): -- GitLab