From 3a076cc5f308d7f67ce0a2033b99cff6b841d75c Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 18 Dec 2021 16:44:44 +0100 Subject: Rename flowgraph data files and remove static simulations --- doc/thesis/figures/data/utils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/thesis/figures/data/utils.py (limited to 'doc/thesis/figures/data/utils.py') 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='') + -- cgit v1.2.1