X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gr-msdd6000%2Fsrc%2Fpython_test%2Fudp_stream_rate_test_plot.py;fp=gr-msdd6000%2Fsrc%2Fpython_test%2Fudp_stream_rate_test_plot.py;h=eef78f51bbdc6543397d93548bc5f010d6f3c6cb;hb=35e43e8d8c271e6842191cac3fc3f2f88a861183;hp=0000000000000000000000000000000000000000;hpb=ea29b08aeb54227e6628f655ccfdb96fe4d8c378;p=debian%2Fgnuradio diff --git a/gr-msdd6000/src/python_test/udp_stream_rate_test_plot.py b/gr-msdd6000/src/python_test/udp_stream_rate_test_plot.py new file mode 100644 index 00000000..eef78f51 --- /dev/null +++ b/gr-msdd6000/src/python_test/udp_stream_rate_test_plot.py @@ -0,0 +1,161 @@ +#!/usr/bin/python + +from socket import * +import string +import time +import struct; +from random import *; +import array; +import cmath; +from numpy import *; +from numpy.fft import *; +from pylab import *; + +myport = randint(1025,65535); +filename = "output.dat"; + +msdd_port = 10001 +msdd_host = "10.45.4.46" + +buf = 100000; + +my_udp_addr = ('',randint(1025,65535)); + +UDPSock = socket(AF_INET,SOCK_DGRAM); +UDPSock.bind(my_udp_addr); + +f_mhz = 2500; + +print "fc = %d"%(f_mhz); + +f_hz = 0; +gain = 20; # attenuation +window = 3; #0=rect, 1=hanning, 2=hamming, 3=blackman + +samples = 65535*4*2; +#samples = 16384; +#samples = 16*1024*1024; +#samples = samples*4; #bytes of data we are requesting + +# decim 0-8 ( 3 - 8 ) +#decim = 5; # rate ok +decim = 8; +decim = decim+16; # +16 to use 16bit floats instead of 32 bit floats +mode = 0; #0=IQ, 1=MAG, 2=MAGDB +#sets = 0; +sets = 0xffffffff; + +size_int = 4; +request_len = 6*size_int; # 6 int items not including the 8 bytes for opcode and length fields +print "request len = %d"%(request_len); + +raw_data = struct.pack("II", 0x04, 0x00); +UDPSock.sendto(halt_data, (msdd_host, msdd_port)); + +# perform timing analysis +print "recieved %d bytes in %f sec"%(numbytes, end-start); +bytes_per_sec = numbytes / (end-start); +samples_per_sec = bytes_per_sec / 4; +MSPS = samples_per_sec / 1000000.0; + +print "Got %f MSPS"%(MSPS); +print "Expected %f MSPS"%(102.4/math.pow(2,(decim-16))); + + +# plot data +val_arr = []; +mag_arr = []; +mag_arr2 = []; + +print "Repacking data..." +f = open("out.dat","w"); +for li in l: + for p in range(0, len(li)/4): + [i,q] = struct.unpack_from("