1861 lines
78 KiB
Matlab
1861 lines
78 KiB
Matlab
%% Test script to fit some SLS data
|
|
%
|
|
% This calls all models in all varieties from the nappFitGaussXps.m
|
|
% function. Basically, to test that it is working. The data is random, so
|
|
% fitting is meaningless.
|
|
%% Random data for 2 peaks
|
|
clc
|
|
clearvars
|
|
close all
|
|
|
|
% create data table consistent with ISS data
|
|
FitList = table;
|
|
FitList.sample = 'O1s, 120eV, m30, cps, 092022';
|
|
FitList.name = {'random.ibw'};
|
|
tmpDataSelection = matches(FitList.sample,'O1s, 120eV, m30, cps, 092022'); % This filters one specific spectrum by "sample name".
|
|
|
|
% add random data on kinetic energy scale
|
|
x = linspace(105, 120, 100)';
|
|
true_params = [99900 2 113; 29000 0.9 110.5];
|
|
y = zeros(size(x));
|
|
fwhm_to_sigma = @(fwhm) fwhm / (2*sqrt(2*log(2)));
|
|
for i = 1:size(true_params,1)
|
|
A = true_params(i,1);
|
|
sigma = fwhm_to_sigma(true_params(i,2));
|
|
pos = true_params(i,3);
|
|
y = y + A * exp(-((x - pos).^2) / (2*sigma^2));
|
|
end
|
|
y = y + (-195.*x+32980);
|
|
y = y + 1000 * randn(size(x)); % add noise
|
|
figure;
|
|
plot(x, y, 'k.');
|
|
xlabel('Kinetic Energy');
|
|
ylabel('Intensity');
|
|
title('Raw Data without Shirley Tail');
|
|
if ~ismember('scientaEkin_eV', FitList.Properties.VariableNames)
|
|
FitList.scientaEkin_eV = cell(size(FitList,1),1);
|
|
end
|
|
if ~ismember('spectrum_countsNorm', FitList.Properties.VariableNames)
|
|
FitList.spectrum_countsNorm = cell(size(FitList,1),1);
|
|
end
|
|
FitList(tmpDataSelection,:).scientaEkin_eV{:} = x;
|
|
FitList(tmpDataSelection,:).spectrum_countsNorm{:} = y;
|
|
index= find(FitList(tmpDataSelection,:).scientaEkin_eV{:}>113,1);
|
|
FitList(tmpDataSelection,:).spectrum_countsNorm{:}(1:index) = FitList(tmpDataSelection,:).spectrum_countsNorm{:}(1:index) + 1000;
|
|
|
|
% add random data on binding energy scale
|
|
x = linspace(42, 30, 1000)';
|
|
true_params = [800 0.4 36.2; 500 0.3 38.0];
|
|
y = zeros(size(x));
|
|
fwhm_to_sigma = @(fwhm) fwhm / (2*sqrt(2*log(2)));
|
|
for i = 1:size(true_params,1)
|
|
A = true_params(i,1);
|
|
sigma = fwhm_to_sigma(true_params(i,2));
|
|
pos = true_params(i,3);
|
|
y = y + A * exp(-((x - pos).^2) / (2*sigma^2));
|
|
end
|
|
% Simulate realistic Shirley-style background using smooth tanh transition
|
|
center = 36.5; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
y = y + 5 * randn(size(x)); % add mild noise
|
|
figure;
|
|
plot(x, y, 'k.');
|
|
xlabel('Binding Energy');
|
|
ylabel('Intensity');
|
|
title('Raw Data with Shirley Tail');
|
|
set(gca, 'XDir', 'reverse'); grid on;
|
|
if ~ismember('bindingEnergy_eV', FitList.Properties.VariableNames)
|
|
FitList.bindingEnergy_eV = cell(size(FitList,1),1);
|
|
end
|
|
if ~ismember('spectrum_counts', FitList.Properties.VariableNames)
|
|
FitList.spectrum_counts = cell(size(FitList,1),1);
|
|
end
|
|
FitList(tmpDataSelection,:).bindingEnergy_eV{:} = x;
|
|
FitList(tmpDataSelection,:).spectrum_counts{:} = y;
|
|
|
|
% plot
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_countsNorm','energyScale','kinetic');
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_counts','energyScale','binding');
|
|
|
|
%% TEST 1.1: Unconstrained kinetic Gauss linear
|
|
% Gaussian + Linear, individual area/width/position per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100]; % <- 2 values => 2 peaks
|
|
tmpFitParameters.peakWidth = [1.6 0.6];
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.0 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 1.2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6]; % <- selects fit range around peak1
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','unconstrained','backgroundMode','linear','showFigures','on');
|
|
|
|
%% TEST 1.2: Unconstrained kinetic PV linear
|
|
% Pseudo-Voigt + Linear, individual area/width/eta/position per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 0.6];
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.0 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 1.2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1]; % <- Gauss - Lorentzian ratio
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','unconstrained','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 1.3: Unconstrained kinetic Gauss Shirley
|
|
% Gaussian + Shirley, individual area/width/position per peak, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 0.6];
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.0 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 1.2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.001, 0.001]; % <- K controls Shirley step magnitude
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [10, 10];
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','unconstrained','backgroundMode','shirley','showFigures','off'); % <- background is now Shirley
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 1.4: Unconstrained kinetic PV Shirley
|
|
% Pseudo-Voigt + Shirley, individual area/width/eta/position per peak, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 0.6];
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.0 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 1.2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1]; % <- Gauss - Lorentzian ratio
|
|
tmpFitParameters.peakEtaLowerBound = [0.0 0.0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.001, 0.001]; % <- K controls Shirley step magnitude
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [10, 10];
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','unconstrained','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 1.5: Unconstrained binding Gauss linear
|
|
% Gaussian + Linear, individual area/width/position per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',... % <- process binding energy
|
|
'mode','unconstrained','backgroundMode','linear','showFigures','on');
|
|
|
|
%% TEST 1.5.2: Unconstrained binding Gauss linear
|
|
% Gaussian + Linear, individual area/width/position per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 1e4 100]; % <- 3 peaks
|
|
tmpFitParameters.peakWidth = [1.6 1.6 1.6];
|
|
tmpFitParameters.peakPos = [38 37 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e2 1e2 1e2];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37.5 37];
|
|
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','unconstrained','backgroundMode','linear','showFigures','on');
|
|
%% TEST 1.6: Unconstrained binding PV linear
|
|
% Pseudo-Voigt + Linear, individual area/width/eta/position per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100]; % <- back to 2 peaks
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT + LINEAR variant:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','unconstrained','backgroundMode','linear','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 1.7: Unconstrained binding Gauss Shirley
|
|
% Gaussian + Shirley, individual area/width/position per peak, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01]; % <- K controls Shirley step magnitude
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','unconstrained','backgroundMode','shirley','showFigures','off');
|
|
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 1.8: Unconstrained binding PV Shirley
|
|
% Pseudo-Voigt + Shirley, individual area/width/eta/position per peak, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01]; % <- K controls Shirley step magnitude
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','unconstrained','backgroundMode','shirley','showFigures','off');
|
|
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 2.1: Position-Constrained kinetic Gaussian Linear
|
|
% Gaussian + Linear, first peak position free, other peaks offset fixed
|
|
|
|
clc
|
|
clearvars tmpFitParameters;
|
|
tmpFitParameters.peakArea = [1e5 1e5]; % <- 2 peaks
|
|
tmpFitParameters.peakWidth = [2 1];
|
|
tmpFitParameters.peakPos = [113 -2.32]; % <- pos peak #2 is relative to peak #1
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1E4 1E4];
|
|
tmpFitParameters.peakAreaUpperBound = [1E6 1E6];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.5 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.5 1.5];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112.5; % <- only pos 1 is fitted
|
|
tmpFitParameters.peakPosUpperBound = 113.5;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','position','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
%% TEST 2.2: Position-Constrained kinetic PV Linear
|
|
% Pseudo-Voigt + Linear, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 1e5];
|
|
tmpFitParameters.peakWidth = [2 1];
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1E4 1E4];
|
|
tmpFitParameters.peakAreaUpperBound = [1E6 1E6];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.5 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.5 1.5];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112.5;
|
|
tmpFitParameters.peakPosUpperBound = 113.5;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','position','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 2.3: Position-Constrained kinetic Gauss Shirley
|
|
% Gaussian + Shirley, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
tmpFitParameters.peakArea = [1e5 1e5];
|
|
tmpFitParameters.peakWidth = [2 1];
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1E4 1E4];
|
|
tmpFitParameters.peakAreaUpperBound = [1E6 1E6];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.5 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.5 1.5];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112.5;
|
|
tmpFitParameters.peakPosUpperBound = 113.5;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.001];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.0, 0.0];
|
|
tmpFitParameters.peakShirleyKUpperBound = [Inf, Inf];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','position','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 2.4: Position-Constrained kinetic PV Shirley
|
|
% Pseudo-Voigt + Shirley, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 1e5];
|
|
tmpFitParameters.peakWidth = [2 1];
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1E4 1E4];
|
|
tmpFitParameters.peakAreaUpperBound = [1E6 1E6];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.5 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.5 1.5];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112.5;
|
|
tmpFitParameters.peakPosUpperBound = 113.5;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.001];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.0, 0.0];
|
|
tmpFitParameters.peakShirleyKUpperBound = [Inf, Inf];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','position','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 2.5: Position binding Gauss linear
|
|
% Gaussian + Linear, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','position','backgroundMode','linear','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 2.6: Position binding PV linear
|
|
% Pseudo-Voigt + Linear, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT + LINEAR variant:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','position','backgroundMode','linear','showFigures','on');
|
|
xlim([34,39])
|
|
%% TEST 2.7: Position binding Gauss Shirley
|
|
% Gaussian + Shirley, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','position','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 2.8: Position binding PV Shirley
|
|
% Pseudo-Voigt + Shirley, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01]; % <- 1 K for each peak
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','position','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
|
|
%% TEST 2.9: Position kinetic PV Shirley shared
|
|
% Pseudo-Voigt + Shirley, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 1e5];
|
|
tmpFitParameters.peakWidth = [2 1];
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1E4 1E4];
|
|
tmpFitParameters.peakAreaUpperBound = [1E6 1E6];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.5 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.5 1.5];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112.5;
|
|
tmpFitParameters.peakPosUpperBound = 113.5;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY:
|
|
tmpFitParameters.peakShirleyK = 0.01; % <- same K for all peaks
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.0;
|
|
tmpFitParameters.peakShirleyKUpperBound = Inf;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','positionShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 2.10: Position kinetic Gauss Shirley Shared
|
|
% Gaussian + Shirley, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
tmpFitParameters.peakArea = [1e5 1e5];
|
|
tmpFitParameters.peakWidth = [2 1];
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1E4 1E4];
|
|
tmpFitParameters.peakAreaUpperBound = [1E6 1E6];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.5 0.6];
|
|
tmpFitParameters.peakWidthUpperBound = [2.5 1.5];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112.5;
|
|
tmpFitParameters.peakPosUpperBound = 113.5;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY:
|
|
tmpFitParameters.peakShirleyK = 0.01;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.0;
|
|
tmpFitParameters.peakShirleyKUpperBound = Inf;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','positionShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 2.11: Position binding Gauss Shirley Shared
|
|
% Gaussian + Shirley, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.01;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 100;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','positionShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 2.12: Position binding PV Shirley Shared
|
|
% Pseudo-Voigt + Shirley, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = [1.6 1.6 ];
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [0.2 0.2];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.01;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 100;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','positionShirley','backgroundMode','shirley','showFigures','on');
|
|
%% TEST 3.1: widthPosition kinetic Gauss linear
|
|
% Gaussian + Linear, shared width, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100]; % <- 2 peaks
|
|
tmpFitParameters.peakWidth = 1.6; % <- one width for all peaks
|
|
tmpFitParameters.peakPos = [113 -2.32]; % <- positions relative to peak1
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112;
|
|
tmpFitParameters.peakPosUpperBound = 114;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPosition','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
%% TEST 3.2: widthPosition kinetic PV linear
|
|
% Pseudo-Voigt + Linear, shared width, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112;
|
|
tmpFitParameters.peakPosUpperBound = 114;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPosition','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 3.3: widthPosition kinetic Gauss Shirley
|
|
% Gaussian + Shirley, shared width, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112;
|
|
tmpFitParameters.peakPosUpperBound = 114;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [10, 10];
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPosition','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
%% TEST 3.4: widthPosition kinetic PV Shirley
|
|
% Pseudo-Voigt + Shirley, shared width, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112;
|
|
tmpFitParameters.peakPosUpperBound = 114;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0.0 0.0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [10, 10];
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPosition','backgroundMode','shirley','showFigures','on');
|
|
%% TEST 3.5: widthPosition binding Gauss linear
|
|
% Gaussian + Linear, shared width, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPosition','backgroundMode','linear','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 3.6: widthPosition binding PV linear
|
|
% Pseudo-Voigt + Linear, shared width, first peak position free, other peaks offset fixed
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT + LINEAR variant:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPosition','backgroundMode','linear','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 3.7: widthPosition binding Gauss Shirley
|
|
% Gaussian + Shirley, shared width, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPosition','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 3.8: widthPosition binding PV Shirley
|
|
% Pseudo-Voigt + Shirley, shared width, first peak position free, other peaks offset fixed, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPosition','backgroundMode','shirley','showFigures','off');
|
|
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
|
|
%% TEST 3.9: widthPosition kinetic Gauss Shirley Shared
|
|
% Gaussian + Shirley, shared width, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112;
|
|
tmpFitParameters.peakPosUpperBound = 114;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.001;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 10;
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPositionShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 3.10: widthPosition kinetic PV Shirley Shared
|
|
% Pseudo-Voigt + Shirley, shared width, first peak position free, other peaks offset fixed, shared Shirley K
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 -2.32];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 112;
|
|
tmpFitParameters.peakPosUpperBound = 114;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0.0 0.0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.1;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 10;
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPositionShirley','backgroundMode','shirley','showFigures','on');
|
|
|
|
%% TEST 3.11: widthPosition binding Gauss Shirley Shared
|
|
% Gaussian + Shirley, shared width, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01]; % <- Too many parameters,
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001]; % Will run anyway
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100]; % but show a warning.
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPositionShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 3.12: widthPosition binding PV Shirley Shared
|
|
% Pseudo-Voigt + Shirley, shared width, first peak position free, other peaks offset fixed, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 -1.8];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 37;
|
|
tmpFitParameters.peakPosUpperBound = 39;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.01;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 100;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPositionShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
|
|
%% TEST 4.1: Width kinetic Gauss linear
|
|
% Gaussian + Linear, shared width, individual areas and positions
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','width','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 4.2: Width kinetic PV linear
|
|
% Pseudo-Voigt + Linear, shared width, individual areas, positions, and etas
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','width','backgroundMode','linear','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 4.3: Width kinetic Gauss Shirley
|
|
% Gaussian + Shirley, shared width, individual areas and positions, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [10, 10];
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','width','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 4.4: Width kinetic PV Shirley
|
|
% Pseudo-Voigt + Shirley, shared width, individual areas, positions, and etas, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0.0 0.0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [10, 10];
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','width','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 4.5: Width binding Gauss linear
|
|
% Gaussian + Linear, shared width, individual areas and positions
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','width','backgroundMode','linear','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 4.6: Width binding PV linear
|
|
% Pseudo-Voigt + Linear, shared width, individual areas, positions, and etas
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT + LINEAR variant:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','width','backgroundMode','linear','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 4.7: Width binding Gauss Shirley
|
|
% Gaussian + Shirley, shared width, individual areas and positions, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','width','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 4.8: Width binding PV Shirley
|
|
% Pseudo-Voigt + Shirley, shared width, individual areas, positions, and etas, Shirley K per peak
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = [0.01, 0.01];
|
|
tmpFitParameters.peakShirleyKLowerBound = [0.001, 0.001];
|
|
tmpFitParameters.peakShirleyKUpperBound = [100, 100];
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','width','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
|
|
%% TEST 4.9: Width kinetic Gauss Shirley Shared
|
|
% Gaussian + Shirley, shared width, individual areas and positions, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.001;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 10;
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
|
|
%% TEST 4.10: Width kinetic PV Shirley Shared
|
|
% Pseudo-Voigt + Shirley, shared width, individual areas, positions, and etas, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [113 110];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [1e3 1e3];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [112 109];
|
|
tmpFitParameters.peakPosUpperBound = [114 111];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT:
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0.0 0.0];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.001;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 10;
|
|
tmpFitParameters.peakShirleyOffset = 1E4;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotKinetic(FitList,tmpDataSelection)
|
|
%% TEST 4.11: Width binding Gauss Shirley Shared
|
|
% Gaussian + Shirley, shared width, individual areas and positions, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.01;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 100;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
%% TEST 4.12: Width binding PV Shirley Shared
|
|
% Pseudo-Voigt + Shirley, shared width, individual areas and positions, shared Shirley K
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [1e5 100];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [38 36];
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0.01 0.01];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.2;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [37 35];
|
|
tmpFitParameters.peakPosUpperBound = [39 37];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = [1 1];
|
|
tmpFitParameters.peakEtaLowerBound = [0 0 ];
|
|
tmpFitParameters.peakEtaUpperBound = [1.0, 1.0];
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.01;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 100;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthShirley','backgroundMode','shirley','showFigures','off');
|
|
quickPlotBinding(FitList,tmpDataSelection)
|
|
xlim([34,39])
|
|
|
|
%% Random data for 5 peaks
|
|
clc
|
|
close all
|
|
% binding
|
|
x = linspace(50, 30, 1000)';
|
|
true_params = [800 1.6 36.2; 500 1.6 38.0;1000 0.3 39.0;800 1.6 40;500 1.6 40.5];
|
|
y = zeros(size(x));
|
|
fwhm_to_sigma = @(fwhm) fwhm / (2*sqrt(2*log(2)));
|
|
for i = 1:size(true_params,1)
|
|
A = true_params(i,1);
|
|
sigma = fwhm_to_sigma(true_params(i,2));
|
|
pos = true_params(i,3);
|
|
y = y + A * exp(-((x - pos).^2) / (2*sigma^2));
|
|
end
|
|
% Simulate realistic Shirley-style background using smooth tanh transition
|
|
center = 36.2; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
center = 38; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
center = 40; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
center = 40.5; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
|
|
y = y + 5 * randn(size(x)); % add mild noise
|
|
figure;
|
|
plot(x, y, 'k.');
|
|
xlabel('Binding Energy');
|
|
ylabel('Intensity');
|
|
title('Raw Data with Shirley Tail');
|
|
set(gca, 'XDir', 'reverse'); grid on;
|
|
hold on;
|
|
if ~ismember('bindingEnergy_eV', FitList.Properties.VariableNames)
|
|
FitList.bindingEnergy_eV = cell(size(FitList,1),1);
|
|
end
|
|
if ~ismember('spectrum_counts', FitList.Properties.VariableNames)
|
|
FitList.spectrum_counts = cell(size(FitList,1),1);
|
|
end
|
|
FitList(tmpDataSelection,:).bindingEnergy_eV{:} = x;
|
|
FitList(tmpDataSelection,:).spectrum_counts{:} = y;
|
|
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_counts','energyScale','binding');
|
|
|
|
|
|
% kinetic
|
|
x = linspace(30, 45, 1000)';
|
|
true_params = [800 1.6 36.2; 500 1.6 38.0;1000 0.3 39.0;800 1.6 40;500 1.6 40.5];
|
|
y = zeros(size(x));
|
|
fwhm_to_sigma = @(fwhm) fwhm / (2*sqrt(2*log(2)));
|
|
for i = 1:size(true_params,1)
|
|
A = true_params(i,1);
|
|
sigma = fwhm_to_sigma(true_params(i,2));
|
|
pos = true_params(i,3);
|
|
y = y + A * exp(-((x - pos).^2) / (2*sigma^2));
|
|
end
|
|
y = y + 5 * randn(size(x)); % add mild noise
|
|
figure;
|
|
plot(x, y, 'k.');
|
|
xlabel('Kinetic Energy');
|
|
ylabel('Intensity');
|
|
title('Raw Data without Shirley Tail');
|
|
grid on;
|
|
hold on;
|
|
|
|
FitList(tmpDataSelection,:).scientaEkin_eV{:} = x;
|
|
FitList(tmpDataSelection,:).spectrum_countsNorm{:} = y;
|
|
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_countsNorm','energyScale','kinetic');
|
|
|
|
|
|
|
|
|
|
%% Test 5.0 Custom ModelunconstrainedAndWidthPosition, kinetic, linear
|
|
% Custom: Gaussian + Linear, shared width for 2 peaks, individual
|
|
% area/position for 5 peaks (peak count must match hardcoded equation: 5
|
|
% peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 5e5 5e5 5e5 5e5];
|
|
tmpFitParameters.peakWidth = [1.6 0.6];
|
|
tmpFitParameters.peakPos = [-1.8 38 39 41 41] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.0 0.1];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 1.2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [-1.8 38 39 41 41]-1;
|
|
tmpFitParameters.peakPosUpperBound = [-1.8 38 39 41 41]+1;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','unconstrainedAndWidthPosition','backgroundMode','linear','showFigures','on');
|
|
|
|
%% Test 5.1 Custom ModelunconstrainedAndWidthPosition, binding, linear
|
|
% Custom: Gaussian + Linear, shared width for 2 peaks, individual
|
|
% area/position for 5 peaks (peak count must match hardcoded equation: 5
|
|
% peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 5e5 5e5 5e5 5e5];
|
|
tmpFitParameters.peakWidth = [1.6 0.6];
|
|
tmpFitParameters.peakPos = [-1.8 38 39 41 41] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1.0 0.1];
|
|
tmpFitParameters.peakWidthUpperBound = [2.0 1.2];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [-1.8 38 39 41 41]-1;
|
|
tmpFitParameters.peakPosUpperBound = [-1.8 38 39 41 41]+1;
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','unconstrainedAndWidthPosition','backgroundMode','linear','showFigures','on');
|
|
%% Test 5.3 Custom widthPositionAmineAreaRatio, kinetic, linear
|
|
% Custom: Gaussian + Linear, shared width, constrained area ratios, 5 peaks
|
|
% with position/area constraints (peak count must match hardcoded equation:
|
|
% 5 peaks)
|
|
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 5e5 1 5e5 5e5];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 1.8 2.8 3.8 5.5 6] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = 34;
|
|
tmpFitParameters.peakPosUpperBound = 36;
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPositionAmineAreaRatio','backgroundMode','linear','showFigures','on');
|
|
%% Test 5.4 Custom gasAndTwoAcidBasePairs, kinetic, linear
|
|
% Custom: Gaussian + Linear, 2 shared widths, constrained to acid-base pair
|
|
% model, 5 peaks (peak count must match hardcoded equation: 5 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 5e5 5e5 5e5 5e5];
|
|
tmpFitParameters.peakWidth = [1 0.3];
|
|
tmpFitParameters.peakPos = [-1 36 39 -1 41] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [100 100 100 100 100];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1 0.1];
|
|
tmpFitParameters.peakWidthUpperBound = [1.6 1];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [-1 37 39 -1 41]-1 ;
|
|
tmpFitParameters.peakPosUpperBound = [-1 37 39 -1 41]+1 ;
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','gasAndTwoAcidBasePairs','backgroundMode','linear','showFigures','on');
|
|
|
|
%% Test 5.5 Custom gasAndTwoAcidBasePairs, binding, linear
|
|
% Custom: Gaussian + Linear, 2 shared widths, constrained to acid-base pair
|
|
% model, 5 peaks (peak count must match hardcoded equation: 5 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 5e5 5e5 5e5 5e5];
|
|
tmpFitParameters.peakWidth = [1 0.3];
|
|
tmpFitParameters.peakPos = [-1 36 39 -1 41] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [100 100 100 100 100];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = [1 0.1];
|
|
tmpFitParameters.peakWidthUpperBound = [1.6 1];
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [-1 37 39 -1 41]-1 ;
|
|
tmpFitParameters.peakPosUpperBound = [-1 37 39 -1 41]+1 ;
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','gasAndTwoAcidBasePairs','backgroundMode','linear','showFigures','on');
|
|
|
|
%% Test 5.6 Custom widthPositionAreaRatio, kinetic, linear
|
|
% Custom: Gaussian + Linear, shared width, fixed area ratios from first
|
|
% peak, 5 peaks (peak count must match hardcoded equation: 5 peaks)
|
|
|
|
|
|
% pos 2-5 of area bounds and position bounds are not used for fitting, but
|
|
% function requires during input validation that these vectors are non NaN
|
|
% and have same length as peakArea. Therefore we need a workaround: set
|
|
% values to 0.
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 1 1 1 1]; % <- area ratio rel to peak #1
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 2 3 4 5] ; % <- position relative to peak #1
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0 0]; % <- workaround
|
|
tmpFitParameters.peakAreaUpperBound = [Inf 0 0 0 0];% <- workaround
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.5;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [34 0 0 0 0];% <- workaround
|
|
tmpFitParameters.peakPosUpperBound = [36 0 0 0 0];% <- workaround
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','widthPositionAreaRatio','backgroundMode','linear','showFigures','on');
|
|
|
|
%% Test 5.7 Custom widthPositionAreaRatio, binding, linear
|
|
% Custom: Gaussian + Linear, shared width, fixed area ratios from first peak, 5 peaks (peak count must match hardcoded equation: 5 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 1 1 1 1];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 2 3 4 5] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0 0]; % <- workaround
|
|
tmpFitParameters.peakAreaUpperBound = [Inf 0 0 0 0];% <- workaround
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 0.5;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [34 0 0 0 0];% <- workaround
|
|
tmpFitParameters.peakPosUpperBound = [36 0 0 0 0];% <- workaround
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','widthPositionAreaRatio','backgroundMode','linear','showFigures','on');
|
|
%% Random data for 4 peaks
|
|
clc
|
|
close all
|
|
% binding
|
|
x = linspace(50, 30, 1000)';
|
|
true_params = [800 1.6 36; 400 1.6 37.0;800 1.6 40;500 1.6 41];
|
|
y = zeros(size(x));
|
|
fwhm_to_sigma = @(fwhm) fwhm / (2*sqrt(2*log(2)));
|
|
for i = 1:size(true_params,1)
|
|
A = true_params(i,1);
|
|
sigma = fwhm_to_sigma(true_params(i,2));
|
|
pos = true_params(i,3);
|
|
y = y + A * exp(-((x - pos).^2) / (2*sigma^2));
|
|
end
|
|
% Simulate realistic Shirley-style background using smooth tanh transition
|
|
center = 36; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
center = 37; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
center = 40; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
center = 401; width = 3;
|
|
shirley_step = 75 + 45 * (1 + tanh((x - center)/width))/2;
|
|
y = y + shirley_step;
|
|
|
|
|
|
y = y + 5 * randn(size(x)); % add mild noise
|
|
figure;
|
|
plot(x, y, 'k.');
|
|
xlabel('Binding Energy');
|
|
ylabel('Intensity');
|
|
title('Raw Data with Shirley Tail');
|
|
set(gca, 'XDir', 'reverse'); grid on;
|
|
hold on;
|
|
if ~ismember('bindingEnergy_eV', FitList.Properties.VariableNames)
|
|
FitList.bindingEnergy_eV = cell(size(FitList,1),1);
|
|
end
|
|
if ~ismember('spectrum_counts', FitList.Properties.VariableNames)
|
|
FitList.spectrum_counts = cell(size(FitList,1),1);
|
|
end
|
|
FitList(tmpDataSelection,:).bindingEnergy_eV{:} = x;
|
|
FitList(tmpDataSelection,:).spectrum_counts{:} = y;
|
|
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_counts','energyScale','binding');
|
|
|
|
|
|
% kinetic
|
|
x = linspace(30, 45, 1000)';
|
|
true_params = [800 1.6 36; 400 1.6 37.0;800 1.6 40;400 1.6 41];
|
|
y = zeros(size(x));
|
|
fwhm_to_sigma = @(fwhm) fwhm / (2*sqrt(2*log(2)));
|
|
for i = 1:size(true_params,1)
|
|
A = true_params(i,1);
|
|
sigma = fwhm_to_sigma(true_params(i,2));
|
|
pos = true_params(i,3);
|
|
y = y + A * exp(-((x - pos).^2) / (2*sigma^2));
|
|
end
|
|
y = y + 5 * randn(size(x)); % add mild noise
|
|
figure;
|
|
plot(x, y, 'k.');
|
|
xlabel('Kinetic Energy');
|
|
ylabel('Intensity');
|
|
title('Raw Data without Shirley Tail');
|
|
grid on;
|
|
hold on;
|
|
|
|
FitList(tmpDataSelection,:).scientaEkin_eV{:} = x;
|
|
FitList(tmpDataSelection,:).spectrum_countsNorm{:} = y;
|
|
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_countsNorm','energyScale','kinetic');
|
|
|
|
%% Test 6.0 Custom TwoSpinOrbitDoublet, kinetic, linear
|
|
% Custom: Gaussian + Linear, shared width, positions are relative, spin-orbit doublet pair model with intensity
|
|
% ratios, 4 peaks (peak count must match hardcoded equation: 4 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 0.5 5e5 0.5];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 1 4] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [34 NaN 3];
|
|
tmpFitParameters.peakPosUpperBound = [36 NaN 5];
|
|
tmpFitParameters.backgroundRange = [12 6];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','TwoSpinOrbitDoublet','backgroundMode','linear','showFigures','on');
|
|
|
|
%% Test 6.1 Custom TwoSpinOrbitDoublet, binding, linear
|
|
% Custom: Gaussian + Linear, spin-orbit doublet pair model with intensity
|
|
% ratios, 4 peaks (peak count must match hardcoded equation: 4 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 0.5 5e5 0.5];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 1 4] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [34 NaN 3];
|
|
tmpFitParameters.peakPosUpperBound = [36 NaN 5];
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','TwoSpinOrbitDoublet','backgroundMode','linear','showFigures','on');
|
|
%% Test 6.2 Custom TwoSpinOrbitDoublet, kinetic, Shirley
|
|
% Custom: Pseudo-Voigt + Shirley, spin-orbit doublet pair model with
|
|
% intensity ratios, shared Shirley K, 4 peaks (peak count must match
|
|
% hardcoded equation: 4 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 0.5 5e5 0.5];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 1 4] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [34 NaN 3];
|
|
tmpFitParameters.peakPosUpperBound = [36 NaN 5];
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = 1;
|
|
tmpFitParameters.peakEtaLowerBound = 0;
|
|
tmpFitParameters.peakEtaUpperBound = 1.0;
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.0001;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0;
|
|
tmpFitParameters.peakShirleyKUpperBound = 0.0001;
|
|
tmpFitParameters.peakShirleyOffset = 0;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_countsNorm','energyScale','kinetic',...
|
|
'mode','TwoSpinOrbitDoubletPseudoVoigtShirley','backgroundMode','shirley','showFigures','on');
|
|
|
|
%% Test 6.3 Custom TwoSpinOrbitDoubletPseudoVoigtShirley, binding, Shirley
|
|
% Custom: Pseudo-Voigt + Shirley, spin-orbit doublet pair model with
|
|
% intensity ratios, shared Shirley K, 4 peaks (peak count must match
|
|
% hardcoded equation: 4 peaks)
|
|
|
|
clearvars tmpFitParameters;
|
|
clc
|
|
tmpFitParameters.peakArea = [5e5 0.5 5e5 0.5];
|
|
tmpFitParameters.peakWidth = 1.6;
|
|
tmpFitParameters.peakPos = [36 1 4] ;
|
|
% Bounds for areas (lower and upper)
|
|
tmpFitParameters.peakAreaLowerBound = [0 0 0 0];
|
|
tmpFitParameters.peakAreaUpperBound = [Inf Inf Inf Inf];
|
|
% Bounds for widths
|
|
tmpFitParameters.peakWidthLowerBound = 1.0;
|
|
tmpFitParameters.peakWidthUpperBound = 2.0;
|
|
% Bounds for positions
|
|
tmpFitParameters.peakPosLowerBound = [34 NaN 3];
|
|
tmpFitParameters.peakPosUpperBound = [36 NaN 5];
|
|
tmpFitParameters.backgroundRange = [12 12];
|
|
% PSEUDO-VOIGT
|
|
tmpFitParameters.peakEta = 1;
|
|
tmpFitParameters.peakEtaLowerBound = 0;
|
|
tmpFitParameters.peakEtaUpperBound = 1.0;
|
|
% SHIRLEY variant:
|
|
tmpFitParameters.peakShirleyK = 0.1;
|
|
tmpFitParameters.peakShirleyKLowerBound = 0.001;
|
|
tmpFitParameters.peakShirleyKUpperBound = 100;
|
|
tmpFitParameters.peakShirleyOffset = 80;
|
|
|
|
FitList = nappFitGaussXps(FitList,tmpFitParameters,tmpDataSelection,...
|
|
'tableVariable','spectrum_counts','energyScale','binding',...
|
|
'mode','TwoSpinOrbitDoubletPseudoVoigtShirley','backgroundMode','shirley','showFigures','on');
|
|
|
|
%% Helper Functions
|
|
|
|
function quickPlotKinetic(FitList,tmpDataSelection)
|
|
% Plot Data
|
|
close all
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_countsNorm','energyScale','kinetic');
|
|
ax = gca;
|
|
lines = findobj(ax, '-regexp', 'Type', 'line');
|
|
set(lines, 'LineStyle', 'none', 'Marker', 'o', 'MarkerSize', 5);
|
|
nappAddFitToPlot(FitList,tmpDataSelection,'energyScale','kinetic')
|
|
try
|
|
disp(FitList(tmpDataSelection,["name","peakPosition","peakArea","peakFWHM","peakBackground"]))
|
|
|
|
disp(FitList(tmpDataSelection,["name","peakEta","peakShirleyK"]))
|
|
catch
|
|
disp(FitList(tmpDataSelection,["sample","name","peakPosition","peakArea","peakFWHM"]))
|
|
end
|
|
end
|
|
|
|
function quickPlotBinding(FitList,tmpDataSelection)
|
|
% Plot Data
|
|
close all
|
|
nappPlot(FitList,tmpDataSelection,'tableVariable','spectrum_counts','energyScale','binding');
|
|
ax = gca;
|
|
lines = findobj(ax, '-regexp', 'Type', 'line');
|
|
set(lines, 'LineStyle', 'none', 'Marker', 'o', 'MarkerSize', 5);
|
|
nappAddFitToPlot(FitList,tmpDataSelection,'energyScale','binding')
|
|
try
|
|
disp(FitList(tmpDataSelection,["name","peakPosition","peakArea","peakFWHM","peakBackground"]))
|
|
|
|
disp(FitList(tmpDataSelection,["name","peakEta","peakShirleyK"]))
|
|
catch
|
|
disp(FitList(tmpDataSelection,["sample","name","peakPosition","peakArea","peakFWHM"]))
|
|
end
|
|
end |