-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
394e300
commit d07a9fd
Showing
3 changed files
with
32 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ build/ | |
|
||
.DS_Store | ||
|
||
nrscope/twinrx_analysis/time_data/ | ||
nrscope/twinrx_analysis/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|