From 41a2f79220132a49b1ecaf710b494c278fc8d0d6 Mon Sep 17 00:00:00 2001 From: andreas128 Date: Thu, 28 Sep 2017 12:13:42 +0200 Subject: Change default for plots --- dpd/README.md | 4 ++-- dpd/apply_adapt_dumps.py | 2 +- dpd/main.py | 17 +++++------------ dpd/src/Const.py | 16 +++++++--------- dpd/src/Test_data.py | 2 +- 5 files changed, 16 insertions(+), 25 deletions(-) diff --git a/dpd/README.md b/dpd/README.md index 77c53bd..4f92ecb 100644 --- a/dpd/README.md +++ b/dpd/README.md @@ -87,11 +87,11 @@ ODR-DabMod/odr-dabmod dpd/dpd.ini The script uses automatic gain control for both TX and RX gain, to get both a high quantization quality for the most frequent amplitude regions and a high enough back-off so the peaks are also quantized correctly. This means that the output power will stay at the same level, but the script may change TX gain to trade it with digital gain and also change RX gain. -As a first test you can run the main script without parameters. It preserves the output power and generates all available visualization plots in the newly created logging directory `/tmp/dpd_`. As the script should increase the preak to shoulder ratio, tune the txgain in a way to be able to see a the change. For example to a ratio of -30dB. You can do this using the telnet remote control from `odr-dabmod`. To run it do following: +As a first test you can run the main script with the *--plot* parameter. It preserves the output power and generates all available visualization plots in the newly created logging directory `/tmp/dpd_`. As the script should increase the preak to shoulder ratio, tune the txgain in a way to be able to see a the change. For example to a ratio of -30dB. You can do this using the telnet remote control from `odr-dabmod`. To run it do following: ``` cd dpd -python main.py +python main.py --plot ``` Each plot is stored to the logging directory under a filename containing its time stamp and its label. Following plots are generated chronologically: diff --git a/dpd/apply_adapt_dumps.py b/dpd/apply_adapt_dumps.py index 790a64a..4dac657 100755 --- a/dpd/apply_adapt_dumps.py +++ b/dpd/apply_adapt_dumps.py @@ -105,7 +105,7 @@ samplerate = cli_args.samplerate searchpath = cli_args.searchpath target_median = cli_args.target_median -c = src.Const.Const(samplerate, target_median, -1, -1, -1) +c = src.Const.Const(samplerate, target_median, False) SA = src.Symbol_align.Symbol_align(c) MER = src.MER.MER(c) MS = src.Measure_Shoulders.Measure_Shoulders(c) diff --git a/dpd/main.py b/dpd/main.py index 5eaa81f..aa96a8c 100755 --- a/dpd/main.py +++ b/dpd/main.py @@ -91,13 +91,9 @@ parser.add_argument('-i', '--iterations', default=1, type=int, parser.add_argument('-L', '--lut', help='Use lookup table instead of polynomial predistorter', action="store_true") -parser.add_argument('--n_bins', default='64', type=int, - required=False) -parser.add_argument('--n_per_bin', default='128', type=int, - required=False) -parser.add_argument('--n_meas', default='20', type=int, - help='Number of samples to request from ODR-DabMod', - required=False) +parser.add_argument('--plot', + help='Enable all plots, to be more selective choose plots in Const.py', + action="store_true") cli_args = parser.parse_args() logging.info(cli_args) @@ -112,12 +108,9 @@ num_iter = cli_args.iterations target_median = cli_args.target_median rxgain = cli_args.rxgain txgain = cli_args.txgain +plot = cli_args.plot -n_bins = cli_args.n_bins -n_per_bin = cli_args.n_per_bin -n_meas = cli_args.n_meas - -c = Const(samplerate, target_median, n_bins, n_per_bin, n_meas) +c = Const(samplerate, target_median, plot) SA = Symbol_align(c) MER = MER(c) MS = Measure_Shoulders(c) diff --git a/dpd/src/Const.py b/dpd/src/Const.py index bf46796..ebdfeb2 100644 --- a/dpd/src/Const.py +++ b/dpd/src/Const.py @@ -6,9 +6,8 @@ import numpy as np class Const: - def __init__(self, sample_rate, target_median, n_bins, n_per_bin, n_meas): + def __init__(self, sample_rate, target_median, plot): self.sample_rate = sample_rate - self.n_meas = n_meas self.tx_gain_max = 89 @@ -41,11 +40,11 @@ class Const: self.phase_offset_per_sample = 1. / sample_rate * 2 * np.pi * 1000 # Constants for ExtractStatistic - self.ES_plot = False + self.ES_plot = plot self.ES_start = 0.0 self.ES_end = 1.0 - self.ES_n_bins = n_bins - self.ES_n_per_bin = n_per_bin + self.ES_n_bins = 64 + self.ES_n_per_bin = 128 # Constants for TX_Agc self.TAGC_max_txgain = 89 @@ -53,22 +52,21 @@ class Const: self.TAGC_tx_median_max = self.TAGC_tx_median_target*1.4 self.TAGC_tx_median_min = self.TAGC_tx_median_target/1.4 - self.RAGC_min_rxgain = 25 self.RAGC_rx_median_target = self.TAGC_tx_median_target # Constants for Model - self.MDL_plot = True + self.MDL_plot = True or plot # Override default # Constants for MER - self.MER_plot = False + self.MER_plot = plot # Constants for Model_PM self.MPM_tx_min = 0.1 # Constants for Measure_Shoulder self.MS_enable = False - self.MS_plot = False + self.MS_plot = plot assert sample_rate==8192000 meas_offset = 976 # Offset from center frequency to measure shoulder [kHz] meas_width = 100 # Size of frequency delta to measure shoulder [kHz] diff --git a/dpd/src/Test_data.py b/dpd/src/Test_data.py index 67f4dff..bbef282 100644 --- a/dpd/src/Test_data.py +++ b/dpd/src/Test_data.py @@ -40,7 +40,7 @@ class Test_data: plt.plot(np.angle(np.fft.fftshift(np.fft.fft(tx_orig))), 'p') """ - self.c = src.Const.Const(sample_rate) + self.c = src.Const.Const(sample_rate,, False self.du = src.Dab_Util.Dab_Util(sample_rate) self.file_paths = { -- cgit v1.2.3