Merge branch 'objectify' trying to get rid off uncommon flows

This commit is contained in:
sakul-45 2021-08-02 11:44:19 +02:00
commit b76cf58945
7 changed files with 39 additions and 39 deletions

View File

@ -4,15 +4,17 @@ 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';
% datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\example_data.mat';
% [raw_data,params] = load_matlab(datapath);
[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);
[time_corr_data,params] = correct_time_baseline(raw_data,params);
[full_corr_data,params] = correct_magnetic_baseline(time_corr_data,params);
[norm_data,params] = normalize_data(full_corr_data,params);
[norm_data,params] = average_maximum(full_corr_data,params);
[params] = pre_simulation_TREPR(params);

View File

@ -1,20 +1,20 @@
function [dataOUT,params] = normalize_data(dataIN,params)
%NORMALISE_DATA normalizes data by max of region
function [dataOUT,params] = average_maximum(dataIN,params)
%AVERAGE_MAXIMUM normalizes data by max of region
%
% Usage: [dataOUT,params] = NORMALISE_DATA(dataIN,params), where dataIN
% Usage: [dataOUT,params] = AVERAGE_MAXIMUM(dataIN,params), where dataIN
% is a dataset loaded via the LOAD_MATLAB or LOAD_BRUKER function.
%
% The function will show the input data and offer two input fields, where
% the left and right borders of the maximum's region should be set.
% By pressing "Apply" the normalization will be executed and the graph
% changes to the normalized data. The borders of the maximum region and
% the mean of maximums will also be appended to the params struct.
% By pressing "Apply" normalization to maximum will be executed and the
% graph changes to the normalized data. The borders of the maximum region
% and the mean of maxima will also be appended to the params struct.
% By pressing "Reset" the graph will return to show the original data.
% Exit the function by pressing "Done".
%% creating UI
fig = figure;
fig.Name = 'Normalize Data';
fig.Name = 'Average of Data in Maximum';
fig.Units = 'Normalized';
fig.Position = [.2 .2 .6 .6];
fig.Tag = 'Normalize';
@ -103,7 +103,7 @@ uiwait(fig)
end
function NormDoneButtonPushed(~,~)
close 'Normalize Data'
close 'Average of Data in Maximum'
end
end

View File

@ -15,7 +15,7 @@ function [dataOUT,params] = correct_magnetic_baseline(dataIN,params)
%% creating UI
fig = figure;
fig.Name = 'Correct Magnetic Baseline';
fig.Name = 'Correct Magnetic Field Baseline';
fig.Units = 'Normalized';
fig.Position = [.2 .2 .6 .6];
fig.Tag = 'CorrMagBase';
@ -72,7 +72,7 @@ p1.FontSize = 0.6;
p1.Tag = 'FieldPoints';
p2 = uicontrol(fig,'Style','edit');
p2.String = 'No. points to cut';
p2.String = 'No. points to cut before';
p2.Units = 'Normalized';
p2.Position = [.26 .01 .24 .05];
p2.HorizontalAlignment = 'left';
@ -120,7 +120,7 @@ uiwait(fig)
end
function FieldDoneButtonPushed(~,~)
close 'Correct Magnetic Baseline'
close 'Correct Magnetic Field Baseline'
end
end

View File

@ -11744,23 +11744,11 @@
<S>1</S>
<g>2</g>
<D>2150</D>
<D>70</D>
<D>75</D>
<lw>8</lw>
<lw>0</lw>
</Manual_Sys>
<Triplett_pop>0</Triplett_pop>
<Triplett_pop>0.71429</Triplett_pop>
<Triplett_pop>0.28571</Triplett_pop>
<Fitted_Simulation>
<S>1</S>
<g>1.9934</g>
<D>2150.3379</D>
<D>66.695461</D>
<lw>9</lw>
<lw>0</lw>
<Temperature>0</Temperature>
<Temperature>0.55912</Temperature>
<Temperature>0.44088</Temperature>
<weight>1</weight>
</Fitted_Simulation>
</struct>

View File

@ -47,7 +47,7 @@ params.Accumulations = bruker_params.AVGS;
params.laser_shotreprate = "NOT RECORDED";
params.Field_Start = bruker_params.YMIN;
params.Field_End = bruker_params.YMIN + bruker_params.YWID;
params.Field_Vector = cell2mat(bruker_axes(1,2));
params.Field_Vector = cell2mat(bruker_axes(1,2)).';
params.mwFreq = bruker_params.MWFQ / 1e9;
params.mwPower = bruker_params.MWPW * 1e3;
params.QValue = "NOT RECORDED";

View File

@ -10,6 +10,9 @@ function [params] = pre_simulation_TREPR(params)
% different relevant paramters of TREPR simulation.
% By pressing "Apply" the simulation will be calculated and displayed.
% The simulation parameters will be saved to the params struct.
% Note: Triplett popluations will be processed normalized, but must not
% be equal.
% "Done" will close the window.
%% creating UI
fig = figure;
@ -51,7 +54,7 @@ d.Callback = @PreSimDoneButtonPushed;
%% create input and text fields (Triplet)
textTrip = uicontrol(fig,'Style','text');
textTrip.String = 'Triplett populations';
textTrip.String = 'Triplet populations';
textTrip.Units = 'Normalized';
textTrip.Position = [.71 .94 .28 .05];
textTrip.HorizontalAlignment = 'center';
@ -70,7 +73,7 @@ textTx.FontSize = 0.6;
textTx.Tag = 'textTx';
InpTx = uicontrol(fig,'Style','edit');
InpTx.String = '1';
InpTx.String = '0.9';
InpTx.Units = 'Normalized';
InpTx.Position = [.75334 .89 .04333 .05];
InpTx.HorizontalAlignment = 'left';
@ -88,7 +91,7 @@ textTy.FontSize = 0.6;
textTy.Tag = 'textTy';
InpTy = uicontrol(fig,'Style','edit');
InpTy.String = '1';
InpTy.String = '1.0';
InpTy.Units = 'Normalized';
InpTy.Position = [.85001 .89 .04333 .05];
InpTy.HorizontalAlignment = 'left';
@ -106,7 +109,7 @@ textTz.FontSize = 0.6;
textTz.Tag = 'textTz';
InpTz = uicontrol(fig,'Style','edit');
InpTz.String = '1';
InpTz.String = '1.1';
InpTz.Units = 'Normalized';
InpTz.Position = [.94667 .89 .04333 .05];
InpTz.HorizontalAlignment = 'left';
@ -116,7 +119,7 @@ InpTz.Tag = 'InpTz';
%% create input and text fields (D & E)
textDE = uicontrol(fig,'Style','text');
textDE.String = 'D tensor';
textDE.String = 'ZFS parameters / MHz';
textDE.Units = 'Normalized';
textDE.Position = [.71 .77 .28 .05];
textDE.HorizontalAlignment = 'center';
@ -153,7 +156,7 @@ textE.FontSize = 0.6;
textE.Tag = 'textE';
InpE = uicontrol(fig,'Style','edit');
InpE.String = '1/3 D';
InpE.String = 'max D/3';
InpE.Units = 'Normalized';
InpE.Position = [.9225 .72 .0675 .05];
InpE.HorizontalAlignment = 'left';
@ -208,9 +211,9 @@ InpG.FontUnits = 'Normalized';
InpG.FontSize = 0.6;
InpG.Tag = 'InpG';
%% create input and text fields (linewidth)
%% create input and text fields (linewidths)
textLW = uicontrol(fig,'Style','text');
textLW.String = 'Linewidth';
textLW.String = 'Linewidths';
textLW.Units = 'Normalized';
textLW.Position = [.71 .43 .28 .05];
textLW.HorizontalAlignment = 'center';

View File

@ -25,6 +25,7 @@ eventdata.manExp.Harmonic = 0; % zeroth harmonic
eventdata.manExp.Temperature = params.Triplett_pop;
eventdata.simSys = params.Manual_Sys; %initialize simulation parameters
eventdata.simExp = eventdata.manExp;
eventdata.SaveStat = 0; %counter if save button was pushed
%% creating UI
fig = figure;
@ -146,7 +147,7 @@ InpTz.Tag = 'InpTz';
%% create input and text fields (D & E)
textDE = uicontrol(fig,'Style','text');
textDE.String = 'D tensor variation';
textDE.String = 'ZFS parameter variation / MHz';
textDE.Units = 'Normalized';
textDE.Position = [.71 .78 .28 .05];
textDE.HorizontalAlignment = 'center';
@ -191,7 +192,7 @@ InpE.FontUnits = 'Normalized';
InpE.FontSize = 0.6;
InpE.Tag = 'InpE';
%% create input and text fields (linewidth)
%% create input and text fields (linewidths)
textLW = uicontrol(fig,'Style','text');
textLW.String = 'Linewidth variations';
textLW.Units = 'Normalized';
@ -349,10 +350,16 @@ uiwait(fig)
eventdata.simExp.Temperature = eventdata.BestSys.Temperature;
%save fitted parameters to struct
params.Fitted_Simulation = eventdata.BestSys;
eventdata.SaveStat = eventdata.SaveStat + 1;
end
function SimDoneButtonPushed(~,~)
if eventdata.SaveStat == 0
params.Fitted_Simulation = eventdata.BestSys;
close 'Simulation'
else
close 'Simulation'
end
end
end