11 from numpy.fft import *;
14 myport = random.randint(1025,65535);
15 filename = "output.dat";
18 msdd_host = "10.45.4.46"
22 my_udp_addr = ('',10001);
23 my_udp_addr = ('10.45.1.229 ',10001);
25 UDPSock = socket(AF_INET,SOCK_DGRAM);
26 UDPSock.bind(my_udp_addr);
33 window = 3; #0=rect, 1=hanning, 2=hamming, 3=blackman
37 #samples = samples*4; #bytes of data we are requesting
39 decim = 2; #0-8 (3 => 2^3 = 8) # ok
40 decim = decim+16; # +16 to use 16bit floats instead of 32 bit floats
41 mode = 0; #0=IQ, 1=MAG, 2=MAGDB
46 request_len = 6*size_int; # 6 int items not including the 8 bytes for opcode and length fields
47 print "request len = %d"%(request_len);
49 raw_data = struct.pack("<IIIIIIII", 0x01, request_len, f_mhz, f_hz, gain, samples, decim, sets);
53 UDPSock.sendto(data, (msdd_host, msdd_port));
74 IQ_bytes = numtocap * numtocap;
76 numbytes = 1000 * 65536;
80 while(num_rx < numbytes):
81 data = UDPSock.recv(65536);
86 num_rx = num_rx + len(data);
91 print "recieved %d bytes in %f sec"%(numbytes, end-start);
93 bytes_per_sec = numbytes / (end-start);
94 samples_per_sec = bytes_per_sec / 4;
95 MSPS = samples_per_sec / 1000000.0;
97 print "Got %f MSPS"%(MSPS);
98 print "Expected %f MSPS"%(102.4/math.pow(2,(decim-16)));
101 halt_data = struct.pack("<II", 0x04, 0x00);
102 UDPSock.sendto(halt_data, (msdd_host, msdd_port));