MAJOR UPDATE: Add support for Specs .xy files from offline XPS (Soleil/Luca)

Both Scienta (.ibw) and SpecsLab (.xy) raw files capture multidimensional XPS data but use different terminology to structure it. Scienta uses "Region Iterations" and "Sequence Iterations". SpecsLab organizes data by "Groups" or "Regions" (different elemental energy sweeps), "Scans" (time-resolved repetitions), and "Curves". Scienta Region Iterations are automatically averaged to improve the signal-to-noise ratio, while Scienta Sequence Iterations and SpecsLab Scans are  preserved to keep the time-resolved data. For SpecsLab files specifically, distinct Regions are split into separate table rows. Ultimately, the preserved time-resolved data is saved in the table's image variable as a 2D matrix ([Energy bins × Sequence iterations/Scans]).

File type handling: Added .xy as a recognized XPS format. Currently, the script differentiates data types strictly by file extension (NEXAFS: .h5, XPS: .ibw and .xy). This extension-based differentiation needs to be improved in future updates.

Metadata parsing: Implemented global header scanning for .xy files to correctly extract instrument parameters (Acquisition Mode, Lens Mode, Slit, Workfunction) located before the first region block.

Timezone alignment: Added timestamp conversion for .xy files from UTC to local time (Europe/Zurich) to ensure synchronization with LabView logs.

Region separation: Modified .xy parsing to append a _RegX suffix to filenames. This correctly splits single .xy files that contain multiple elements or energy sweeps into distinct table rows so they can be processed individually.

Import efficiency: Added an originalFileName variable. The script now cross-references the input DataTable and skips files that have already been imported to reduce execution time on re-runs.

Testing status: Processing of .xy data has currently only been tested and debugged with nappGenerateSpectra and nappPlot. Compatibility with other functions in the suite remains untested.
This commit is contained in:
bartels-rausch committed 2026-03-12 10:08:47 +01:00
1 parent a4ba161146
commit 00d34110db
4 files changed
+553 -541

No files matched your search

+539 -529
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -109,7 +109,7 @@ defaultMode = 'mean';
expectedMode = {'mean','sum','trapz','AugerMeitnerMean'};
defaultEkinStart = 0;
defaultEkinEnd = 0;
defaultTableSelection = true(size(DataTable,1));
defaultTableSelection = true(size(DataTable,1),1);
% Parse input
p = inputParser;
@@ -182,7 +182,7 @@ for ii = 1:size(p.Results.DataTable(p.Results.tableSelection,:),1)
% log
tmp_4(ii,1) = p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii}(tmp_1);
tmp_5(ii,1) = p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii}(tmp_2);
elseif endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') % then do Igorfiles
elseif endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy') % then do Igorfiles or xy files
if p.Results.iterationRange(1) == 0
startRange = 1;
endRange = size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},2);
+11 -9
View File
@@ -428,7 +428,7 @@ if matches(p.Results.tableVariable,'image') && ~matches(p.Results.mode,'AugerMei
'XColor' , [0 0 0], ...
'YColor' , [0 0 0], ...
'LineWidth' , alw );
elseif endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw')
elseif endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')
if contains(p.Results.energyScale,'kinetic')
hdl = figure('Name',p.Results.DataTable(p.Results.tableSelection,:).name{ii},'units', unt,'Position',pos);
@@ -441,7 +441,9 @@ if matches(p.Results.tableVariable,'image') && ~matches(p.Results.mode,'AugerMei
'Parent',gca,'CDataMapping','scaled');
axis(gca,'ij');
set(gca,'Layer','top');
ylim([1 size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},2)]);
if size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},2) >= 2
ylim([1 size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},2)]);
end
xlim([p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii}(1) p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii}(end)]);
hXLabel = xlabel('Electron energy [eV]');
hYLabel = ylabel('Sequence iteration');
@@ -536,7 +538,7 @@ if matches(p.Results.tableVariable,'imageRoh')
'XColor' , [0 0 0], ...
'YColor' , [0 0 0], ...
'LineWidth' , alw );
elseif endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw')
elseif endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')
if contains(p.Results.energyScale,'kinetic')
hdl = figure('Name',p.Results.DataTable(p.Results.tableSelection,:).name{ii},'units', unt,'Position',pos);
@@ -620,21 +622,21 @@ if contains(p.Results.tableVariable,'spectrum')
% Create axes
hold(gca,'on');
if (contains(p.Results.energyScale,'kinetic') & (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') | endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')))
if (contains(p.Results.energyScale,'kinetic') && (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')))
hplot = plot(p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii},...
p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii}');
hplot.LineWidth = lw;
hXLabel = xlabel('Electron kinetic energy [eV]');
xlim([p.Results.DataTable(p.Results.tableSelection,:).scientaEkinRange_eV(ii,1) p.Results.DataTable(p.Results.tableSelection,:).scientaEkinRange_eV(ii,2)]);
elseif (contains(p.Results.energyScale,'binding') & (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw')| endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')))
elseif (contains(p.Results.energyScale,'binding') && (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw')|| endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')))
hplot = plot(p.Results.DataTable(p.Results.tableSelection,:).bindingEnergy_eV{ii},...
p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii}');
hplot.LineWidth = lw;
hXLabel= xlabel('Binding energy [eV]');
xlim([min(p.Results.DataTable(p.Results.tableSelection,:).bindingEnergy_eV{ii}) max(p.Results.DataTable(p.Results.tableSelection,:).bindingEnergy_eV{ii})]);
elseif (contains(p.Results.energyScale,'xRay') | endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'h5'))
elseif (contains(p.Results.energyScale,'xRay') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'h5'))
hplot = plot(p.Results.DataTable(p.Results.tableSelection,:).xRayEkin_eV{ii},...
p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii});
hplot.LineWidth = lw;
@@ -699,7 +701,7 @@ if contains(p.Results.tableVariable,'spectrum')
% axes('Parent',gcf,'XDir','reverse')
hold(gca,'on');
for ii = 1:size(p.Results.DataTable(p.Results.tableSelection,:),1)
if (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') | endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy'))
if (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy'))
hplot = plot(p.Results.DataTable(p.Results.tableSelection,:).scientaEkin_eV{ii},...
p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii}','DisplayName',p.Results.DataTable(p.Results.tableSelection,:).name{ii},'Color',tmp_color(ii,:));
hplot.LineWidth = lw;
@@ -711,7 +713,7 @@ if contains(p.Results.tableVariable,'spectrum')
hold(gca,'on');
for ii = 1:size(p.Results.DataTable(p.Results.tableSelection,:),1)
if (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') | endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy'))
if (endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy'))
hplot = plot(p.Results.DataTable(p.Results.tableSelection,:).bindingEnergy_eV{ii},...
p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii}','DisplayName',p.Results.DataTable(p.Results.tableSelection,:).name{ii},'Color',tmp_color(ii,:));
hplot.LineWidth = lw;
@@ -776,7 +778,7 @@ if contains(p.Results.mode,'iterations')
% generate colormap
for ii = 1:size(p.Results.DataTable(p.Results.tableSelection,:),1)
if endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw')
if endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')
hdl = figure('Name',p.Results.DataTable(p.Results.tableSelection,:).name{ii},'units', unt,'Position',pos);
if size(p.Results.DataTable(p.Results.tableSelection,:).(p.Results.tableVariable){ii},2) >= 7
+1 -1
View File
@@ -200,7 +200,7 @@ end
% repeat this for all columns in input.
for ii = 1:size(p.Results.DataTable(p.Results.tableSelection,:),1)
if endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw')
if endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'ibw') || endsWith(p.Results.DataTable(p.Results.tableSelection,:).name{ii},'xy')
% get name and date of input file and replace old region with new
% region. This will be the files where the peak area is taken from.
tmpName = replace(p.Results.DataTable(p.Results.tableSelection,:).name{ii}, ...