def QAM_SEP(tx_data,rx_data,mod_type,Ncorr = <NUM_LIT>,Ntransient = <NUM_LIT:0>,SEP_disp=True):
<EOL>tx_data = tx_data[Ntransient:]<EOL>rx_data = rx_data[Ntransient:]<EOL>Nmin = min([len(tx_data),len(rx_data)])<EOL>tx_data = tx_data[:Nmin]<EOL>rx_data = rx_data[:Nmin]<EOL>if mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:2> <EOL><DEDENT>elif mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:4><EOL><DEDENT>elif mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:8><EOL><DEDENT>elif mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:16><EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>rx_data = np.rint((M-<NUM_LIT:1>)*(rx_data + (<NUM_LIT:1>+<NUM_LIT>))/<NUM_LIT>)<EOL>s1r = np.nonzero(np.ravel(rx_data.real > M - <NUM_LIT:1>))[<NUM_LIT:0>]<EOL>s2r = np.nonzero(np.ravel(rx_data.real < <NUM_LIT:0>))[<NUM_LIT:0>]<EOL>rx_data.real[s1r] = (M - <NUM_LIT:1>)*np.ones(len(s1r))<EOL>rx_data.real[s2r] = np.zeros(len(s2r))<EOL>s1i = np.nonzero(np.ravel(rx_data.imag > M - <NUM_LIT:1>))[<NUM_LIT:0>]<EOL>s2i = np.nonzero(np.ravel(rx_data.imag < <NUM_LIT:0>))[<NUM_LIT:0>]<EOL>rx_data.imag[s1i] = (M - <NUM_LIT:1>)*np.ones(len(s1i))<EOL>rx_data.imag[s2i] = np.zeros(len(s2i))<EOL>rx_data = <NUM_LIT:2>*rx_data - (M - <NUM_LIT:1>)*(<NUM_LIT:1> + <NUM_LIT>)<EOL>R0,lags = xcorr(rx_data,tx_data,Ncorr)<EOL>R1,lags = xcorr(rx_data*(<NUM_LIT>)**<NUM_LIT:1>,tx_data,Ncorr) <EOL>R2,lags = xcorr(rx_data*(<NUM_LIT>)**<NUM_LIT:2>,tx_data,Ncorr) <EOL>R3,lags = xcorr(rx_data*(<NUM_LIT>)**<NUM_LIT:3>,tx_data,Ncorr) <EOL>R0max = np.max(R0.real)<EOL>R1max = np.max(R1.real)<EOL>R2max = np.max(R2.real)<EOL>R3max = np.max(R3.real)<EOL>R = np.array([R0max,R1max,R2max,R3max])<EOL>Rmax = np.max(R)<EOL>kphase_max = np.where(R == Rmax)[<NUM_LIT:0>]<EOL>kmax = kphase_max[<NUM_LIT:0>]<EOL>if kmax == <NUM_LIT:0>:<EOL><INDENT>lagmax = lags[np.where(R0.real == Rmax)[<NUM_LIT:0>]]<EOL><DEDENT>elif kmax == <NUM_LIT:1>:<EOL><INDENT>lagmax = lags[np.where(R1.real == Rmax)[<NUM_LIT:0>]]<EOL><DEDENT>elif kmax == <NUM_LIT:2>:<EOL><INDENT>lagmax = lags[np.where(R2.real == Rmax)[<NUM_LIT:0>]]<EOL><DEDENT>elif kmax == <NUM_LIT:3>:<EOL><INDENT>lagmax = lags[np.where(R3.real == Rmax)[<NUM_LIT:0>]]<EOL><DEDENT>taumax = lagmax[<NUM_LIT:0>]<EOL>if SEP_disp:<EOL><INDENT>print('<STR_LIT>' % (kmax, taumax))<EOL><DEDENT>if taumax < <NUM_LIT:0>:<EOL><INDENT>tx_data = tx_data[-taumax:]<EOL>tx_data = tx_data[:min(len(tx_data),len(rx_data))]<EOL>rx_data = (<NUM_LIT>)**kmax*rx_data[:len(tx_data)]<EOL><DEDENT>else:<EOL><INDENT>rx_data = (<NUM_LIT>)**kmax*rx_data[taumax:]<EOL>rx_data = rx_data[:min(len(tx_data),len(rx_data))]<EOL>tx_data = tx_data[:len(rx_data)]<EOL><DEDENT>errors = np.int16(abs(rx_data-tx_data))<EOL>idx = np.nonzero(np.ravel(errors != <NUM_LIT:0>))[<NUM_LIT:0>]<EOL>if SEP_disp:<EOL><INDENT>print('<STR_LIT>'% (len(errors), len(idx), len(idx)/float(len(errors))))<EOL><DEDENT>return  len(errors), len(idx), len(idx)/float(len(errors))<EOL>
Nsymb, Nerr, SEP_hat =
QAM_symb_errors(tx_data,rx_data,mod_type,Ncorr = 1024,Ntransient = 0)

Count symbol errors between a transmitted and received QAM signal.
The received symbols are assumed to be soft values on a unit square.
Time delay between streams is detected.
The ndarray tx_data is Tx complex symbols.
The ndarray rx_data is Rx complex symbols.
Note: Ncorr needs to be even