mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-15 21:32:29 +10:00
updated ui added new features
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
% ofdm_demod_check.m
|
||||
%
|
||||
% Load results from reference and stm32 run and compare
|
||||
|
||||
addpath("../../lib/octave")
|
||||
|
||||
% Constants (would prefer parameters)
|
||||
err_limit = 0.001;
|
||||
|
||||
% Reference
|
||||
load("ofdm_demod_ref_log.txt");
|
||||
|
||||
% DUT
|
||||
load("ofdm_demod_log.txt");
|
||||
|
||||
% Eliminate trailing rows of all zeros (unused)
|
||||
sums_ref = sum(payload_syms_log_c, 2);
|
||||
last_ref = find(sums_ref, 1, 'last');
|
||||
sums_dut = sum(payload_syms_log_stm32, 2);
|
||||
last_dut = find(sums_dut, 1, 'last');
|
||||
last_all = max(last_ref, last_dut);
|
||||
|
||||
syms_ref = payload_syms_log_c(1:last_all,:);
|
||||
syms_dut = payload_syms_log_stm32(1:last_all,:);
|
||||
|
||||
% error values
|
||||
err = abs(syms_ref - syms_dut);
|
||||
err_max = max(max(err));
|
||||
printf("MAX_ERR %f\n", err_max);
|
||||
|
||||
err_vals = err - err_limit;
|
||||
err_vals(err_vals<0) = 0;
|
||||
errors = err_vals > 0;
|
||||
num_errors = nnz(errors);
|
||||
|
||||
%% TODO, print errors info (count locations,...)
|
||||
if (num_errors > 0)
|
||||
printf("%d ERRORS\n", num_errors);
|
||||
else
|
||||
printf("PASSED\n");
|
||||
end
|
||||
|
||||
% EVM
|
||||
evm = sqrt(meansq(err, 2));
|
||||
evm_avg = mean(evm);
|
||||
printf("AVG_EVM %f\n", evm_avg);
|
||||
evm_max = max(evm);
|
||||
printf("MAX_EVM %f\n", evm_max);
|
||||
|
||||
% Standard deviation
|
||||
sdv = std(err, 0, 2);
|
||||
sdv_max = max(sdv);
|
||||
printf("MAX_SDV %f\n", sdv_max);
|
||||
|
||||
% Plot
|
||||
figure(1)
|
||||
figure(1, "visible", true)
|
||||
scatter(real(syms_ref), imag(syms_ref), "g", "+")
|
||||
hold on
|
||||
scatter(real(syms_dut), imag(syms_dut), "b", "o")
|
||||
print(1, "syms_plot.png", "-dpng")
|
||||
hold off
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
""" sum_profiles """
|
||||
|
||||
def sum_profiles(fin, frames):
|
||||
data = {}
|
||||
total_time = 0.0
|
||||
active = False
|
||||
|
||||
for line in fin:
|
||||
if (not active): active = line.startswith("Start Profile Data")
|
||||
elif line.startswith("End Profile Data"): active = False
|
||||
else:
|
||||
words = line.strip().split()
|
||||
if (len(words) == 3):
|
||||
part = words[0]
|
||||
time_str = words[1]
|
||||
time = float(time_str)
|
||||
total_time += time
|
||||
if (not part in data): data[part] = 0.0
|
||||
data[part] += time
|
||||
# end else
|
||||
# end for line
|
||||
|
||||
data_sorted = [(p, data[p]) for p in sorted(data, key=data.get, reverse=True)]
|
||||
|
||||
print("Total time = {:.1f} ms".format(total_time))
|
||||
if (frames):
|
||||
print("{:.1f} ms per frame".format(total_time / frames))
|
||||
print("")
|
||||
|
||||
for part, time in data_sorted:
|
||||
percent = int(100*(time / total_time))
|
||||
print('{:2d}% - {:10.3f} - {}'.format(percent, time, part))
|
||||
|
||||
return(data)
|
||||
# end sum_profiles()
|
||||
|
||||
|
||||
########################################
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
|
||||
#### Options
|
||||
argparser = argparse.ArgumentParser()
|
||||
argparser.add_argument("-f", "--frames", action="store", type=int, default=0,
|
||||
help="Number of frames")
|
||||
argparser.add_argument("file", metavar="FILE", help="file to read")
|
||||
args = argparser.parse_args()
|
||||
|
||||
fin = open(args.file, "r")
|
||||
sum_profiles(fin, args.frames)
|
||||
Binary file not shown.
Reference in New Issue
Block a user