Merge patches from branch 'objectify'

This commit is contained in:
sakul-45 2021-08-02 19:30:13 +02:00
commit dae8c23926
6 changed files with 51 additions and 31 deletions

View File

@ -4,11 +4,11 @@ close all
%Script for calling the functions of TR-EPR toolbox
%path to dataset
% datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\example_data.mat';
% [raw_data,params] = load_matlab(datapath);
datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\example_data.mat';
[raw_data,params] = load_matlab(datapath);
datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\pentacene_355nm_481pt.DSC';
[raw_data,params] = load_bruker(datapath);
% datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\pentacene_355nm_481pt.DSC';
% [raw_data,params] = load_bruker(datapath);
[time_corr_data,params] = correct_time_baseline(raw_data,params);

View File

@ -25,11 +25,11 @@ plotpanel.Units = 'Normalized';
plotpanel.Position = [.01 .06 .98 .92];
%axes for plot
ax = axes(plotpanel);
ax.XLabel.String = 'Time';
ax.YLabel.String = 'Intensity';
%plot current data in figure with time as x axis
plot(ax,dataIN)
axis tight
xlabel(ax,'Time Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%create push buttons
a = uicontrol(fig,'Style','pushbutton');
@ -91,7 +91,9 @@ uiwait(fig)
dataOUT = dataIN / max(maxima_mean);
%plotting result with time as x axis
plot(ax,dataOUT)
axis tight
xlabel(ax,'Time Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%writing parameter
params.region_of_max = [left_point right_point];
params.max_mean = maxima_mean / max(maxima_mean);
@ -99,7 +101,9 @@ uiwait(fig)
function NormResetButtonPushed(~,~)
plot(ax,dataIN)
axis tight
xlabel(ax,'Time Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
end
function NormDoneButtonPushed(~,~)

View File

@ -26,12 +26,12 @@ plotpanel.Units = 'Normalized';
plotpanel.Position = [.01 .06 .98 .92];
%axes for plot
ax = axes(plotpanel);
ax.XLabel.String = 'Magnetic field';
ax.YLabel.String = 'Intensity';
%plot current data in figure with field as x axis
dataIN_transp = dataIN.';
plot(ax,dataIN_transp)
axis tight
xlabel(ax,'Magnetic Field Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%create push buttons
a = uicontrol(fig,'Style','pushbutton');
@ -102,7 +102,9 @@ uiwait(fig)
%plotting result with field as x axis
dataOUT_transp = dataOUT.';
plot(ax,dataOUT_transp)
axis tight
xlabel(ax,'Magnetic Field Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%adjusting parameter
params.Field_Sweep = params.Field_Sweep - params.Field_Step*2*field_cut;
params.Field_Start = params.Field_Start + params.Field_Step*field_cut;
@ -116,7 +118,9 @@ uiwait(fig)
function FieldResetButtonPushed(~,~)
plot(ax,dataIN_transp)
axis tight
xlabel(ax,'Magnetic Field Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
end
function FieldDoneButtonPushed(~,~)

View File

@ -24,11 +24,11 @@ plotpanel.Units = 'Normalized';
plotpanel.Position = [.01 .06 .98 .92];
%axes for plot
ax = axes(plotpanel);
ax.XLabel.String = 'Time';
ax.YLabel.String = 'Intensity';
%plot current data in figure
plot(ax,dataIN)
axis tight
xlabel(ax,'Time Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%create push buttons
a = uicontrol(fig,'Style','pushbutton');
@ -83,14 +83,18 @@ uiwait(fig)
end
%plotting result
plot(ax,dataOUT)
axis tight
xlabel(ax,'Time Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%writing parameter
params.pretrigger = pretrigger;
end
function TimeResetButtonPushed(~,~)
plot(ax,dataIN)
axis tight
xlabel(ax,'Time Points');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
end
function TimeDoneButtonPushed(~,~)

View File

@ -27,11 +27,11 @@ plotpanel.Units = 'Normalized';
plotpanel.Position = [.01 .01 .7 .98];
%axes for plot
ax = axes(plotpanel);
ax.XLabel.String = 'magnetic field';
ax.YLabel.String = 'Intensity';
%plot current data in figure with field as x axis
plot(ax,0.1*params.Field_Vector,params.max_mean,'r')
axis tight
xlabel(ax,'Magnetic Field / mT');
ylabel(ax,'EPR Signal / A. U.');
axis(ax,'tight');
%% create push buttons
a = uicontrol(fig,'Style','pushbutton');
@ -289,8 +289,10 @@ uiwait(fig)
%plot result
plot(ax,0.1*params.Field_Vector,params.max_mean,'r',...
bfield,spec_norm,'b','LineWidth',1.2)
legend('experimental','simulation')
axis tight
xlabel(ax,'Magnetic Field / mT');
ylabel(ax,'EPR Signal / A. U.');
legend(ax,'experimental','simulation');
axis(ax,'tight');
%write manual fit to params
params.Manual_Sys = Sys;
params.Triplett_pop = Exp.Temperature;

View File

@ -24,6 +24,7 @@ eventdata.manExp.CenterSweep = 0.1*[params.Field_Center params.Field_Sweep]; % m
eventdata.manExp.Harmonic = 0; % zeroth harmonic
eventdata.manExp.Temperature = params.Triplett_pop;
eventdata.simSys = params.Manual_Sys; %initialize simulation parameters
eventdata.simSys.Temperature = params.Triplett_pop;
eventdata.simExp = eventdata.manExp;
eventdata.SaveStat = 0; %counter if save button was pushed
@ -48,7 +49,7 @@ spec_norm = spec/max(spec); % normalize the simulation
plot(ax,0.1*params.Field_Vector,params.max_mean,'r',...
bfield,spec_norm,'b','LineWidth',1.2)
xlabel 'Magnetic Field / mT'
ylabel 'EPR signal / A. U.'
ylabel 'EPR Signal / A. U.'
legend('experimental','simulation')
axis tight
@ -328,15 +329,20 @@ uiwait(fig)
%get previous simulation parameters (manual or saved)
Sys0 = eventdata.simSys;
Exp0 = eventdata.simExp;
%check if Temperature can run into negative
for nT = 1:3
if Sys0.Temperature(nT) - Vary.Temperature(nT) < 0
warndlg('Triplett population boundary < 0!','Warning');
end
end
%perform fit
Sys0.Temperature = [0 0 0];
[BestSys,BestSpc] = esfit('thyme',params.max_mean,Sys0,Vary,Exp0,[],FitOpt);
plot(ax,0.1*params.Field_Vector,params.max_mean,'r',...
0.1*params.Field_Vector,BestSpc,'b','LineWidth',1.2)
xlabel 'Magnetic Field / mT'
ylabel 'EPR signal / A. U.'
legend('experimental','simulation')
axis tight
0.1*params.Field_Vector,BestSpc,'b','LineWidth',1.2);
xlabel(ax,'Magnetic Field / mT');
ylabel(ax,'EPR Signal / A. U.');
legend(ax,'experimental','simulation');
axis(ax,'tight');
%normalize Triplett population
Tsum = sum(BestSys.Temperature);
BestSys.Temperature = BestSys.Temperature ./ Tsum;