summaryrefslogtreecommitdiffstats
path: root/dpd/src/TX_Agc.py
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-09-08 10:05:56 +0200
committerandreas128 <Andreas>2017-09-08 10:05:56 +0200
commit988e0b9472489657f86838362b176863ec42d0fd (patch)
tree9a782277c75c8477119716f24e4064879ac0c56c /dpd/src/TX_Agc.py
parent1b6c5dd58658bbc1b423b50baa15ca3fae6a1065 (diff)
downloaddabmod-988e0b9472489657f86838362b176863ec42d0fd.tar.gz
dabmod-988e0b9472489657f86838362b176863ec42d0fd.tar.bz2
dabmod-988e0b9472489657f86838362b176863ec42d0fd.zip
Cleanup and change logging plots to svg
Diffstat (limited to 'dpd/src/TX_Agc.py')
-rw-r--r--dpd/src/TX_Agc.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/dpd/src/TX_Agc.py b/dpd/src/TX_Agc.py
index 6f4cee8..c3d0698 100644
--- a/dpd/src/TX_Agc.py
+++ b/dpd/src/TX_Agc.py
@@ -24,10 +24,10 @@ import src.Adapt as Adapt
class TX_Agc:
def __init__(self,
adapt,
- max_txgain=80,
- tx_median_target=0.1,
- tx_median_threshold_max=0.15,
- tx_median_threshold_min=0.05):
+ max_txgain=85,
+ tx_median_target=0.04,
+ tx_median_threshold_max=0.07,
+ tx_median_threshold_min=0.02):
"""
In order to avoid digital clipping, this class increases the
TX gain and reduces the digital gain. Digital clipping happens
@@ -62,8 +62,7 @@ class TX_Agc:
tx_median = np.median(np.abs(tx))
if tx_median > self.tx_median_threshold_tolerate_max or\
tx_median < self.tx_median_threshold_tolerate_min:
- delta_db = \
- np.floor(20 * np.log10(self.tx_median_target / tx_median)).astype(int)
+ delta_db = 20 * np.log10(self.tx_median_target / tx_median)
new_txgain = self.adapt.get_txgain() - delta_db
assert new_txgain < self.max_txgain,\
"TX_Agc failed. New TX gain of {} is too large.".format(
@@ -77,8 +76,8 @@ class TX_Agc:
self.adapt.set_digital_gain(digital_gain)
logging.info(
- "digital_gain = {}, txgain_new = {}, " \
- "delta_db = {}, tx_median {}, " \
+ "digital_gain = {}, txgain_new = {}, "\
+ "delta_db = {}, tx_median {}, "\
"digital_gain_factor = {}".
format(digital_gain, txgain, delta_db,
tx_median, digital_gain_factor))