PNG preview generation using sm4datapreview
skippedFiles = sm4datapreview( )
sm4datapreview.m is a script that allows conversion of entire folders of .sm4 files in one go using sm4reader.
How to use
With both sm4reader and sm4datapreview in a proper MATLAB search path so they can be called from the command line*, just enter sm4datapreview into the line, and it will act on the currently active MATLAB folder. Each .sm4 file is inspected and PNG previews are generated for each topography, IV and dIdV plot present. The details of the previews are discussed below.
*For details on how to add user functions / folders to MATLAB paths, making your own startup.m may be useful.
A note on filenames
MATLAB has issues with extra periods, so any ' . ' in the file name is automatically replaced with ' _ ' before saving as the PNG.
Output: Topography
sm4datapreview.m is a script that allows conversion of entire folders of .sm4 files in one go using sm4reader.
How to use
With both sm4reader and sm4datapreview in a proper MATLAB search path so they can be called from the command line*, just enter sm4datapreview into the line, and it will act on the currently active MATLAB folder. Each .sm4 file is inspected and PNG previews are generated for each topography, IV and dIdV plot present. The details of the previews are discussed below.
*For details on how to add user functions / folders to MATLAB paths, making your own startup.m may be useful.
A note on filenames
MATLAB has issues with extra periods, so any ' . ' in the file name is automatically replaced with ' _ ' before saving as the PNG.
- Topography -- These files are saved with the original file name, but with the .png file extension suffix.
- IV or dIdV spectroscopy -- These files use the same file name, but with a "_spec" appended to the end, before the .png.
Output: Topography
Topographical scans are flattened and contrast-adjusted before plotting. The image is scaled to 512 pixel width, if the scan post-scaling is at least 256 pixels high a scalebar is added. The scalebar and text are white with a black outline, so they should show well on light and dark areas of the scan.
Beneath the image is a labeled area, containing the following information:
Output: IV and dIdV
Beneath the image is a labeled area, containing the following information:
- File name
- Date and time taken
- Width of image
- Bias during scan (STM only)
- Current setpoint (STM only)
- dF setpoint (AFM only)
- Drive amplitude (AFM only)
Output: IV and dIdV
Whether there is IV, dIdV, or both, they are all plotted on a single figure, as shown above. The title of the figure is the filename, the date, and the time of the data collection. All curves in the file are plotted, and they are given smoothing to increase clarity (each point is averaged over its 20 nearest neighbors (10 on each side).
Skipped Files
There are some important considerations about sm4datapreview's behaviour, dictated by which kinds of .sm4 data sm4reader is capable of formatting. .sm4 files which lack the data structures sm4reader reads and formats are skipped, with names of the skipped files output into the array skippedFiles. Which files are readable and which are skipped is dependent on having thought of all file types and exceptions. If a new exception not accounted for is encountered, then the program will return an error.
Our list of converted and skipped files is not exhaustive, but based on our needs. If you find a new type of data structure in the .sm4 then you will need to change the sm4reader program, not sm4datapreview.
There is an additional case of files which aren't skipped (as in not read by sm4reader), sm4datapreview has cases when it decides not plot data, such as Topography scan is 3 or fewer lines, or all zeros, or the data is a type we are not interested in (Z spectroscopy). These are not currently listed in skippedFiles.
Skipped Files
There are some important considerations about sm4datapreview's behaviour, dictated by which kinds of .sm4 data sm4reader is capable of formatting. .sm4 files which lack the data structures sm4reader reads and formats are skipped, with names of the skipped files output into the array skippedFiles. Which files are readable and which are skipped is dependent on having thought of all file types and exceptions. If a new exception not accounted for is encountered, then the program will return an error.
Our list of converted and skipped files is not exhaustive, but based on our needs. If you find a new type of data structure in the .sm4 then you will need to change the sm4reader program, not sm4datapreview.
There is an additional case of files which aren't skipped (as in not read by sm4reader), sm4datapreview has cases when it decides not plot data, such as Topography scan is 3 or fewer lines, or all zeros, or the data is a type we are not interested in (Z spectroscopy). These are not currently listed in skippedFiles.