This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

SpectroLab: An Open Source Matlab Based Toolbox for High Throughput Spectroscopy Analysis

Christopher Sims School of Electrical and Computer Engineering, Purdue University, West Lafayette, Indiana 47907, USA
(June 25, 2025)
Abstract

We present an open source software package SpectroLab a Matlab based tool developed in 2018 for the analysis of spectroscopic data. In this package there are tools for derivative analysis, stacked energy contours , stacked plots for theory, 3D volumetric plots, and core level analysis, and derivative analysis. The package can currently be used for angle-resolved photoemission spectroscopy (ARPES) data, with the ability to also be used for other spectroscopic data in the future. We apply this program to the HfP2, ZrSiS, and Hf2Te2P systems to demonstrate its robustness.

I Introduction

In recent years, spectroscopic techniques such as angle resolved photoemission spectroscopy (ARPES)[1, 2], scanning tunneling microscopy (STM) [3, 4, 5], neutron scattering [6, 7, 8], etc. have improved to the point where the scientific communities use these tools extensively. These techniques reveal features in momentum and energy space that can give deeper understanding of the interactions of exotic quasi-particles that have taken interest in recent years such as topological insulators[9, 10], Weyl semimetals[11, 12, 13], nodal-line semimetals[14, 15, 16], and High order Topological insulators (HOTI)[17, 18]. Furthermore, these techniques have been expanded to measure other dimensions such as spin, time, magnetism, etc. These techniques are always prone to noise which will decrease the ability to interpret the data correctly. Previously, researchers have employed proprietary programs in order to conduct the data analysis. These programs limit the ability for users to tune the way results are presented and create figures and graphs with a high degree of control. Here, we report a Matlab based program that is written in an easy to read way that allows for the analysis of ARPES data. Using Matlab’s built in tools, we have design a program that gives users a high control in the way they present their data.

The data analysis of these materials is critical in order to understand complex interactions that are difficult to resolve by eye. By importing the data into Matlab, we provide a way for researchers to use the vast packages included in this program that are nontrivial to code in proprietary data analysis programs such as edge detection or neural networks. We present a suite of functions that allow for easy analysis and presentation of spectroscopic data in the Matlab suite called spectrolab. The suite needs minimal programming experience since all of the tools included can be done in one click. As oppose to other data analysis techniques, our package is all inclusive and can be used with minimal need to modify the code in anyway. The only need for the program to work is an .ibw file that is formatted correctly. We present ARPES data in from the HfP2 [19], ZrSiS [20, 21], and Hf2Te2P [22] systems in order to show that this program is applicable to different types of ARPES data. This paper includes a detailed description of the theory behind how the main functions work in section 2. In section 3, we outline the functionalities of each of the functions in the initial release. In section 4, we go over how to install and use SpectroLab. Finally in section 5, we go over a few examples of using the software package in real systems.

II Methods

As the data is imported into SpectroLab it is automatically interpreted into kk-space from the raw data using the following equations[23]:

kx=12mEkinsinϑcosφk_{x}=\frac{1}{\hbar}\sqrt{2mE_{kin}}sin\vartheta cos\varphi (1)
ky=12mEkinsinϑsinφk_{y}=\frac{1}{\hbar}\sqrt{2mE_{kin}}sin\vartheta sin\varphi (2)

In the program these are interpreted by the following approximation

kx=0.5112(E4.5)(πX0.046/180)k_{x}=0.5112*\sqrt{(E-4.5)}*(\pi*X*0.046/180) (3)
ky=0.5112(E4.5)(πZ/180)k_{y}=0.5112*\sqrt{(E-4.5)}*(\pi*Z/180) (4)

In addition to this all supporting variables are automatically calculated within the setvariables() function.

KY_Angle_Max = 0.5112*sqrt(E -4.5)*(pi*Zmax/180);
KY_Angle_Min = 0.5112*sqrt(E -4.5)*(pi*Zmin/180);
KX_Angle_Max = 0.5112*sqrt(E-4.5)*(pi*Xmax*0.046/180) -1.68;
KX_Angle_Min = 0.5112*sqrt(E-4.5)*(pi*Xmin*0.046/180) - 1.68;

II.1 Sobel filter (2nd Derivative)

The common edge detection algorithms are the Sobel, Canny, Prewitt, Roberts, and fuzzy logic methods[24, 25, 26, 27, 28, 29, 30, 31, 32, 33]. In this paper, we use a modified version of the Sobel filter in order to conduct second derivative calculations. While it is possible to use a convolution neural network (CNN) for feature extraction[34, 35], these networks require a large amount of computational resources and are only applicable to the data set they are trained on. Generative adversarial neural networks (GANs)[36] are a much better alternative to create a neural network feature extraction since it can work on an infinite amount of data sets once it is properly trained. The downside is that a large amount of data sets (>>1000) are required in order to properly train the neural network. Therefore, we forgo the inclusion of a neural network in our program. The Sobel filter is a 3×\times3 matrix that calculates the second derivative locally in an image file (where A is the image). There are two versions, the horizontal and the vertical which can be used, in the distributed program. The horizontal FxF_{x} is convoluted with the image to form the second derivative of the image.

Fx=[10+120+2101]A,Fy=[121000+1+2+1]AF_{x}=\begin{bmatrix}-1&0&+1\\ -2&0&+2\\ -1&0&-1\end{bmatrix}*A,F_{y}=\begin{bmatrix}-1&-2&-1\\ 0&0&0\\ +1&+2&+1\end{bmatrix}*A (5)

In order to detect edges after the Sobel filter is applied, one would find the square of the absolute value of the resultant |Fx|2|F_{x}|^{2}. By not conducting this last step we can resolve weak signals of ARPES. In the case of sharp data, the edge detection feature can be turned on with an additional line of code which we have included. All edge detection algorithms can be accesses via Matlab’s image toolbox.

Data2D = squeeze(Mapping(:,EnergyLevel,:))’;
h_Sobel = fspecial(’sobel’);
f_y = imfilter(double(Data2D), h_Sobel,’replicate’);
imagesc(f_y)

II.2 Constant Energy Contours

An energy contour is a slice of a 3D band mapping in ARPES (kxk_{x},energy,kxk_{x}) where at a constant energy, the 2D kxk_{x},kyk_{y} surface is revealed. For constant energy contours we create a function that automatically interprets the energy levels and recreates them in an energy contour. For labeling we included a rounding function that rounds to the nearest significant figure. However, the program can interpret the exact value for publication.

Energy_Limit = 200; %specified by user
Energy_Cut = 1:int16(Energy_Limit/6):Energy_Limit;
Energy_Contour = ypos - Energy_Cut % check limits;
hold on
subaxis(2,6,1,’sv’,vertical_space,’sh’,0.01);
f = squeeze(B(:,ypos,:))’;
imshow(imrotate(f,0),[], ’XData’, [KX_Angle_Min+ + offsetx KX_Angle_Max+ offsetx]...
, ’YData’, [KY_Angle_Min + offsety KY_Angle_Max + offsety], ’colormap’, setmap);
for ii = 2:6
subaxis(2,6,ii,’sv’,0.01,’sh’,0.01);
f = squeeze(B(:,Energy_Contour(ii),:))’;
imshow(imrotate(flipud(f),0),[], ’XData’, [KX_Angle_Min KX_Angle_Max]...
, ’YData’, [KY_Angle_Min KY_Angle_Max], ’colormap’, ’gray’ );
end

II.3 Volumetric plot

The volumetric plot function takes advantage of how data is formatted for ARPES. Typically data is encoded in an (X,Y,Z,C) format. Where X,Y,and Z are kxk_{x}, kyk_{y}, and energy, while C is the interpretation of the intensity at that location. By using an alpha map, we can make weak signals transparent and reveal the 3D band structure for visualization. This has the ability to be a very powerful tool for investigating anisotropy in bands.

%VolumetricPlot()
% edit this to get a good mapping
alphamap([0 linspace(0.0005, 0.4, 255)]);

II.4 Momentum cuts

We have included several methods to aid the taking kxk_{x} and kyk_{y} momentum cuts from a 3D band mapping. We take these cuts by selecting a value of kxk_{x} and kyk_{y} and resolving the cut in a 2D image.

f = squeeze(B(Kxlocation,:,:));
f = imresize(f,5);
imshow(f’,[], ’XData’, ...
[KX_Angle_Min KX_Angle_Max], ’YData’,...
[abs(Ymin) - Fermi_Level, abs(Ymax)- Fermi_Level], ’colormap’, setmap);

II.5 Energy & momentum distribution curves

Energy & momentum distribution curves (EDC & MDC) are used for the data analysis of spectroscopic data. In a set amount of intervals a line of data is taken out of the image and then plotted in order to enable researchers to resolve difficult to resolve images from ARPES or other spectroscopic data. We use the waterfall() function in order to reconstruct the EDC and MDC plots seen in literature [22]. The plot also have the benefit of being three dimensional with the ability to add a color map to further define intensity differences.

II.6 Stacked theory

In order to import theory, we create a 2D surface in a 3D box using Matlab’s meshgrid() function to import an image of the theoretical plot. To insure that the images that we import are of the same size we use the largest image dimensions as the map for all of the subsequent images. We do this because the 3D plot will not work unless we use the same size map. We then offset the images by one for each image. Now, one can scale the distance between image layers using the daspect() function of Matlab to scale the Z (Energy) in order to resolve the layers.

%# plot each slice as a texture-mapped surface (stacked along the Z-dimension)
for k=1:size(im)
surface(’XData’,X-0.5, ’YData’,Y, ’ZData’, Z.*-k, ...
’CData’,im{k}, ’CDataMapping’,’direct’, ...
’EdgeColor’,’none’, ’FaceColor’,’texturemap’)
end

III Analysis tools of SpectroLab

Here we included an overview of the uses of SpectroLab. The fermi level can be found with the fermisurface() [Fig. 2(a)] and the ypos variable

Table 1: Main tools of SpectroLab
Program Description
Kx Cuts Creates kxk_{x} momentum slices
Ky Cuts Creates kyk_{y} momentum slices
Plot_KX_KY For quick check of data analysis
Fermi Surface Draws Fermi surface from 3D map
Momentum 2D 2D ARPES cuts
Stacked plot Slices and stacks 3D momentum cuts
Stacked theory Stack theory similar to stacked plot
Density Curves EDC and MDC
Energy Contour plot ECP in exact steps
Volumetric plot 3D volumetric plot
Dispersion photon energy dependence
Inner core Analysis of inner core spectra

III.1 Graphical User Interface (GUI)

We include a graphical user interface (GUI) [Fig. 1] that can be used as a general tool, more advance data selection and analysis will need to be done in code.

III.2 Constant Energy Contours

We include a function to extract constant energy contours (ECs) from a 3D band mapping. StackedECP() [Fig. 2(c,d) is a feature that calculates ECs and stacks them on top of each other in order to visualize the bands dispersing in 3D space. The energy contour functions do the same, however the ECs are presented in a 2D format.

III.3 Volumetric plot

In the volumetric plot function, a 3D band mapping is interpreted with an alpha map (transparency map). This allows for all bands to be mapped in a 3D space. In addition, users can rotate and zoom in to further examine the electronic structure.

III.4 Momentum cuts

We have included several methods to aid the taking kxk_{x} and kyk_{y} momentum cuts from a 3D band mapping. Plot_KX_KY, Ky cuts (Fig. 3(a)), and Kx cuts (Fig. 3(b)) are all features that allow for one to construct these plots. Plot_KX_KY is a debug tool but can still be used to accomplish this feature.

III.5 Energy & momentum distribution curves

Energy distribution curves (EDCs) and momentum distribution curves (MDCs) are important tools for the analysis of ARPES data. Here, we construct programs that can create 3D EDC [Fig. 4(a)] and MDC [Fig. 4(b)] plots similar to those found in previous literature. The advantage of these types of plots is that they are able to give a 3D interpretation of the EDC and MDC which will allow for better understanding of the intensity at certain points (such as discerning if there is a band gap or weak feature in the band gap).

III.6 Photon energy dependence

Dispersion allows for one to interpret photon energy dependent cuts (not a mapping of photon energy) to include for interpretation or publication. The Dispersion map function can interpret an arbitrary amount of cuts specified by the user. [Fig. 5]

III.7 Stacked theory

Stacked theory is a function that allows one to import theoretical DFT energy contours and plot them in a way to compare to the stackedECP() function [Fig. 2(b)]. There is also a feature that allows for plotting theory in one of the energy contour functions.

IV Installation and usage

In this section, we present how to install and use SpectroLab.

IV.1 Get SpectroLab

SpectroLab is an open source software package distributed under the MIT License. The code can be downloaded directly from the public code repository: github.com/christophersims/SpectroLab.

IV.2 Installation and running the code

The code requires no installation, however, the folders that contain the code must be added to the path in order for them to run correctly (or the user could place all of the .m files in one directory). The user must have a Matlab version year of at least 2018 with the image toolbox add-on installed.

The code can be run by simply specifying the file path of the data one wishes to analyze. If there are no formatting errors the code should run without errors.

IV.3 File formats

For ARPES there are three major file formats used (from the Igor suite), .txt, .ibw, and .pxt. Important data is lost in the .txt format and the .pxt format is compressed and cannot be decompressed outside of the Igor program. Therefore, this program only uses the Igor Binary Wave format (.ibw). In addition, the program only accepts files in the format (kxk_{x},Energy,kyk_{y}), however, the file can be reformatted within the program.

V Examples

V.1 Incorrectly formatted input

If the input of the code in not formatted correctly (in the (kxk_{x},Energy,kyk_{y}) format) it is possible to still run the code by utilizing Matlab’s permute() function. This function allows for one to swap the matrices in order for the program to run correctly. In addition to using the permute the variables in variables() must also be changed in order to match the code. In figure , we present data that was formatted incorrectly but was able to run in the program and produce good results. Here we present the data of Hf2Te2P (Fig. 6) and ZrSiS (Fig. 7) which were imported using the permute function.

V.2 Plotting theory

Our implementation of plotting theory is currently an image importer, however, we have the code that allows for the input if the surface states and Fermi surface generated with the iterative surface green functions[37] imported from Wanniertools[38]. The calculations are not included in this package and must be calculated with tools such as Quantum Espresso[39], VASP[40], Abinit[41], Wannier90[42], etc. In figure 2(b), we show the capability so show stacked theory plots in order to coincide with the stackedECP() function. In addition, we have included a ECP function that also allows for the inclusion of theoretical calculation figures (see supplementary).

V.3 Volumetric plot

Here we present a volumetric plot of both a 3D band mapping correctly formatted Fig. 8(a) and an incorrectly formatted (corrected in code) in Fig. 8(b). This method is a powerful tool that will enable researchers to visualize bands in a 3D space.

VI Conclusion

In conclusion, we have designed a Matlab based program that can be used to interpret spectroscopic data. Included in this tool are multiple functions which can be used for the analysis of ARPES data. To demonstrate the robustness of this package we show ARPES analysis of several data sets. This package can be used as a standalone with no other dependency on other programs. The features of this analysis suite is extensive with the addition of new analysis techniques such as the 3D volumetric plot. In the future, we aim to integrate the analysis of XRD and STM data into the SpectroLab suite.

Supplemetary Material

See Supplementary material for further figures of spectrolab’s output in the HfP2, Hf2Te2P, and ZrSiS systems.

Acknowledgments

The authors would like to thank the Matlab community which provided several methods and programs used in SpectroLab.

C.S. acknowledges the generous support of the Purdue ECE ASIRE fellowship and the National GEM consortium fellowship

Correspondence and requests for additional functionality should be addressed to C.S.
(Email: Sims58@purdue.edu).

References

Refer to caption
Figure 1: Graphical User interface (a) The main page the GUI figure with the main release of SpectroLab.
Refer to caption
Figure 2: Example of functions (a) Result of the fermisurface() function. (b) Result of the stacked_theory() program. (c) Output of the stackedECP() function in the Hfp2 system. (d) Output of the stackedECP() function in another dataset in the HfP2 system.
Refer to caption
Figure 3: kxk_{x} and kyk_{y} momentum cuts (a) Fermi surface (rightmost panel) and kxk_{x} momentum cuts (cut1-cut5) taken from a 3D mapping by using the kxcuts function. (b) same as (a) but for kyk_{y} momentum cuts
Refer to caption
Figure 4: Energy & Momentum Distribution Curves (a) EDC curve (b) MDC curve
Refer to caption
Figure 5: Dispersion map A dispersion map of HfP2 resolved with the dispersion() function
Refer to caption
Figure 6: Hf2Te2P (a) Normal energy contour (b) 2nd derivative energy contour
Refer to caption
Figure 7: ZrSiS Energy Contour (a) Normal energy contour (b) 2nd derivative energy contour
Refer to caption
Figure 8: Volumetric plot (a) volumetric plot of correctly formatted code. (b) Volumetric plot of incorrectly formatted input. There is no errors in the incorrectly formatted 3D band mapping contour