diff --git a/.gitignore b/.gitignore index 8e6c80ca..92219bcd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ build/ .DS_Store -nrscope/twinrx_analysis/time_data/ \ No newline at end of file +nrscope/twinrx_analysis/ diff --git a/nrscope/src/libs/radio_nr.cc b/nrscope/src/libs/radio_nr.cc index 7470e710..62092460 100644 --- a/nrscope/src/libs/radio_nr.cc +++ b/nrscope/src/libs/radio_nr.cc @@ -360,10 +360,13 @@ int Radio::RadioInitandStart(){ // the offset is NOT multiple of the subcarrier spacing if ((cs_args.ssb_freq_hz < ssb_center_freq_min_hz) or (cs_args.ssb_freq_hz > ssb_center_freq_max_hz) or (offset_hz % ssb_scs_hz != 0)) { + std::cout << "[xuyang debug] skipped freq: " << cs_args.ssb_freq_hz << std::endl; // Skip this frequency continue; } + std::cout << "[xuyang debug] freq to find ssb: " << cs_args.ssb_freq_hz << std::endl; + srsran_searcher_cfg_t.srate_hz = args_t.srate_hz; // which is indeed the srsran srate srsran_searcher_cfg_t.center_freq_hz = cs_args.ssb_freq_hz; //args_t.base_carrier.dl_center_frequency_hz; srsran_searcher_cfg_t.ssb_freq_hz = cs_args.ssb_freq_hz; diff --git a/nrscope/twinrx_analysis/time_series_plot.py b/nrscope/twinrx_analysis/time_series_plot.py index b20c081d..b8256afd 100644 --- a/nrscope/twinrx_analysis/time_series_plot.py +++ b/nrscope/twinrx_analysis/time_series_plot.py @@ -1,46 +1,53 @@ import matplotlib.pyplot as plt import numpy as np -f1 = open("time_data/time_series_pre_resample.txt", "r") -f2 = open("time_data/time_series_post_resample.txt", "r") -r = 23040000/33333333; -fig, axs = plt.subplots(1) +f1 = open("nontwin_time_data/time_series4.txt", "r") + + +r = 23040000/33333333; +fig, axs = plt.subplots(2, constrained_layout=True, sharex=True) +line_count = 0 for line in f1: + line_count += 1 + # continue + if line_count != 343: + continue + reformatted = line.replace(" ", "").replace("i", "j") complex_strs = reformatted.split(",")[:-1] cfs = [] + reals = [] + imgs = [] for complex_str in complex_strs: cf = complex(complex_str) cfs.append(cf) + reals.append(cf.real) + imgs.append(cf.imag) x1s = np.arange(0, len(cfs), 1) - y1s = np.array(cfs) + y1s_real = np.array(reals) + y1s_img = np.array(imgs) - axs.plot(x1s, y1s) + axs[0].plot(x1s, y1s_real, label='real') + axs[1].plot(x1s, y1s_img, label='imag') - break + print(f'sampled point num: {len(cfs)}') -for line in f2: - reformatted = line.replace(" ", "").replace("i", "j") - complex_strs = reformatted.split(",")[:-1] +# print(f'line_count: {line_count}') +# exit() - cfs = [] - - for complex_str in complex_strs: - cf = complex(complex_str) - cfs.append(cf) - - x2s = np.arange(0, len(cfs), 1) / r - y2s = np.array(cfs) +axs[0].title.set_text('real part') +axs[1].title.set_text('imag part') - axs.plot(x2s, y2s) +axs[0].set_xlabel('time') +axs[1].set_xlabel('time') - break +axs[0].legend(loc="upper right") +axs[1].legend(loc="upper right") plt.show() f1.close() -f2.close()