def fsk_BEP(rx_data,m,flip):
Nbits = len(rx_data)<EOL>c = dc.m_seq(m)<EOL>if flip == <NUM_LIT:1>:<EOL><INDENT>c.shape = (<NUM_LIT:1>,len(c))<EOL>c = np.fliplr(c).flatten()<EOL><DEDENT>L = int(np.ceil(Nbits/float(len(c))))<EOL>tx_data = np.dot(c.reshape(len(c),<NUM_LIT:1>),np.ones((<NUM_LIT:1>,L)))<EOL>tx_data = tx_data.T.reshape((<NUM_LIT:1>,len(c)*L)).flatten()<EOL>tx_data = tx_data[:Nbits]<EOL>tx_data = <NUM_LIT:2>*tx_data - <NUM_LIT:1><EOL>Bit_count,Bit_errors = dc.BPSK_BEP(rx_data,tx_data)<EOL>print('<STR_LIT>' % (len(rx_data),len(tx_data)))<EOL>Pe = Bit_errors/float(Bit_count)<EOL>print('<STR_LIT>')<EOL>print('<STR_LIT>' % Bit_errors)<EOL>print('<STR_LIT>' % Bit_count)<EOL>print('<STR_LIT>' % Pe)<EOL>print('<STR_LIT>')<EOL>
fsk_BEP(rx_data,m,flip)

Estimate the BEP of the data bits recovered
by the RTL-SDR Based FSK Receiver.

The reference m-sequence generated in Python
was found to produce sequences running in the opposite
direction relative to the m-sequences generated by the
mbed. To allow error detection the reference m-sequence
is flipped.

Mark Wickert April 2014