summaryrefslogtreecommitdiffstats
path: root/dpd/src/Dab_Util.py
diff options
context:
space:
mode:
Diffstat (limited to 'dpd/src/Dab_Util.py')
-rw-r--r--dpd/src/Dab_Util.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/dpd/src/Dab_Util.py b/dpd/src/Dab_Util.py
index 2021f38..56c9503 100644
--- a/dpd/src/Dab_Util.py
+++ b/dpd/src/Dab_Util.py
@@ -9,7 +9,10 @@ import datetime
import os
import logging
-logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename)
+try:
+ logging_path = os.path.dirname(logging.getLoggerClass().root.handlers[0].baseFilename)
+except AttributeError:
+ logging_path = None
import numpy as np
import matplotlib
@@ -53,7 +56,7 @@ class Dab_Util:
off = sig_rec.shape[0]
c = np.abs(signal.correlate(sig_orig, sig_rec))
- if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot:
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot and logging_path is not None:
dt = datetime.datetime.now().isoformat()
corr_path = (logging_path + "/" + dt + "_tx_rx_corr.svg")
plt.plot(c, label="corr")
@@ -107,7 +110,7 @@ class Dab_Util:
Returns an aligned version of sig_tx and sig_rx by cropping and subsample alignment
"""
- if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot:
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot and logging_path is not None:
dt = datetime.datetime.now().isoformat()
fig_path = logging_path + "/" + dt + "_sync_raw.svg"
@@ -151,7 +154,7 @@ class Dab_Util:
sig_tx = sig_tx[:-1]
sig_rx = sig_rx[:-1]
- if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot:
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot and logging_path is not None:
dt = datetime.datetime.now().isoformat()
fig_path = logging_path + "/" + dt + "_sync_sample_aligned.svg"
@@ -175,7 +178,7 @@ class Dab_Util:
sig_rx = sa.subsample_align(sig_rx, sig_tx)
- if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot:
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot and logging_path is not None:
dt = datetime.datetime.now().isoformat()
fig_path = logging_path + "/" + dt + "_sync_subsample_aligned.svg"
@@ -199,7 +202,7 @@ class Dab_Util:
sig_rx = pa.phase_align(sig_rx, sig_tx)
- if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot:
+ if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot and logging_path is not None:
dt = datetime.datetime.now().isoformat()
fig_path = logging_path + "/" + dt + "_sync_phase_aligned.svg"