diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-09 14:43:19 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-09 14:44:24 +0200 |
commit | e48f6b7078e9edc30b1a6a357e3f81c21265930a (patch) | |
tree | bba5b26dd0b907337a77ebbdbb1b9cc114f8280a /dpd/src | |
parent | 0b491301e11c8e4fd1a3cff9f038f4fa8f5c6aab (diff) | |
download | dabmod-e48f6b7078e9edc30b1a6a357e3f81c21265930a.tar.gz dabmod-e48f6b7078e9edc30b1a6a357e3f81c21265930a.tar.bz2 dabmod-e48f6b7078e9edc30b1a6a357e3f81c21265930a.zip |
DPD CE: Add argument parser
Diffstat (limited to 'dpd/src')
-rw-r--r-- | dpd/src/Measure.py | 16 |
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( |