Small changes

This commit is contained in:
bartels-rausch committed 2025-07-07 08:53:30 +02:00
1 parent 4f21681cf6
commit 74292eebd3
2 files changed
+25 -27

No files matched your search

+2
View File
@@ -339,6 +339,8 @@ else
DataTable.peakPosition(p.Results.tableSelection,:) = tmpFitResults(p.Results.tableSelection,:).peakPosition;
DataTable.peakArea(p.Results.tableSelection,:) = tmpFitResults(p.Results.tableSelection,:).peakArea;
DataTable.peakFWHM(p.Results.tableSelection,:) = tmpFitResults(p.Results.tableSelection,:).peakFWHM;
% added 6.2025 tbr
DataTable.peakBackground(p.Results.tableSelection,:) = tmpFitResults(p.Results.tableSelection,:).peakBackground;
%%
+23 -27
View File
@@ -1,15 +1,18 @@
function DataTable = nappFitGaussXps(DataTable,varargin)
%nappFitGaussXps fits PE spectra with up to 4 or 5 Gauss peaks. Different sets
%of constrains can be used.
% nappFitGaussXps fits photoelectron (PE) spectra with up to 4 or 5 Gaussian peaks.
% It allows different sets of constraints for the fitting process.
%
% INPUT:
% DataTable: Table containing the spectral data to be fitted.
% varargin: Additional optional parameters for customizing the fit.
%
% OUTPUT:
% DataTable: The input table, now including the results of the peak fitting.
%
% FileList =
% nappFitGaussXps(FileList,tmpFitParameters,'tableSelection',tmpDataSelection);
%
% *input*
% FileList: data table tmpFitParameters: You can give settings for the 4
% peaks (5 in some cases), use small (negligible) values if you are
% interested in less than 4 peaks.
%
%%
% % „position“ mode
% tmpFitParameters.peakArea = [abs#1 abs#2 abs#3 abs#4];
% tmpFitParameters.peakWidth = [abs#1 abs#2 abs#3 abs#4];
@@ -109,13 +112,6 @@ function DataTable = nappFitGaussXps(DataTable,varargin)
% energyScale: kinetic (default) or binding
% showFigures: on(default) or off: display Gauss fits in figure.
%
%
% *output*
% table variables peakPosition, peakFWHM, and peakArea with fit
% results for peaks 1-4(5)
% fit results are printed in command window and graph with fits is
% shown.
%
@@ -176,7 +172,7 @@ PsiFarbe.mittelblau = [50 118 158]/255;
%
% Gauss = area/(width*sqrt(pi/2)) * exp(-2*(x-position)^2/width^2)
%
% where FWHM = width * sqrt(ln(4))
% where FWHM = width * sqrt(2*ln(2))
% fitting equation
@@ -330,7 +326,7 @@ elseif matches(p.Results.mode,'gasAndTwoAcidBasePairs') % Novum, also the distan
tmpB(1)/(tmpB(2)*sqrt(pi/2))*exp(-2.*((x(:,1) - (tmpB(3)+tmpB(14))).^2/tmpB(2).^2)) ... % Gauss peak 1: width and position
+ tmpB(4)/(tmpB(2)*sqrt(pi/2))*exp(-2.*((x(:,1) - tmpB(3)).^2/tmpB(2).^2))... % Gauss peak 2: width and position
+ tmpB(5)/(tmpB(6)*sqrt(pi/2))*exp(-2.*((x(:,1) - tmpB(7)).^2/tmpB(6).^2))... % Gauss peak 3: unconstrained
+ tmpB(8)/(tmpB(2)*sqrt(pi/2))*exp(-2.*((x(:,1) - (tmpB(11)+tmpB(9))).^2/tmpB(2).^2))... % Gauss peak 4: width and position
+ tmpB(8)/(tmpB(2)*sqrt(pi/2))*exp(-2.*((x(:,1) - (tmpB(11)+tmpB(9))).^2/tmpB(2).^2))... % Gauss peak 4: width and position
+ tmpB(10)/(tmpB(2)*sqrt(pi/2))*exp(-2.*((x(:,1)- tmpB(11)).^2/tmpB(2).^2))... % Gauss peak 5: width and position
+ tmpB(12).*x(:,1)+tmpB(13); % linear background
@@ -533,46 +529,46 @@ for ii = 1:size(DataTable(p.Results.tableSelection,:),1)
disp(' ' );
if (B(1) <= 1 || B(4) <= 1)
disp(cell2table({sprintf('%.1f',B(3)),...
sprintf('%.1f',B(2)*sqrt(log(4))),...
sprintf('%.1f',B(2)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(2)),...
sprintf('%.3f',B(1));...
sprintf('%.1f',B(6)),...
sprintf('%.1f',B(5)*sqrt(log(4))),...
sprintf('%.1f',B(5)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(5)),...
sprintf('%.3f',B(4));...
sprintf('%.1f',B(9)),...
sprintf('%.1f',B(8)*sqrt(log(4))),...
sprintf('%.1f',B(8)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(8)),...
sprintf('%.3f',B(7));...
sprintf('%.1f',B(12)),...
sprintf('%.1f',B(11)*sqrt(log(4))),...
sprintf('%.1f',B(11)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(11)),...
sprintf('%.3f',B(10)); ...
sprintf('%.1f',B(17)),...
sprintf('%.1f',B(16)*sqrt(log(4))),...
sprintf('%.1f',B(16)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(16)),...
sprintf('%.3f',B(15))},...
'VariableNames',{'position';'FWHW';'width';'area'},...
'RowNames',{'peak1','peak2','peak3','peak4','peak5'})); % 'RowNames',{'peak1','peak2','peak3','peak4','peak5'}));
else
disp(cell2table({sprintf('%.1f',B(3)),...
sprintf('%.1f',B(2)*sqrt(log(4))),...
sprintf('%.1f',B(2)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(2)),...
sprintf('%7.0f',B(1));...
sprintf('%.1f',B(6)),...
sprintf('%.1f',B(5)*sqrt(log(4))),...
sprintf('%.1f',B(5)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(5)),...
sprintf('%7.0f',B(4));...
sprintf('%.1f',B(9)),...
sprintf('%.1f',B(8)*sqrt(log(4))),...
sprintf('%.1f',B(8)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(8)),...
sprintf('%7.0f',B(7));...
sprintf('%.1f',B(12)),...
sprintf('%.1f',B(11)*sqrt(log(4))),...
sprintf('%.1f',B(11)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(11)),...
sprintf('%7.0f',B(10)); ...
sprintf('%.1f',B(17)),...
sprintf('%.1f',B(16)*sqrt(log(4))),...
sprintf('%.1f',B(16)*sqrt( 2 * log(2))),...
sprintf('%.1f',B(16)),...
sprintf('%7.0f',B(15))},...
'VariableNames',{'position';'FWHW';'width';'area'},...
@@ -643,7 +639,7 @@ for ii = 1:size(DataTable(p.Results.tableSelection,:),1)
end
% Write results to List, we need all fitting results
resultsPeakPos(ii,:) = [B(3), B(6), B(9), B(12), B(16)] ; %#ok<*AGROW>
resultsPeakFWHW(ii,:) = [B(2).*sqrt(log(4)), B(5).*sqrt(log(4)), B(8).*sqrt(log(4)), B(11).*sqrt(log(4)), B(17).*sqrt(log(4))] ;
resultsPeakFWHW(ii,:) = [B(2).*sqrt( 2 * log(2)), B(5).*sqrt( 2 * log(2)), B(8).*sqrt( 2 * log(2)), B(11).*sqrt( 2 * log(2)), B(17).*sqrt( 2 * log(2))] ;
resultsPeakArea(ii,:) = [B(1), B(4), B(7), B(10) B(15)] ;
resultsBkgrd(ii,:) = [B(13), B(14)] ;
% close the fiting progess window