From f308a519edecd8ee92f2fe18552620a569f48d3b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 19 Oct 2020 11:47:53 +0200 Subject: debug log --- lib/lennart/DataProcessor.py | 17 ++++++++++++++--- lib/lennart/EnergyInterface.py | 3 +++ lib/lennart/SigrokAPIInterface.py | 3 +++ lib/lennart/SigrokCLIInterface.py | 3 +++ lib/lennart/SigrokInterface.py | 3 +++ 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/lennart/DataProcessor.py b/lib/lennart/DataProcessor.py index df3f41c..58cc705 100644 --- a/lib/lennart/DataProcessor.py +++ b/lib/lennart/DataProcessor.py @@ -1,3 +1,8 @@ +import logging + +logger = logging.getLogger(__name__) + + class DataProcessor: def __init__(self, sync_data, energy_data): """ @@ -84,7 +89,7 @@ class DataProcessor: (sync_start / 1_000_000, pre_outliers_ts / 1_000_000) ) - # print("SYNC SPOTS: ", datasync_timestamps) + logger.debug(f"Synchronization areas: {datasync_timestamps}") # print(time_stamp_data[2]) start_offset = datasync_timestamps[0][1] - time_stamp_data[2] @@ -92,9 +97,15 @@ class DataProcessor: end_offset = datasync_timestamps[-2][0] - (time_stamp_data[-8] + start_offset) end_timestamp = datasync_timestamps[-2][0] - print(start_timestamp, end_timestamp) + logger.debug( + f"Measurement area: LA timestamp range [{start_timestamp}, {end_timestamp}]" + ) + logger.debug(f"Start/End offsets: {start_offset} / {end_offset}") - # print(start_offset, start_timestamp, end_offset, end_timestamp) + if end_offset > 10: + logger.warning( + f"synchronization end_offset == {end_offset}. It should be no more than a few seconds." + ) with_offset = self.addOffset(time_stamp_data, start_offset) diff --git a/lib/lennart/EnergyInterface.py b/lib/lennart/EnergyInterface.py index 2b23667..19aae84 100644 --- a/lib/lennart/EnergyInterface.py +++ b/lib/lennart/EnergyInterface.py @@ -2,6 +2,9 @@ import re import subprocess from dfatool.lennart.DataInterface import DataInterface +import logging + +logger = logging.getLogger(__name__) class EnergyInterface(DataInterface): diff --git a/lib/lennart/SigrokAPIInterface.py b/lib/lennart/SigrokAPIInterface.py index a2c087a..44da678 100644 --- a/lib/lennart/SigrokAPIInterface.py +++ b/lib/lennart/SigrokAPIInterface.py @@ -6,6 +6,9 @@ import sigrok.core as sr from sigrok.core.classes import * from util.ByteHelper import ByteHelper +import logging + +logger = logging.getLogger(__name__) class SigrokAPIInterface(SigrokInterface): diff --git a/lib/lennart/SigrokCLIInterface.py b/lib/lennart/SigrokCLIInterface.py index d7347ca..b28a8a9 100644 --- a/lib/lennart/SigrokCLIInterface.py +++ b/lib/lennart/SigrokCLIInterface.py @@ -2,6 +2,9 @@ import subprocess import time from dfatool.lennart.SigrokInterface import SigrokInterface +import logging + +logger = logging.getLogger(__name__) class SigrokCLIInterface(SigrokInterface): diff --git a/lib/lennart/SigrokInterface.py b/lib/lennart/SigrokInterface.py index a5eaffc..1733b68 100644 --- a/lib/lennart/SigrokInterface.py +++ b/lib/lennart/SigrokInterface.py @@ -1,6 +1,9 @@ import json from dfatool.lennart.DataInterface import DataInterface +import logging + +logger = logging.getLogger(__name__) # Adding additional parsing functionality -- cgit v1.2.3