A universal underlying library for various Raman projects
The program iterates through all .txt files in the target folder. It merges multiple .txt files (mappings) for a single sample into a single .txt file. This is used for batch merging and preprocessing all spectral data files in a folder.
Path Selection (Interactive Layer):
The user clicks the "Select Folder" button to bring up a system dialog box and select the directory containing the original experimental data (e.g., Witec Raman spectroscopy .txt files).
The user clicks the "Select Save Path" button to set the output location and filename of the merged file.
Batch Reading and Standardization (Logical Layer):
When "Process and Save Data" is clicked, the program calls ReadData.combine_folder_data.
The program iterates through all .txt files in the target folder.
Key Processing: Before merging, the program automatically calls the wavelength_alignment function to uniformly interpolate the wavenumber/wavelength (X-axis) of all files to the range of 200 to 2000, and resamples them to 2048 points. This step is crucial, ensuring that the spectra measured in different batches are physically aligned during merging.
Horizontal Data Stitching and Export (Output Layer):
Discard the redundant X-axis values of all aligned spectral intensity data (Y-axis) and stitch them horizontally (np.hstack) into a large matrix.
Finally, call ReadData.write_data to output the merged matrix as a tab-delimited .txt file to the user-specified path.
The data needs to be named during storage; refer to the naming rules in creat_hdf5.py.
Debiased and mean centered.
python linear_detrend_rich_spec_raman_base_mean_center.py --input_path /path/to/Rich_spec --output_dir /path/to/Rich_spec_linear_detrend_centered --fit_wn_start 600 --fit_wn_end 1700 --backend torch --device cuda --overwriteSpectral matrix data from multiple experimental text files (.txt), along with classification and regression labels cleverly hidden in the filenames, are packaged and structuredly stored into a single HDF5 file (dataset.h5).
The current filename parsing logic in creat_hdf5.py supports the following format: R6G#MB,-10#-12.txt This translates to: Substance1#Substance2,Concentration1#Concentration2.txt. Filenames must strictly match this format. Substances and concentrations are separated by commas (,), multiple substances are separated by #, and multiple concentrations are also separated by #. The number of substances and the number of concentrations must correspond one-to-one.
python creat_hdf5.py --input-dir "D:/data/your_input_folder" --output-dir "D:/data/your_output_folder" --output-name dataset.h5python check_creat_hdf5_dataset.py --h5 /path/to/dataset.h5 --check-finite --strict-label-count --show-concentration-by-material --export-csv /path/to/dataset_check_summary.csvfrom wdf export jpg and npz.
python -m raman_base.tools.wdf_export "D:\data\sample.wdf" -o "D:\decoded"python -m raman_base.tools.wdf_export "D:\raw" -o "D:\decoded"Examining the mapping in a WDF file reveals some preprocessing functions. Currently, only the WDF file is being read for size.
python -m raman_base.tools.mapping_viewer