Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
XuyangCaoPrinceton committed Aug 2, 2024
1 parent 394e300 commit d07a9fd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ build/

.DS_Store

nrscope/twinrx_analysis/time_data/
nrscope/twinrx_analysis/
3 changes: 3 additions & 0 deletions nrscope/src/libs/radio_nr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
49 changes: 28 additions & 21 deletions nrscope/twinrx_analysis/time_series_plot.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit d07a9fd

Please sign in to comment.