Using STSplot.m
Overview
STSplot.m is a tool we use to plot our scanning tunneling spectroscopy (STS) data we take on the R9 STM. In order to work with the program, the data must first be converted by sm4tomatlab.m to .mat structures.
Note: This code requires the varycolor.m program by Daniel Helmick for dynamic colour designation.
Required Files:
STSplot.m the program itself
varycolor.m a pre-existing function by Daniel Helmick used for dynamic colour designation.
sm4reader.m used to convert RHK's .sm4 files to .mat
Optional Files:
sm4tomatlab.m uses sm4tomatlab.m to convert and save all the .sm4 files in the active directory
Description
STSplot plots STS point or line spectra data that has been converted from the .sm4 format to .mat using the sm4reader m-file. It also displays a flattened topographic image with the locations the STS data were taken marked on the image, with colours coded to the STS spectra plots. The STS files are either a set of point spectroscopy data (with possible multiple repetitions of the measurement per file), or a single file which contains STS measurements at several points along a line on a sample surface (with possible repetitions). A topographical file is required to mark the physical locations.
To call the function it must be in a MATLAB path.* The function call is: STSplot(yPlot, yOffset, repetitionNumber, varargin) with the parameters described below.
*For details on how to add user functions / folders to MATLAB paths, making your own startup.m may be useful.
yPlot is the types of plots you want to generate. This field is a cell and can be {'dI/dV'} , {'Current (A)'} or both in whichever order you choose, such as {'dI/dV', 'Current (A)'}.
yOffset is used to generate waterfall plots, the offset is used between different point spectroscopy locations, or the series of locations in a line for line spectroscopy. The offsets are given as an array in the same order of the plot types, e.g. [4e-12,1e-10] for two plot types.
repetitionNumber controls which repititions of each measurement you are You can enter the following values:
After repetition number you can include optional arguments. These include:
An example call using several optional fields is: STSplot({'Current (A)','dI/dV'}, [0,0], 'average', {'smooth',20}, 'arrow')
Accepted and Required Data
Right now the program plots point spectroscopy data or line spectroscopy data. Each spectroscopic measurement has an associated topography scan where it was taken. The plotting program requires the spectroscopic data as well as the topographic scan to run. You will be queried to choose each when it runs. You can choose converted .mat files or the .sm4 files directly.
Example Output
STSplot({'Current (A)','dI/dV'},[1e-10,1e-11],'average', {'smooth',20},'arrow')
STSplot.m is a tool we use to plot our scanning tunneling spectroscopy (STS) data we take on the R9 STM. In order to work with the program, the data must first be converted by sm4tomatlab.m to .mat structures.
Note: This code requires the varycolor.m program by Daniel Helmick for dynamic colour designation.
Required Files:
STSplot.m the program itself
varycolor.m a pre-existing function by Daniel Helmick used for dynamic colour designation.
sm4reader.m used to convert RHK's .sm4 files to .mat
Optional Files:
sm4tomatlab.m uses sm4tomatlab.m to convert and save all the .sm4 files in the active directory
Description
STSplot plots STS point or line spectra data that has been converted from the .sm4 format to .mat using the sm4reader m-file. It also displays a flattened topographic image with the locations the STS data were taken marked on the image, with colours coded to the STS spectra plots. The STS files are either a set of point spectroscopy data (with possible multiple repetitions of the measurement per file), or a single file which contains STS measurements at several points along a line on a sample surface (with possible repetitions). A topographical file is required to mark the physical locations.
To call the function it must be in a MATLAB path.* The function call is: STSplot(yPlot, yOffset, repetitionNumber, varargin) with the parameters described below.
*For details on how to add user functions / folders to MATLAB paths, making your own startup.m may be useful.
yPlot is the types of plots you want to generate. This field is a cell and can be {'dI/dV'} , {'Current (A)'} or both in whichever order you choose, such as {'dI/dV', 'Current (A)'}.
yOffset is used to generate waterfall plots, the offset is used between different point spectroscopy locations, or the series of locations in a line for line spectroscopy. The offsets are given as an array in the same order of the plot types, e.g. [4e-12,1e-10] for two plot types.
repetitionNumber controls which repititions of each measurement you are You can enter the following values:
- a number --that repetition is plotted, e.g. 1, 2
- * 'all' --all repetitions are plotted simultaneously
- * 'average' --this plots the average of all the repetitions for each measurement
- * 'allwithaverage --plots all repetitions, with a curve for the average shown in black (note if the last measurement is in black the average remains black as well)
After repetition number you can include optional arguments. These include:
- Data smoothing. Call by entering {'smooth', SMOOTHWIDTH}, where SMOOTHWIDTH is a natural number which says what number neighbors you will use to average at each point. 0 is no smooth, 1 is neareast neighbors only (3 points), 2 is two neighbors on each side (5 pts), etc..
- Scan direction arrow. On the plotted topography data for line spectroscopy, you can include an arrow that shows what direction the plotting took place. Include 'arrow' as the argument to enable the arrow. Note that the arrow dimensions may require some altering depending on how it display on your computer screen and your preferences.
An example call using several optional fields is: STSplot({'Current (A)','dI/dV'}, [0,0], 'average', {'smooth',20}, 'arrow')
Accepted and Required Data
Right now the program plots point spectroscopy data or line spectroscopy data. Each spectroscopic measurement has an associated topography scan where it was taken. The plotting program requires the spectroscopic data as well as the topographic scan to run. You will be queried to choose each when it runs. You can choose converted .mat files or the .sm4 files directly.
Example Output
STSplot({'Current (A)','dI/dV'},[1e-10,1e-11],'average', {'smooth',20},'arrow')
Repetition number
Choosing 1 for repetitionNumber chooses the first measurement at each point to be plotted. You can see the difference in noise between the two repetitions chosen.
Choosing 1 for repetitionNumber chooses the first measurement at each point to be plotted. You can see the difference in noise between the two repetitions chosen.
STSplot({'Current (A)'},[1e-10], 1) STSplot({'Current (A)'},[1e-10], 2)
Choose 'all' to plot all repetitions simultaneously, or 'average' to plot the average of all measurements made at each point.
STSplot({'Current (A)'},[1e-10], 'all') STSplot({'Current (A)'},[1e-10], 'average')
Finally, you could choose 'allwithaverage' to plot all the measurements along with the average (which is plotted in black).