diff options
author | Nao Pross <np@0hm.ch> | 2021-12-18 16:44:44 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2021-12-18 17:36:28 +0100 |
commit | 3a076cc5f308d7f67ce0a2033b99cff6b841d75c (patch) | |
tree | 7a45b48ed5369ee69ff3107b8383224899c7915b /doc/thesis/figures/data/utils.py | |
parent | Merge branch 'master' of github.com:NaoPross/Fading (diff) | |
download | Fading-3a076cc5f308d7f67ce0a2033b99cff6b841d75c.tar.gz Fading-3a076cc5f308d7f67ce0a2033b99cff6b841d75c.zip |
Rename flowgraph data files and remove static simulations
Diffstat (limited to 'doc/thesis/figures/data/utils.py')
-rw-r--r-- | doc/thesis/figures/data/utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/thesis/figures/data/utils.py b/doc/thesis/figures/data/utils.py new file mode 100644 index 0000000..ccb3bb4 --- /dev/null +++ b/doc/thesis/figures/data/utils.py @@ -0,0 +1,22 @@ +import os +import numpy as np + +def load_samples(fname, dtype=np.complex64): + set_name, _ = os.path.splitext(os.path.basename(fname)) + + data_dir = "./figures/data/flowgraphs" + sps = 4 + + channel = np.fromfile(f"{data_dir}/channel_{set_name}.dat", dtype=dtype)[::sps] + synchronized = np.fromfile(f"{data_dir}/synchronized_{set_name}.dat", dtype=dtype) + equalized = np.fromfile(f"{data_dir}/equalized_{set_name}.dat", dtype=dtype) + locked = np.fromfile(f"{data_dir}/locked_{set_name}.dat", dtype=dtype) + + return channel, synchronized, equalized, locked + +def save_to_file(fname, data, headers): + location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(fname))) + name, _ = os.path.splitext(os.path.basename(fname)) + filename = os.path.join(location, name + ".dat") + np.savetxt(filename, data, fmt='%.6e\t', header="\t".join(headers), comments='') + |