Skip to content

Commit

Permalink
Minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
c0deta1ker committed Jun 17, 2022
1 parent 9b0bd9a commit 235335c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

%% - 2 - Executing binding energy alignment over all scans
% - Checking the align type is valid
if strcmpi(alignType,"global")...
if strcmpi(alignType,"global") || strcmpi(alignType,"global shift via scan") || strcmpi(alignType,"scans")...
|| strcmpi(alignType,"align2ref") || strcmpi(alignType,"align2ref-perchannel")...
|| strcmpi(alignType,"fit2ef") || strcmpi(alignType,"fit2ef-5%") || strcmpi(alignType,"fit2ef-10%") || strcmpi(alignType,"fit2ef-25%")...
|| strcmpi(alignType,"fit2ef-50%") || strcmpi(alignType,"fit2ef-75%") || strcmpi(alignType,"fit2ef-95%")...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

%% - 2 - DEFINING THE XPS DATA AND FITTING ARGUMENTS
% -- Extracting the data to be fitted
[roi_xdat, roi_ydat, roi_bgrnd] = PESBackground(pesStr.xdat, pesStr.ydat, bTYPE, x0(end-2), x0(end-1), x0(end));
[roi_xdat, roi_ydat, roi_bgrnd] = PESBackground(pesStr.xdat, pesStr.ydat, bTYPE, x0(end-2), x0(end-1), x0(end), ibgrnd{4});
% -- Defining a structure that stores all relevant model and data variables
XPSObj = pesStr;
XPSObj.roi_xdat = roi_xdat;
Expand Down Expand Up @@ -305,14 +305,14 @@

%% DEFINING THE FUNCTION THAT EXTRACTS THE XPS DATA TO BE FITTED
function [X, D] = fit_data(x, XPSObj)
[X, D, ~] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end));
[X, D, ~] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end), XPSObj.fit_args.ibgrnd{4});
D(isnan(D)) = 0;
if size(D, 2) > 1; D = D'; end
end

%% DEFINING THE FUNCTION THAT DETERMINES THE TOTAL PES BACKGROUND
function B = fit_background(x, XPSObj)
[~, ~, B] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end));
[~, ~, B] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end), XPSObj.fit_args.ibgrnd{4});
B(isnan(B)) = 0;
if size(B, 2) > 1; B = B'; end
end
Expand Down Expand Up @@ -370,7 +370,7 @@
end
M = pes_int;
% - 4 - Determine the background to be used
[B_xdat, ~, B] = PESBackground(xdat, XPSObj.roi_ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end));
[B_xdat, ~, B] = PESBackground(xdat, XPSObj.roi_ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end), XPSObj.fit_args.ibgrnd{4});
B = interp1(B_xdat, B, xdat);
% - 5 - Final output is the sum of the model and background
MB = M + B;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

%% - 2 - DEFINING THE XPS DATA AND FITTING ARGUMENTS
% -- Extracting the data to be fitted
[roi_xdat, roi_ydat, roi_bgrnd] = PESBackground(pesStr.xdat, pesStr.ydat, bTYPE, x0(end-2), x0(end-1), x0(end));
[roi_xdat, roi_ydat, roi_bgrnd] = PESBackground(pesStr.xdat, pesStr.ydat, bTYPE, x0(end-2), x0(end-1), x0(end), ibgrnd{4});
% -- Defining a structure that stores all relevant model and data variables
XPSObj = pesStr;
XPSObj.roi_xdat = roi_xdat;
Expand Down Expand Up @@ -291,14 +291,14 @@

%% DEFINING THE FUNCTION THAT EXTRACTS THE XPS DATA TO BE FITTED
function [X, D] = fit_data(x, XPSObj)
[X, D, ~] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end));
[X, D, ~] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end), XPSObj.fit_args.ibgrnd{4});
D(isnan(D)) = 0;
if size(D, 2) > 1; D = D'; end
end

%% DEFINING THE FUNCTION THAT DETERMINES THE TOTAL PES BACKGROUND
function B = fit_background(x, XPSObj)
[~, ~, B] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end));
[~, ~, B] = PESBackground(XPSObj.xdat, XPSObj.ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end), XPSObj.fit_args.ibgrnd{4});
B(isnan(B)) = 0;
if size(B, 2) > 1; B = B'; end
end
Expand Down Expand Up @@ -346,7 +346,7 @@
end
M = pes_int;
% - 3 - Determine the background to be used
[B_xdat, ~, B] = PESBackground(xdat, XPSObj.roi_ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end));
[B_xdat, ~, B] = PESBackground(xdat, XPSObj.roi_ydat, XPSObj.fit_args.bTYPE, x(end-2), x(end-1), x(end), XPSObj.fit_args.ibgrnd{4});
B = interp1(B_xdat, B, xdat);
% - 4 - Final output is the sum of the model and background
MB = M + B;
Expand Down

0 comments on commit 235335c

Please sign in to comment.