This Python script provides a comprehensive solution for analyzing spectral data, particularly focusing on emission and excitation spectra. It includes functionalities for importing data, smoothing spectra, performing Gaussian fits, and visualizing results with a focus on spectral features like peak maxima, full width at half maximum (FWHM), and area under the curve.
- Data Import: Supports importing spectral data from text files.
- Data Processing: Includes smoothing of spectra using the Savitzky-Golay filter.
- Spectral Analysis: Performs Gaussian fitting on emission spectra to determine peak characteristics.
- Visualization: Generates plots of processed spectra and fits, including a visual representation of the FWHM and peak maxima.
To run this script, ensure you have Python installed on your system along with the following packages:
- numpy
- scipy
- matplotlib
Install the required packages using the following command:
pip install -r requirements.txt
- Prepare your spectral data files in a plain text format. The script expects two types of data files:
- Excitation data file
- Emission data file
- Adjust the script parameters to match your data and analysis needs. Important parameters include:
- File paths for the excitation and emission data
- Smoothing parameters
- Fitting parameters and options
- Run the script with Python:
python main.py
- The script will process the data, perform any requested fits, and generate plots of the results. Plots will be saved in the specified directory.
- Data Files: Modify
exc_path
andemi_path
to point to your data files. - Plot Appearance: Adjust plot parameters such as colors and linewidths within the
pp
dictionary. - Analysis Parameters: Set
smooth
,fit
,initial_guess
, and other parameters according to your analysis requirements.
The provided example demonstrates a full workflow from importing data, processing it, fitting Gaussian curves, and plotting the results. To adapt the example to your data, modify the file paths and analysis parameters as needed.
Feel free to fork this project and submit pull requests with improvements or report any issues you encounter.