diff options
author | andreas128 <Andreas> | 2017-09-02 19:18:01 +0200 |
---|---|---|
committer | andreas128 <Andreas> | 2017-09-02 19:18:01 +0200 |
commit | 719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5 (patch) | |
tree | 05fb049f22a526dd3b2c46b99f7546a84f4938a3 /dpd/src/Dab_Util.py | |
parent | 6907d576b69ae065f25584fd4c6635c0c26beab2 (diff) | |
download | dabmod-719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5.tar.gz dabmod-719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5.tar.bz2 dabmod-719238f0adc19fb3de3b4fd2695b6bb30d4c9dd5.zip |
Cleanup logging and plots
Diffstat (limited to 'dpd/src/Dab_Util.py')
-rw-r--r-- | dpd/src/Dab_Util.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dpd/src/Dab_Util.py b/dpd/src/Dab_Util.py index b0b3ce3..8a53004 100644 --- a/dpd/src/Dab_Util.py +++ b/dpd/src/Dab_Util.py @@ -23,7 +23,7 @@ class Dab_Util: """Collection of methods that can be applied to an array complex IQ samples of a DAB signal """ - def __init__(self, sample_rate): + def __init__(self, sample_rate, plot=False): """ :param sample_rate: sample rate [sample/sec] to use for calculations """ @@ -31,6 +31,8 @@ class Dab_Util: self.dab_bandwidth = 1536000 #Bandwidth of a dab signal self.frame_ms = 96 #Duration of a Dab frame + self.plot=plot + def lag(self, sig_orig, sig_rec): """ Find lag between two signals @@ -41,7 +43,7 @@ class Dab_Util: off = sig_rec.shape[0] c = np.abs(signal.correlate(sig_orig, sig_rec)) - if logging.getLogger().getEffectiveLevel() == logging.DEBUG: + if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot: dt = datetime.datetime.now().isoformat() corr_path = (logging_path + "/" + dt + "_tx_rx_corr.pdf") plt.plot(c, label="corr") @@ -95,7 +97,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: + if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot: dt = datetime.datetime.now().isoformat() fig_path = logging_path + "/" + dt + "_sync_raw.pdf" @@ -139,7 +141,7 @@ class Dab_Util: sig_tx = sig_tx[:-1] sig_rx = sig_rx[:-1] - if logging.getLogger().getEffectiveLevel() == logging.DEBUG: + if logging.getLogger().getEffectiveLevel() == logging.DEBUG and self.plot: dt = datetime.datetime.now().isoformat() fig_path = logging_path + "/" + dt + "_sync_sample_aligned.pdf" |