measurement state

This commit is contained in:
Silas Labor Zizou
2024-10-29 14:38:22 +01:00
parent 99fe2ca106
commit cf4e0f2b12
14 changed files with 1469 additions and 319 deletions

View File

@@ -27,7 +27,7 @@ classdef Signal
[~,obj.gitSHA] = system('git rev-parse HEAD');
[~,obj.gitStatus] = system('git status --porcelain');
[~,obj.gitPatch] = system('git diff');
% [~,obj.gitPatch] = system('git diff');
%%% Stuff for Logbook %%%
SignalType = [];
@@ -344,7 +344,7 @@ classdef Signal
% spectrum_plot(obj.signal,options.fsamp,options.figurename,options.displayname);
N = 2^(nextpow2(length(obj.signal))-8);
N = 2^(nextpow2(length(obj.signal))-10);
if options.normalizeToNyquist==0
[p_lin,w] = pwelch(obj.signal,hanning(N),N/2,N,obj.fs,"centered","power","mean");

View File

@@ -241,10 +241,11 @@ classdef ChannelFreqResp < handle
xlim([0.2 .5*max(obj.faxis)*1e-9]); grid on;
%%% plot for publication
figure(20);hold on;box on;title('Magnitude Freq. Response');
figure(30);hold on;box on;title('Magnitude Freq. Response');
% xlim([0 max(obj.faxis)*1e-9]);
% ylim([-20, 10]);
fax = obj.faxis - obj.f_ref/2;
Havg = Havg ./ max(abs(Havg));
plot(fax/1e9, 20*log10(abs(fftshift(Havg)))+7,'LineWidth',2);
grid on;

View File

@@ -164,11 +164,11 @@ classdef Duobinary
elseif I == 11
%todo
data = data .* sqrt(5.8);
warning('Check if PAM16 implementation, mapping and scaling is correct!')
warning('Check db decode implementation, mapping and scaling is correct!')
elseif I == 15
data = data .* sqrt(10.5);
elseif I == 16
warning('Check if PAM16 implementation, mapping and scaling is correct!')
warning('Check db decode implementation, mapping and scaling is correct!')
end
data = round(data);

View File

@@ -52,7 +52,7 @@ classdef Exfo_laser < handle
if obj.safety_mode
warning("Safety_mode ON: Display all information. Ask when switching laser. Turn safety_mode off in class instance or during initialization Exfo_laser(...,'safety_mode',0)");
else
warning("safety_mode OFF: EVERYTHING IS EXECUTED WITHOUT ASKING :-) BE SHURE WHAT YOU DO");
warning("safety_mode OFF: EVERYTHING IS EXECUTED WITHOUT ASKING :-) BE SURE WHAT YOU DO");
end
end

View File

@@ -53,8 +53,11 @@ classdef OptAtten < handle
try
%connect to device
v = visadev('TCPIP::134.245.243.248::INSTR');
debug = 0;
if debug
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
@@ -213,7 +216,7 @@ classdef OptAtten < handle
ch_info_txt = ['OptAtten: ',num2str(i),' -> Attenuated by: ',num2str(options.value(i)),' dB; Cur Output: ',num2str(state.outputpower(i)),'dBm'];
disp(ch_info_txt);
end
end
end
@@ -258,11 +261,6 @@ classdef OptAtten < handle
answer = sscanf(line,'%f');
obj.power_state(cnt) = answer;
writeline(v, [':READ' num2str(s) ':POW?']);
line = readline(v);
answer = sscanf(line,'%f');
obj.power_state(cnt) = answer;
writeline(v, [':INP' num2str(s) ':ATT?']);
line = readline(v);
answer = sscanf(line,'%f');
@@ -273,7 +271,7 @@ classdef OptAtten < handle
answer = sscanf(line,'%f');
obj.wavelength_state(cnt) = answer;
writeline(v, [':INP' num2str(s) ':WAV?']);
writeline(v, [':INP' num2str(s) ':ATT:SPE?']);
line = readline(v);
answer = sscanf(line,'%f');
obj.speed_state(cnt) = answer;
@@ -294,6 +292,25 @@ classdef OptAtten < handle
end
end
function [p1,p2,p3,p4]=readPower(obj)
v = visadev('TCPIP::134.245.243.248::INSTR');
cnt = 1;
for s = 1:2:7
writeline(v, [':READ' num2str(s) ':POW?']);
line = readline(v);
answer = sscanf(line,'%f');
obj.power_state(cnt) = answer;
cnt = cnt+1;
end
p1 = obj.power_state(1);
p2 = obj.power_state(2);
p3 = obj.power_state(3);
p4 = obj.power_state(4);
end
end
end

View File

@@ -131,7 +131,7 @@ classdef ScopeKeysight
%use this to finetune autoscaling - VERY helpful
% higher value leads to higher scaling
fintunefactor = 1.4; % within [1,...,2]
fintunefactor = 1.5; % within [1,...,2]
obj.writeNcheck(v,sprintf(':CHANnel%u:RANGe %.3f',n,range/fintunefactor));
end
else
@@ -141,6 +141,8 @@ classdef ScopeKeysight
% After Autoscale, let the user adjust the scope scaling...
% "options.waitUntilClick" was a shit name but now this is it :-)
if options.waitUntilClick
if 0
% Create a dialog box with the desired text
d = dialog('Name', 'Scale Scope then press continue', 'Position', [300, 300, 300, 180]);
@@ -160,6 +162,9 @@ classdef ScopeKeysight
% Pause execution until the dialog box is closed
uiwait(d);
else
holdAndShowValue
end
end
if obj.extRef

View File

@@ -125,23 +125,49 @@ classdef DataStorage < handle
lin_idx = obj.getIndicesByPhys(varargin);
errcnt = 0;
for i=1:numel(lin_idx)
try
tmp = obj.sto.(storageVarName){lin_idx(i)};
if ~isempty(tmp)
if isa(tmp,'Signal')
if isa(tmp,'Signal') || isa(tmp,'struct') || isa(tmp,'Exfo_laser')
if i == 1
value = {};
end
value{i} = tmp ;
elseif isa(tmp,'cell')
if isa(tmp{1},'Signal')
if i == 1
value = {};
end
value{i} = tmp{1} ;
else
value{i} = tmp{1} ;
end
else
value(i,:) = tmp ;
try
value(i,:) = tmp ;
catch
% value(i,:) = tmp(1:size(value,2)) ;
if size(value,2) < size(tmp,2)
diff = size(tmp,2) - size(value,2);
value(:,end+1:end+diff) = NaN(size(value,1),diff);
value(i,:) = tmp ;
elseif size(value,2) > size(tmp,2)
diff = size(value,2) - size(tmp,2);
tmp(:,end+1:end+diff) = NaN(1,diff);
value(i,:) = tmp ;
end
end
end
else
errcnt = errcnt+1;
@@ -166,9 +192,7 @@ classdef DataStorage < handle
% warning([num2str(errcnt),' requested datapoint(s) not in warehouse.']);
end
catch
error('Error in Datastorage: Something happened while looking up in warehouse.')
end
end
else
error('Wrong Request using ExampleWarehouse.getStoValue(*parameter set*). Give me all the Parameters! Please!')