Raman Matlab and Python tools
Example files for reading Raman data (BWSpec spectrometer)
We publish in this page a few example files that show how to read data files saved by the BWSpec ® 4.11_1 software with default settings (.txt files).
The examples are written both in Python (tested with Python 3.11.1 on Windows 10) and Matlab (tested with MATLAB 9.13 (R2022b) Update 3 and with GNU Octave 7.3.0, both on Windows 10).
For both languages we provide
- A function that reads data from file, from two user-selected columns
- Two scripts which, with the help of the function, respectively plot the data and save the two selected columns
A test data file (Raman_spectrum_file.txt) accompanies the software.
To use the programs, please copy all of the files (including the data file) in the same directory and execute the scripts.
The “read” file is the function that reads the files. “plot” and “save” are scripts. The “plot” script generates a plot of the data in the user-selected columns. The “save” script saves on disk a file containing only the selected columns; the file to which we save takes the same name as the original file, appended with the string “_columns”.
The programs are provided without guarantees. In particular, we recommend to make a copy of your data files before using them as input of these programs.
A detailed description of the functions, aimed at users who do not have (yet) experience with either Python or Matlab but have at least some experience with programming, follows the table with the program list. The scripts have a few lines of comments that we hope are enough for users to understand how they work.
Program list
Language | File name | File purpose |
---|---|---|
Python | read_BWSpec_data_file.py | Function - reads data from the BWSpec file |
Python | plot_BWSpec_Raman_spectrum. py | Script - plots data |
Python | save_BWSpec_Raman_spectrum_columns.py | Script - saves selected columns to disk |
Matlab |
read_BWSpec_data_file.m |
Function - reads data from the BWSpec file |
Matlab |
plot_BWSpec_Raman_spectrum.m |
Script - plots data |
Matlab |
save_BWSpec_Raman_spectrum_columns.m |
Script - saves selected columns to disk |
For a detailed description click here
Program files are available here: CeSAR Raman