From d7bc516442cdecc5386c29364e01917448974b1c Mon Sep 17 00:00:00 2001 From: ThorBarRa Date: Thu, 12 Mar 2026 10:26:31 +0100 Subject: [PATCH] Bug fix. The excitation energy for our offline XPS is wrong in the xy files. Set it to 1253.6 eV during import --- beamtime/nappFileList.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/beamtime/nappFileList.m b/beamtime/nappFileList.m index 929764a..da85f03 100755 --- a/beamtime/nappFileList.m +++ b/beamtime/nappFileList.m @@ -649,6 +649,19 @@ if ~isempty(TmpFileList{1}) globalWorkFunction = sscanf(strtrim(extractAfter(lineStr, '# Eff. Workfunction:')), '%f'); elseif startsWith(lineStr, '# Excitation Energy:') globalExEnergy = sscanf(strtrim(extractAfter(lineStr, '# Excitation Energy:')), '%f'); + % ========================================================================= + % OFFLINE XPS BUG FIX (Mg vs Al Source) + % If the file lacks "Monochromator" in the header and the energy is + % incorrectly tagged as ~1453.6 or 1486.6, overwrite it to 1253.6 (Mg Ka). + % ========================================================================= + if ~contains(headerText, 'Monochromator', 'IgnoreCase', true) + % Checking both 1453.6 (as requested) and 1486.61 (as seen in your file) + if (abs(globalExEnergy - 1453.6) < 1) || (abs(globalExEnergy - 1486.61) < 1) + globalExEnergy = 1253.6; + end + end + % ========================================================================= + end end end