Added Example Matlab script with most common during beamtime processing
This commit is contained in:
1 parent
53dd8c6080
commit
bbfab45787
7 files changed
+658
-22
No files matched your search
@@ -0,0 +1,131 @@
|
||||
%% How do I ....
|
||||
clc;clear all;close all
|
||||
load FileList.mat
|
||||
|
||||
%% ... quick-and-dirty normalize
|
||||
%
|
||||
% Normalize counts per second to a reference intensity? You need to plot the
|
||||
% two spectra and use the cursor to read the intensities from the figures.
|
||||
% Then change the spectra intensities directly in the table as shown here:
|
||||
%
|
||||
% Do not save the FileList. This way you can reload it from the MAT file to
|
||||
% start fresh.
|
||||
close all;clc
|
||||
tmpDataSelection = matches(FileList.name,"0146146_Cl2p_850eV.ibw");
|
||||
FileList = nappGenerateSpectra(FileList,tmpDataSelection);
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','spectrum_countsPerSecond','mode','OneEach');
|
||||
xlim([647 652])
|
||||
FileList(tmpDataSelection,:).spectrum_countsPerSecond{:} = FileList(tmpDataSelection,:).spectrum_countsPerSecond{:} .* 22335./39687;
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','spectrum_countsPerSecond','mode','OneEach');
|
||||
xlim([647 652])
|
||||
ylabel("counts [norm to Al]")
|
||||
legend
|
||||
distFig
|
||||
|
||||
%% ... quick-and-dirty shift spectra
|
||||
%
|
||||
% If you do not want to generate the binding-energy scale using the
|
||||
% nappMATLAB function.
|
||||
close all;clc
|
||||
% Select your data based on the filename
|
||||
tmpDataSelection = startsWith(FileList.name, "0191191_O1s_VB_525eV");
|
||||
% List the selected files in the command window
|
||||
disp(FileList(tmpDataSelection,{'name','lastModifiedDatestr','scientaPassEnergy_eV'}))
|
||||
% Generate spectra
|
||||
FileList = nappGenerateSpectra(FileList,tmpDataSelection);
|
||||
% Plot in kinetic-energy mode
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','spectrum_countsPerSecond','mode','AllInOne','energyScale','kinetic');
|
||||
% Apply the shift to kinetic energy manually and plot
|
||||
FileList(tmpDataSelection,:).scientaEkin_eV{:} = FileList(tmpDataSelection,:).scientaEkin_eV{:}-20;
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','spectrum_countsPerSecond','mode','AllInOne','energyScale','kinetic');
|
||||
distFig
|
||||
|
||||
%% ... remove a sweep (sequence iteration) from data
|
||||
close all; clc
|
||||
% Remove sweep 3:
|
||||
tmpDataSelection = contains(FileList.name,'0146146_Al2p_850eV.ibw');
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image')
|
||||
FileList(tmpDataSelection,:).image{:}(:,3)=[];
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image')
|
||||
distFig
|
||||
|
||||
%% ... remove several sweeps
|
||||
close all; clc
|
||||
tmpDataSelection = contains(FileList.name,'0146146_Al2p_850eV.ibw');
|
||||
% Remove sweeps 5–9
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image')
|
||||
FileList(tmpDataSelection,:).image{:}(:,5:9)=[];
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image')
|
||||
distFig
|
||||
|
||||
%% ... correct beamline offset
|
||||
% This will correct 1.6 eV on the X-ray energies, which is particularly
|
||||
% important for NEXAFS data. One can also do this on selected data only.
|
||||
FileList.xRayEkin_eV = cellfun(@(x) x+1.6,FileList.xRayEkin_eV,'UniformOutput',false);
|
||||
|
||||
%% ... on-the-fly shift data in a figure
|
||||
tmpDataSelection = month(FileList.lastModifiedDatenum) == 11 ...
|
||||
& year(FileList.lastModifiedDatenum) == 2025 ...
|
||||
& ~contains(FileList.sample,"(bad data)") ...
|
||||
& contains(FileList.name,"O_Kedge_Resonant") ...
|
||||
& contains(FileList.name,"0025");
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image','mode','AugerMeitner','AugerMeitnerEnergies',[525,545,550]);
|
||||
hax = gca;
|
||||
hax.XDir = 'reverse';
|
||||
xlabel('Auger-Meitner binding energy [eV]');
|
||||
% Shift data (same works in Y direction)
|
||||
dataObjs = findobj(gcf,'-property','YData');
|
||||
dataObjs(1).XData = dataObjs(1).XData -10;
|
||||
dataObjs(2).XData = dataObjs(2).XData +10;
|
||||
dataObjs(3).XData = dataObjs(3).XData +20;
|
||||
|
||||
%% ... on-the-fly smooth data in a figure
|
||||
clc;close all
|
||||
tmpDataSelection = month(FileList.lastModifiedDatenum) == 11 ...
|
||||
& year(FileList.lastModifiedDatenum) == 2025 ...
|
||||
& ~contains(FileList.sample,"(bad data)") ...
|
||||
& contains(FileList.name,"O_Kedge_Resonant") ...
|
||||
& contains(FileList.name,"0025");
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image','mode','AugerMeitner','AugerMeitnerEnergies',[525,545,550]);
|
||||
hax = gca;
|
||||
hax.XDir = 'reverse';
|
||||
xlabel('Auger-Meitner binding energy [eV]');
|
||||
dataObjs = findobj(gcf,'-property','YData');
|
||||
y = dataObjs(1).YData;
|
||||
dataObjs(1).YData = smoothdata(y ,'sgolay',10);
|
||||
y = dataObjs(2).YData;
|
||||
dataObjs(2).YData = smoothdata(y ,'sgolay',10);
|
||||
y = dataObjs(3).YData;
|
||||
dataObjs(3).YData = smoothdata(y ,'sgolay',10);
|
||||
|
||||
%% ... on-the-fly remove data from a figure
|
||||
clc;close all
|
||||
tmpDataSelection = month(FileList.lastModifiedDatenum) == 11 ...
|
||||
& year(FileList.lastModifiedDatenum) == 2025 ...
|
||||
& ~contains(FileList.sample,"(bad data)") ...
|
||||
& contains(FileList.name,"O_Kedge_Resonant") ...
|
||||
& contains(FileList.name,"0025");
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image','mode','AugerMeitner','AugerMeitnerEnergies',[525,545,550]);
|
||||
hax = gca;
|
||||
hax.XDir = 'reverse';
|
||||
xlabel('Auger-Meitner binding energy [eV]');
|
||||
|
||||
dataObjs = findobj(gcf,'-property','YData');
|
||||
delete(dataObjs(1))
|
||||
legend('545','550');
|
||||
|
||||
%% ... on-the-fly change colors in a figure
|
||||
clc;close all
|
||||
tmpDataSelection = month(FileList.lastModifiedDatenum) == 11 ...
|
||||
& year(FileList.lastModifiedDatenum) == 2025 ...
|
||||
& ~contains(FileList.sample,"(bad data)") ...
|
||||
& contains(FileList.name,"O_Kedge_Resonant") ...
|
||||
& contains(FileList.name,"0025");
|
||||
nappPlot(FileList,tmpDataSelection,'tableVariable','image','mode','AugerMeitner','AugerMeitnerEnergies',[525,545,550]);
|
||||
hax = gca;
|
||||
hax.XDir = 'reverse';
|
||||
xlabel('Auger-Meitner binding energy [eV]');
|
||||
|
||||
dataObjs = findobj(gcf,'-property','YData');
|
||||
dataObjs(2).Color = [184 184 185]/255;
|
||||
dataObjs(3).Color = [58 162 190]/255;
|
||||
Reference in new issue
Block a user