Question about benchmark_tx.py (PLEASE HELP)

Hi, I apologize if this question has already been asked and answered,
but I’m very new to Python and could use some help. I’m trying to
create a bpsk or qpsk signal using benchmark_tx.py. I’m trying to
figure out how do define the binary sequence that is being sent. For
example, if I enter something like ‘0100010010010010…’, a modulated
bpsk or qpsk signal with this binary sequence will be created. However,
after analyzing the code(shown below), data is being sent in packets of
Unicode, defined by the function chr() and struct.pack()? This confuses
me, does this mean packets of repeated alphabet characters are being
sent? I can probably define my own source file, however, I don’t know
how I would format it. Any help would be greatly appreciated. Thanks!

# generate and send packets
nbytes = int(1e6 * options.megabytes)
n = 0
pktno = 0
pkt_size = int(options.size)

while n < nbytes:
    if options.from_file is None:
        data = (pkt_size - 2) * chr(pktno & 0xff)
    else:
        data = source_file.read(pkt_size - 2)
        if data == '':
            break;

    payload = struct.pack('!H', pktno & 0xffff) + data
    send_pkt(payload)
    n += len(payload)
    sys.stderr.write('.')
    if options.discontinuous and pktno % 5 == 4:
        time.sleep(1)
    pktno += 1

send_pkt(eof=True)

tb.wait()

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs