diff options
author | andreas128 <Andreas> | 2017-08-09 17:50:46 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2017-08-09 17:50:46 +0100 |
commit | bf6f4d004f1e7cac99c26c8941844fcadab66e09 (patch) | |
tree | 921976f7d8266590af0052d8ca778b25ab8af51d /dpd/src/Measure.py | |
parent | eaeac9c1296ae9a62b1914903877a0d871c19066 (diff) | |
parent | a00179ccdea118aad571d91f610e66c552d55a19 (diff) | |
download | dabmod-bf6f4d004f1e7cac99c26c8941844fcadab66e09.tar.gz dabmod-bf6f4d004f1e7cac99c26c8941844fcadab66e09.tar.bz2 dabmod-bf6f4d004f1e7cac99c26c8941844fcadab66e09.zip |
Merge branch 'next_memless' of github.com:Opendigitalradio/ODR-DabMod into next_memless
Diffstat (limited to 'dpd/src/Measure.py')
-rw-r--r-- | dpd/src/Measure.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/dpd/src/Measure.py b/dpd/src/Measure.py index 76f17b2..2ba3b37 100644 --- a/dpd/src/Measure.py +++ b/dpd/src/Measure.py @@ -4,27 +4,29 @@ 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 import time import logging -import Dab_Util as DU +import src.Dab_Util as DU 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( |