diff --git a/TR_EPR_script.m b/TR_EPR_script.m index e5a27f7..5b813de 100644 --- a/TR_EPR_script.m +++ b/TR_EPR_script.m @@ -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); diff --git a/normalize_data.m b/average_maximum.m similarity index 84% rename from normalize_data.m rename to average_maximum.m index 81b3eab..f6c3606 100644 --- a/normalize_data.m +++ b/average_maximum.m @@ -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 diff --git a/correct_magnetic_baseline.m b/correct_magnetic_baseline.m index bd1cd3b..2debd1f 100644 --- a/correct_magnetic_baseline.m +++ b/correct_magnetic_baseline.m @@ -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 diff --git a/example_data.xml b/example_data.xml index 60c0d9f..04c6e78 100644 --- a/example_data.xml +++ b/example_data.xml @@ -11744,23 +11744,11 @@ 1 2 2150 - 70 + 75 8 0 0 0.71429 0.28571 - - 1 - 1.9934 - 2150.3379 - 66.695461 - 9 - 0 - 0 - 0.55912 - 0.44088 - 1 - diff --git a/load_bruker.m b/load_bruker.m index b6dd349..3de8487 100644 --- a/load_bruker.m +++ b/load_bruker.m @@ -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"; diff --git a/pre_simulation_TREPR.m b/pre_simulation_TREPR.m index bb4d6d2..647064e 100644 --- a/pre_simulation_TREPR.m +++ b/pre_simulation_TREPR.m @@ -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'; diff --git a/simulation_TREPR.m b/simulation_TREPR.m index 0c9c731..963bf4b 100644 --- a/simulation_TREPR.m +++ b/simulation_TREPR.m @@ -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(~,~) - close 'Simulation' + if eventdata.SaveStat == 0 + params.Fitted_Simulation = eventdata.BestSys; + close 'Simulation' + else + close 'Simulation' + end end end \ No newline at end of file