Many changes in DBHandler

new general processing structure
just before splitting off the projects folder from this repo
This commit is contained in:
Silas Oettinghaus
2025-05-13 10:24:09 +02:00
parent 727c3d9364
commit 9ce23c4a10
38 changed files with 2440 additions and 1103 deletions

View File

@@ -0,0 +1,87 @@
classdef Metricstruct
% ResultData - Class to store and manage metric data from signal processing results
properties
result_id (1,1) double {mustBeNumeric} = NaN
run_id (1,1) double {mustBeNumeric} = NaN
eqParam_id (1,1) double {mustBeNumeric} = NaN
date_of_processing (1,1) datetime = datetime('now')
numBits (1,1) double {mustBeInteger, mustBeNonnegative} = 0
BER (1,1) double {mustBeNumeric, mustBeNonnegative, mustBeLessThanOrEqual(BER,1)} = 0
numBitErr (1,1) double {mustBeInteger, mustBeNonnegative} = 0
BER_precoded (1,1) double {mustBeNumeric, mustBeNonnegative, mustBeLessThanOrEqual(BER_precoded,1)} = 0
numBitErr_precoded (1,1) double {mustBeInteger, mustBeNonnegative} = 0
SNR (1,1) double {mustBeNumeric} = NaN
SNR_level (:,1) double {mustBeNumeric} = []
STD (1,1) double {mustBeNumeric} = NaN
STD_level (:,1) double {mustBeNumeric, mustBeNonnegative} = []
STDrx (1,1) double {mustBeNumeric} = NaN
STDrx_level (:,1) double {mustBeNumeric, mustBeNonnegative} = []
EVM (1,1) double {mustBeNumeric} = NaN
EVM_level (:,1) double {mustBeNumeric} = []
GMI (1,1) double {mustBeNumeric} = NaN
AIR (1,1) double {mustBeNumeric} = NaN
Alpha (:,1) double {mustBeNumeric} = []
MLSE_dir (:,1) double {mustBeNumeric} = []
end
methods
function obj = Metricstruct(varargin)
% Constructor method for ResultData
% Can be called empty or with name-value pairs
% Process name-value pairs if provided
if nargin > 0
for i = 1:2:nargin
if isprop(obj, varargin{i})
obj.(varargin{i}) = varargin{i+1};
else
error('Property %s does not exist in ResultData', varargin{i});
end
end
end
end
function s = toStruct(obj)
% Convert the object to a struct
s = struct();
props = properties(obj);
for i = 1:length(props)
s.(props{i}) = obj.(props{i});
end
end
function str = toString(obj)
% Convert the object to a formatted string
s = obj.toStruct();
str = sprintf('ResultData:\n');
fields = fieldnames(s);
for i = 1:length(fields)
val = s.(fields{i});
if isempty(val)
str = sprintf('%s%s: []\n', str, fields{i});
elseif isnumeric(val) && length(val) > 1
str = sprintf('%s%s: [%s]\n', str, fields{i}, num2str(val'));
else
str = sprintf('%s%s: %s\n', str, fields{i}, string(val));
end
end
end
end
methods (Static)
function obj = fromStruct(s)
% Create a ResultData object from a struct
obj = Metricstruct();
fields = fieldnames(s);
for i = 1:length(fields)
if isprop(obj, fields{i})
obj.(fields{i}) = s.(fields{i});
end
end
end
end
end