This program receives UDP packets and either writes each packet, each packet's size, and a time stamp to binary files or plots the data it receives. Usage: receive [options] -g Plot the data in real time via GNUPlot. -w Write the data to a binary file. -p Specify port number (default is 2010.) -v Output greater quantities of program status information. -x Specify number of spectra per file. -r Specify number of files to record. -f Specify file prefix and -optionally- where logfiles are generated. -ft Specify file prefix and -optionally- where logfiles are generated, appending a time stamp to . -s Specify ip address (including dots) of network interface receiving packets. (default is 192.168.0.2) -t Test mode, self-generate packetized data and send to localhost. -th Specify the threshold scaler as a float in range [0.0, 255.0] (Default 0.09375). -el Specify the event limit as an integer in range [1, 256] (Default 128). -m Specify the size of the PFB mask (default 65536). -d1 Graphs by PFB bin number. -d2
Graph by frequency, specify the center frequency. (Default, default center 2275.) -port0 Change serial port connection to the BEE2 from the default port /dev/ttyS1 to /dev/ttyS0. -N For use from within Matlab/Octave. Write 2nd spectrum to file. -h (or any other garbage) -- Get this help. ** Use file name /dev/stdout for screen output. Outputs (if writing to file): Files named _.dat, where is the parameter following -f, and is incremented for each new file, starting with 1. A new file begins when the last file has spectra, where is the parameter following -x. If the -f option is not supplied, a timestamp will be used. -------------- IN DEPTH EXPLANATION ---------------------- Each frequency spectrum consists of 4096 polyphase filter bank bins (PFB bins). Each PFB bin consists of 32768 bins, which means that each spectrum consists of 134217728 (4096*32678) individual bins. THE RECEIVE CODE (Run on a recipient machine) --------------------------------------------- The receive code receives these UDP packets from the Bee2. It then either writes the data to a file or graphs the data. If the write to file options is chosen, it writes to file a header for each packet and the data from the packet. The header consists of 3 numbers. The first number is the size of the data field in bytes, and the last two numbers are the seconds and microseconds of the time stamp from when the packet was received (time since January 1st, 1970). Each number is 4 bytes. The packets are written to file in binary form, each packet representing a PFB bin number. A file is closed and the next begun when it has as many packets in it as was specified in program execution. This means that a packet (PFB bin) will never be split up across files, but a spectrum may be split up and continued into the next file. To summarize, the data written to file for each packet looks like this: length of data seconds field of time stamp microseconds field of time stamp data (PFBbinNumber, threshold, errorCode, hit #1 bin number, ...) The filenames will be based on the [filename] parameter entered at the execution of the receive code. Each filename will consist of the [filename] parameter given at the time of execution followed by an underscore and an integer. The integer value begins at 1 and counts upwards as multiple files are written. For example, if I executed the code right now with "./receive -w -f gobears", the files would be named: gobears_1.dat gobears_2.dat gobears_3.dat Without the -f option, a timestamp will be substituted for [filename].