aboutsummaryrefslogtreecommitdiffstats
path: root/dpd/src/Measure.py
diff options
context:
space:
mode:
Diffstat (limited to 'dpd/src/Measure.py')
-rw-r--r--dpd/src/Measure.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/dpd/src/Measure.py b/dpd/src/Measure.py
index 76f17b2..1b0ac75 100644
--- a/dpd/src/Measure.py
+++ b/dpd/src/Measure.py
@@ -4,7 +4,7 @@ import sys
import socket
import struct
import numpy as np
-import matplotlib.pyplot as pp
+import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import argparse
import os
@@ -15,16 +15,18 @@ import datetime
class Measure:
"""Collect Measurement from DabMod"""
- def __init__(self, port, num_samples_to_request):
- """"""
+ def __init__(self, samplerate, port, num_samples_to_request):
logging.info("Instantiate Measure object")
+ self.samplerate = samplerate
self.sizeof_sample = 8 # complex floats
self.port = port
self.num_samples_to_request = num_samples_to_request
def _recv_exact(self, sock, num_bytes):
- """Interfaces the socket to receive a byte string
-
+ """Receive an exact number of bytes from a socket. This is
+ a wrapper around sock.recv() that can return less than the number
+ of requested bytes.
+
Args:
sock (socket): Socket to receive data from.
num_bytes (int): Number of bytes that will be returned.
@@ -77,8 +79,6 @@ class Measure:
rxframe = np.array([], dtype=np.complex64)
if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
- import matplotlib.pyplot as plt
-
txframe_path = ('/tmp/txframe_fft_' +
datetime.datetime.now().isoformat() +
'.pdf')
@@ -108,7 +108,7 @@ class Measure:
logging.debug("Disconnecting")
s.close()
- du = DU.Dab_Util(8192000)
+ du = DU.Dab_Util(samplerate)
txframe_aligned, rxframe_aligned = du.subsample_align(txframe, rxframe)
logging.info(