Python tools and notebooks for working with Raman map data from CZTS samples. The repository is currently organized around saved Raman hypercubes in .npz format, preprocessing with ramanspy, and generating spatial peak maps or interactive dashboards.
RAMAN-analysis/
|-- analysis.py
|-- analysis_dashboard.ipynb
|-- ploting_too.py
|-- preprocess.py
|-- README.md
|-- requirements.txt
|-- utils.py
`-- CZTS_31_249606_290526_532nm_10%_10s_2a_s_map1700x1700_no_edge.txt
analysis_dashboard.ipynb- Notebook for interactive Raman data exploration and dashboard-style analysis.ploting_tool.py- Main command-line script for plotting Raman peak intensity maps, peak-to-base ratio maps, and Plotly dashboards from.npzhypercubes.preprocess.py- Main command-line preprocessing pipeline for baseline correction, denoising, cosmic-ray removal, and spectral cropping.utils.py- Shared helper functions for parsing map text files, creating hypercubes, loading.npzdata, smoothing maps, and normalizing data.requirements.txt- Python package list used for the current environment.
The plotting and preprocessing scripts expect a compressed NumPy .npz hypercube containing these arrays:
x- X coordinates of the Raman map.y- Y coordinates of the Raman map.wave- Raman shift / wavenumber axis.intensity- 3D intensity cube with shape(nx, ny, nw).
Raw Raman text files are expected to use tab-separated columns:
#X #Y #Wave #Intensity
Create and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Install the dependencies:
python -m pip install -r requirements.txtThe most important packages are numpy, pandas, matplotlib, plotly, ramanspy, scipy, and scikit-learn.
The current working hypercube files are in parsed_spectra_551_points/.
Use the unprocessed cube when you want to run preprocessing yourself:
parsed_spectra_551_points\raman_hypercube_manual.npzUse the processed cube when you want to go directly to plotting:
parsed_spectra_551_points\raman_hypercube_manual_processed.npzRun preprocess.py on an input .npz file:
python preprocess.py parsed_spectra_551_points\raman_hypercube_manual.npz --baseline als --denoise savgol --cosmic-rays --output parsed_spectra_551_points\raman_hypercube_manual_processed.npzUseful options:
--baseline als- apply ALS baseline correction.--baseline none- skip baseline correction.--denoise savgol- apply Savitzky-Golay denoising.--denoise gaussian- apply Gaussian denoising.--denoise none- skip denoising.--cosmic-rays- remove spikes usingramanspy.--crop-minand--crop-max- keep only a selected wavenumber range.--outputor-o- choose the output.npzpath.
Example with spectral cropping:
python preprocess.py parsed_spectra_551_points\raman_hypercube_manual.npz --baseline als --denoise savgol --crop-min 250 --crop-max 500Generate a static Matplotlib peak map:
python plot_peak_map.py parsed_spectra_551_points\raman_hypercube_manual_processed.npz --peak 338 --output peak_map_338.pngGenerate a peak-to-base ratio map:
python plot_peak_map.py parsed_spectra_551_points\raman_hypercube_manual_processed.npz --peak 338 --map-type peak-to-base-ratio --output peak_to_base_338.pngApply spatial smoothing:
python plot_peak_map.py parsed_spectra_551_points\raman_hypercube_manual_processed.npz --peak 338 --smooth-sigma 1.5 --output peak_map_338_smoothed.pngCreate a Plotly dashboard with a spatial heatmap and a spectrum view:
python plot_peak_map.py parsed_spectra_551_points\raman_hypercube_manual_processed.npz --peak 338 --dashboard --output peak_map_338_dashboard.htmlSee peak_info.md for currently tracked peak positions. Important CZTS-related peaks include:
- CZTS main peaks:
287 cm^-1,338 cm^-1 - ZnS:
272-277 cm^-1,349-352 cm^-1 - CuS:
475 cm^-1 - CuSnS shoulder:
355 cm^-1
The active repository no longer has a top-level parser CLI. Parsing helpers live in utils.py, especially:
parse_map_filebuild_hypercubesave_hypercubeparse_and_save
Use these archived files as references if you need to regenerate .npz hypercubes from raw Raman .txt maps.
- Keep current parsed
.npzfiles in aparsed_spectra_*folder. - Keep older experiments, generated plots, and deprecated scripts in
archive/. preprocess.pyrequiresramanspy.plot_peak_map.pyrequiresplotlyonly for interactive maps and dashboards.