<jupyter_start><jupyter_text>Complex Ambiguity Function (CAF)<jupyter_code>%pylab inline
pylab.rcParams['savefig.dpi'] = 300
from caf_verilog import sim_helper as sh
from caf_verilog.caf import simple_caf
from gps_helper.prn import PRN
from sk_dsp_comm import sigsys as ss
from sk_dsp_comm import digitalcom as dc
prn = PRN(10)
prn2 = PRN(20)
fs = 625e3
Ns = fs / 200e3
prn_seq = prn.prn_seq()
prn_seq = [*prn_seq, *prn_seq]
prn_seq2 = prn2.prn_seq()
prn_seq,b = ss.NRZ_bits2(array(prn_seq), Ns)
prn_seq2,b2 = ss.NRZ_bits2(array(prn_seq2), Ns)
Px,f = psd(prn_seq, 2**12, Fs=fs)
plot(f, 10*np.log10(Px))
f_size = 24
foas = arange(-f_size, f_size + 1) * 1000
foas, len(foas)<jupyter_output><empty_output><jupyter_text>CAF Module<jupyter_code>from caf_verilog.caf import CAF
from caf_verilog.sim_helper import sim_shift
from caf_verilog.xcorr import dot_xcorr
len(prn_seq)
center = 3000
corr_length = 1000
shift = 25
ncorr = arange(0, corr_length * 2)
foa_offset = 16
theta_shift = exp(1j*2*pi*ncorr*(foas[foa_offset])/float(fs))
ref, rec = sim_shift(prn_seq, center, corr_length, shift=shift)
caf = CAF(ref, rec * theta_shift, foas, fs=fs, n_bits=8, ref_i_bits=8, rec_i_bits=8)
caf.gen_tb()
xcorr_res_shift = dot_xcorr(ref, rec * theta_shift)
xcorr_res = dot_xcorr(ref, rec)
plot(rec)
plot(abs(array(xcorr_res_shift)))
ylim([0, corr_length])
grid();
xlabel("Inverse Center Offset (Samples)")
savefig('caf_test_shift.png')
am_pos = argmax(abs(array(xcorr_res_shift)))
am_pos, abs(array(xcorr_res))[am_pos]
plot(abs(array(xcorr_res)))
ylim([0, corr_length])
grid();
am_pos = argmax(abs(array(xcorr_res)))
am_pos, abs(array(xcorr_res))[am_pos]
xlabel("Inverse Center Offset (Samples)")
savefig('caf_test_signal.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1367030442274555, 'fraction_numerical': 0.03331418724870764, 'mean_word_length': 7.887755102040816, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '17666', 'license': 'MIT', 'n_tokens_mistral': 838, 'n_tokens_neox': 780, 'n_words': 147, 'path': 'docs/source/nb_examples/CAF.ipynb', 'repo_name': 'chiranthsiddappa/caf_verilog', 'size': '1741'}