Renaming and spelling correction
This commit is contained in:
parent
05e1ede24f
commit
f9acffba10
@ -12,7 +12,7 @@ datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\exampl
|
||||
|
||||
[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);
|
||||
|
||||
|
109
average_maximum.m
Normal file
109
average_maximum.m
Normal file
@ -0,0 +1,109 @@
|
||||
function [dataOUT,params] = average_maximum(dataIN,params)
|
||||
%AVERAGE_MAXIMUM normalizes data by max of region
|
||||
%
|
||||
% 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" 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 = 'Average of Data in Maximum';
|
||||
fig.Units = 'Normalized';
|
||||
fig.Position = [.2 .2 .6 .6];
|
||||
fig.Tag = 'Normalize';
|
||||
|
||||
%panel for plot
|
||||
plotpanel = uipanel(fig);
|
||||
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
|
||||
|
||||
%create push buttons
|
||||
a = uicontrol(fig,'Style','pushbutton');
|
||||
a.String = 'Apply';
|
||||
a.Units = 'Normalized';
|
||||
a.Position = [.52 .01 .15 .05];
|
||||
a.FontUnits = 'Normalized';
|
||||
a.FontSize = 0.6;
|
||||
a.Tag = 'Apply';
|
||||
a.Callback = @NormApplyButtonPushed;
|
||||
|
||||
r = uicontrol(fig,'Style','pushbutton');
|
||||
r.String = 'Reset';
|
||||
r.Units = 'Normalized';
|
||||
r.Position = [.68 .01 .15 .05];
|
||||
r.FontUnits = 'Normalized';
|
||||
r.FontSize = 0.6;
|
||||
r.Tag = 'Reset';
|
||||
r.Callback = @NormResetButtonPushed;
|
||||
|
||||
d = uicontrol(fig,'Style','pushbutton');
|
||||
d.String = 'Done';
|
||||
d.Units = 'Normalized';
|
||||
d.Position = [.84 .01 .15 .05];
|
||||
d.FontUnits = 'Normalized';
|
||||
d.FontSize = 0.6;
|
||||
d.Tag = 'Done';
|
||||
d.Callback = @NormDoneButtonPushed;
|
||||
|
||||
%create input fields
|
||||
p1 = uicontrol(fig,'Style','edit');
|
||||
p1.String = 'Left point of max region';
|
||||
p1.Units = 'Normalized';
|
||||
p1.Position = [.01 .01 .24 .05];
|
||||
p1.HorizontalAlignment = 'left';
|
||||
p1.FontUnits = 'Normalized';
|
||||
p1.FontSize = 0.6;
|
||||
p1.Tag = 'MaxRegionLeft';
|
||||
|
||||
p2 = uicontrol(fig,'Style','edit');
|
||||
p2.String = 'Right point of max region';
|
||||
p2.Units = 'Normalized';
|
||||
p2.Position = [.25 .01 .24 .05];
|
||||
p2.HorizontalAlignment = 'left';
|
||||
p2.FontUnits = 'Normalized';
|
||||
p2.FontSize = 0.6;
|
||||
p2.Tag = 'MaxRegionRight';
|
||||
|
||||
uicontrol(p1); %passes focus to first input
|
||||
uiwait(fig)
|
||||
|
||||
%% Callback functions
|
||||
function NormApplyButtonPushed(~,~)
|
||||
left_point = str2double(get(p1,'String'));
|
||||
right_point = str2double(get(p2,'String'));
|
||||
%take mean of each field line between specified min and max time
|
||||
maxima_mean = mean(dataIN([left_point right_point],:));
|
||||
%normalize amplitude to 1 by dividing by max of means
|
||||
dataOUT = dataIN / max(maxima_mean);
|
||||
%plotting result with time as x axis
|
||||
plot(ax,dataOUT)
|
||||
axis tight
|
||||
%writing parameter
|
||||
params.region_of_max = [left_point right_point];
|
||||
params.max_mean = maxima_mean / max(maxima_mean);
|
||||
end
|
||||
|
||||
function NormResetButtonPushed(~,~)
|
||||
plot(ax,dataIN)
|
||||
axis tight
|
||||
end
|
||||
|
||||
function NormDoneButtonPushed(~,~)
|
||||
close 'Average of Data in Maximum'
|
||||
end
|
||||
|
||||
end
|
@ -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
|
||||
|
@ -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';
|
||||
|
@ -146,7 +146,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 +191,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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user