This skill provides guidance for Raman spectrum peak fitting tasks. It should be used when analyzing spectroscopic data, fitting Lorentzian or Gaussian peaks to Raman spectra, or working with graphene/carbon material characterization. The skill emphasizes critical data parsing verification, physical constraints from domain knowledge, and systematic debugging of curve fitting problems.
This skill guides the analysis and curve fitting of Raman spectroscopy data, particularly for materials like graphene where characteristic peaks (G, D, 2D bands) must be accurately extracted. The primary challenge in these tasks is ensuring correct data ingestion before any analysis begins.
Before any fitting or analysis, verify data is parsed correctly. This is the most common source of failure in spectroscopic data analysis.
Read raw file content first - Examine the first 5-10 lines of the raw data file to understand the actual format
Identify potential format issues:
Parse and print first few values - After parsing, print the first 3-5 data points to verify they match expectations:
# Always verify parsing immediately
print(f"First 5 wavenumbers: {wavenumbers[:5]}")
print(f"First 5 intensities: {intensities[:5]}")
print(f"Wavenumber range: {min(wavenumbers)} to {max(wavenumbers)} cm⁻¹")
Sanity check against physical expectations:
| Issue | Example Raw Data | Correct Handling |
|---|---|---|
| Line number prefix | 1→1580.5,12345 | Strip prefix before delimiter split |
| Comma decimal | 1580,5\t12345,7 | Replace comma with period |
| Mixed delimiters | 1580.5, 12345 | Handle both tab and comma |
| BOM character | \ufeff1580.5 | Strip BOM from file start |
Apply these domain-specific constraints when fitting:
| Peak | Expected Position (cm⁻¹) | Typical Width (FWHM) | Physical Meaning |
|---|---|---|---|
| D band | ~1350 | 20-50 | Defects/disorder |
| G band | ~1580 | 10-20 | sp² carbon vibration |
| 2D band | ~2700 | 25-60 | Second-order D band |
| D+G | ~2940 | 30-60 | Combination mode |
Set physically reasonable bounds to avoid nonsensical fits:
# Example bounds for graphene G peak
bounds_lower = [1560, 5, 0] # [x0, gamma, amplitude]
bounds_upper = [1600, 50, 1e6]
# Example bounds for graphene 2D peak
bounds_lower = [2650, 10, 0]
bounds_upper = [2750, 100, 1e6]
Before fitting, identify peaks visually:
Consider baseline subtraction before peak fitting:
Common peak shapes for Raman:
Lorentzian function:
I(x) = amplitude * (gamma²) / ((x - x0)² + gamma²)
Use visual inspection or automatic peak finding to set initial guesses:
from scipy.signal import find_peaks
# Find peaks in the data
peaks, properties = find_peaks(intensity, height=threshold, distance=min_distance)
# Use found peak positions as initial guesses
for peak_idx in peaks:
x0_guess = wavenumber[peak_idx]
amplitude_guess = intensity[peak_idx]
After fitting, validate results:
If fitting produces poor results:
When reporting fitted parameters, include: