Theory stuff from sials work pc; minor stuff here and there

This commit is contained in:
Silas Oettinghaus
2026-02-19 15:11:32 +01:00
parent 1b8d83dec0
commit 2a724b833f
14 changed files with 810 additions and 39 deletions

View File

@@ -2,7 +2,7 @@ dsp_options.storage_path = 'Z:\2024\sioe_labor\';
dsp_options.max_occurences = 1;
database = DBHandler("dataBase", 'labor_highspeed', "type", 'mysql' );
rates = [300e9];
rates = [420e9];
cols = cbrewer2('BuPu',25);
cols = [cols(end-10:2:end,:)];
cols = cbrewer2('Set1',6);
@@ -10,7 +10,7 @@ cols = cbrewer2('Set1',6);
fignum = 200;
fig=figure(fignum);clf;
for dbmode = 0:1%length(rates)
for dbmode = 1%length(rates)
if 0
@@ -59,8 +59,8 @@ for dbmode = 0:1%length(rates)
M = 4;
fp.where('Runs', 'pam_level','EQUALS', M);
fp.where('Runs', 'bitrate','EQUALS', rates);%360,390
fp.where('Runs', 'fiber_length','EQUALS', 10);
fp.where('Runs', 'wavelength','EQUALS', 1322.7); %1327.4
fp.where('Runs', 'fiber_length','EQUALS', 2);
fp.where('Runs', 'wavelength','EQUALS', 1310); %1327.4
fp.where('Runs', 'db_mode','EQUALS', dbmode);
fp.where('Runs', 'rop_attenuation','EQUAL', 0);
@@ -85,7 +85,7 @@ for dbmode = 0:1%length(rates)
%%% 4) Plot RX Signal
Scpe_sig.spectrum("fignum",fignum+dbmode,"normalizeTo0dB",1,"displayname",'Rx','addDCoffset',1,'color',[0,0,0],'normalizeToNyquist',0,'linestyle',':');
Scpe_sig.eye(fsym,M,"fignum",47,"displayname",' Eye of AVG Signal');
Scpe_sig.eye(fsym,M,"fignum",47,"displayname",' Eye of AVG Signal');
% xline(Symbols.fs/2.*1e-9,'Color',cols(r,:),'HandleVisibility','off');
average_signals = 1;
@@ -98,7 +98,10 @@ Scpe_sig.eye(fsym,M,"fignum",47,"displayname",' Eye of AVG Signal');
scope_mean = scope_mean ./ n;
Scpe_sig_avg.signal = scope_mean;
Scpe_sig_avg.spectrum("displayname","Scope PSD","fignum",20,"normalizeTo0dB",1);
figure(20);hold on
Symbols.spectrum("fignum",20,"normalizeTo0dB",1,"displayname",'Full Response','addDCoffset',0,'color',clr.Set1.red,'normalizeToNyquist',0,'linestyle','--');
DB_Symbols.spectrum("fignum",20,"normalizeTo0dB",1,"displayname",'DB-Response','addDCoffset',0,'color',clr.Set1.blue,'normalizeToNyquist',0,'linestyle','--');
Scpe_sig_avg.spectrum("displayname","Scope PSD","fignum",20,"normalizeTo0dB",1,"addDCoffset",5);
Scpe_sig_avg.plot("displayname","Scope raw signal","fignum",27,"clear",1);
Scpe_sig_avg.eye(fsym,M,"fignum",48,"displayname",' Eye of AVG Signal');
end

View File

@@ -0,0 +1,127 @@
%% Main Script: Compare Bibliographies
% This script loads two .bbl files, parses them into tables, and compares
% them to find missing citations and duplicates.
clc; clear; close all;
% --- STEP 0: Create Dummy Files for Demonstration ---
% (You can remove this step if you have actual files on disk)
file1 = 'C:\Users\Silas\Documents\latex\JLT_400G_submission\Advanced_DSP_for_400G_IMDD.bbl'; % The file based on your input
file2 = 'C:\Users\Silas\Documents\latex\JLT_400G_submission\Advanced_DSP_for_400G_IMDD_v1.bbl'; % A modified version to show differences
% --- STEP 1: Load and Parse Files ---
fprintf('Loading files...\n');
try
tab1 = parse_bbl_file(file1);
tab2 = parse_bbl_file(file2);
catch ME
error('Error loading files: %s', ME.message);
end
fprintf('File 1 (%s): %d citations found.\n', file1, height(tab1));
fprintf('File 2 (%s): %d citations found.\n', file2, height(tab2));
disp('------------------------------------------------------------');
% --- STEP 2: Check for Duplicates within files ---
check_duplicates(tab1, file1);
check_duplicates(tab2, file2);
disp('------------------------------------------------------------');
% --- STEP 3: Compare Files (Set Differences) ---
% Find keys in A that are NOT in B
[~, idx1] = setdiff(tab1.Key, tab2.Key);
missing_in_B = tab1(idx1, :);
% Find keys in B that are NOT in A
[~, idx2] = setdiff(tab2.Key, tab1.Key);
missing_in_A = tab2(idx2, :);
% --- STEP 4: Display Comparison Results ---
if isempty(missing_in_B)
fprintf('All citations from %s are present in %s.\n', file1, file2);
else
fprintf('Citations in %s but MISSING in %s (%d):\n', file1, file2, height(missing_in_B));
disp(missing_in_B.Key);
end
fprintf('\n');
if isempty(missing_in_A)
fprintf('All citations from %s are present in %s.\n', file2, file1);
else
fprintf('Citations in %s but MISSING in %s (%d):\n', file2, file1, height(missing_in_A));
disp(missing_in_A.Key);
end
%% ---------------------------------------------------------
% HELPER FUNCTIONS
% ---------------------------------------------------------
function check_duplicates(T, filename)
% Checks if the 'Key' column has non-unique entries
[uKeys, ~, idx] = unique(T.Key);
counts = accumarray(idx, 1);
dup_indices = find(counts > 1);
if isempty(dup_indices)
fprintf('No duplicates found in %s.\n', filename);
else
fprintf('** WARNING: Duplicates found in %s! **\n', filename);
for i = 1:length(dup_indices)
key_idx = dup_indices(i);
fprintf(' Key "%s" appears %d times.\n', uKeys{key_idx}, counts(key_idx));
end
end
end
function bibTable = parse_bbl_file(filename)
% PARSE_BBL_FILE Loads a .bbl file and extracts citations using Regex.
%
% bibTable = PARSE_BBL_FILE(filename) returns a table with columns:
% - Key: The citation key (e.g., 'dambrosiaAug2025Progress')
% - RawContent: The full text of the citation entry
% - Line: Approximate line number where it starts
% 1. Read the file content
if ~isfile(filename)
error('File "%s" not found.', filename);
end
str = fileread(filename);
% 2. Define Regex Structure
% Explanation:
% \\bibitem\{ -> Match literal "\bibitem{"
% (?<Key>[^}]+) -> Capture Group 'Key': match anything except '}'
% \} -> Match literal "}"
% \s* -> Match optional whitespace
% (?<Content>.*?) -> Capture Group 'Content': match any character lazily...
% (?=(\\bibitem|\\end\{thebibliography\})) -> ...until looking ahead sees "\bibitem" or end of env.
% Note: 'dotexceptnewline' is usually default, but we need dot to match newlines
% for multi-line citations. We handle this using the '(?s)' flag or explicit loop.
% Here we use standard pattern matching.
pattern = '\\bibitem\{(?<Key>[^}]+)\}\s*(?<Content>.*?)(?=(\\bibitem|\\end\{thebibliography\}))';
% 3. Execute Regex
% 'warnings' turned off for empty matches if file is malformed
[matches] = regexp(str, pattern, 'names');
% 4. Convert to Table
if isempty(matches)
warning('No citations found in %s using standard regex.', filename);
bibTable = table({}, {}, 'VariableNames', {'Key', 'RawContent'});
return;
end
% Clean up content (remove leading/trailing spaces/newlines)
keys = {matches.Key}';
content = {matches.Content}';
content = strtrim(content);
bibTable = table(keys, content, 'VariableNames', {'Key', 'RawContent'});
end