UV-Vis Analyzer
The UV-Vis Analyzer is a Python application designed to analyze UV-Vis spectroscopy data by comparing a sample file (in .abs, .csv, or .txt format) against a library of standard files. It identifies the best-matching standard based on peak matching, generates comparison and subtraction plots, and provides additional metrics such as cosine similarity and RMSE. The application features a graphical user interface (GUI) built with Tkinter, allowing users to select input files, view results, and save outputs.
Features
- File Support: Reads sample and standard files in
.abs, .csv, or .txt formats (two columns: wavelength and absorbance, with an optional header row).
- Peak Matching: Identifies matching peaks between the sample and standards within a 1.0 nm tolerance.
- Metrics: Calculates cosine similarity, RMSE, and a custom score for each standard to quantify similarity.
Usage
- Prepare Input Files:
- Sample File: A single file (
.abs, .csv, or .txt) with two columns (wavelength in nm, absorbance).
Example:
Wavelength Absorbance
193.00 0.001
193.50 0.001
- Standard Files: Place standard files in a
std_lib directory, named starting with “std” (e.g., std1.abs, std2.csv). Each file should have the same format as the sample file.
- Ensure files have a header row (skipped during processing) or adjust the parsing logic in
analysis.py if needed.
Using the GUI:
- Select Sample File: Click “Browse” to choose a .abs, .csv, or .txt sample file.
- Select std_lib Directory: Choose the directory containing standard files.
- Select Output Directory: Choose where to save output files (CSV, plots, and results).
- Run Analysis: Click “Run Analysis” to process the data and display results.
- View Plots: Click “Show Comparison Plot” or “Show Subtraction Plots” to view visualizations.
- Save Outputs: Click “Save All Plots” or “Save Results to File” to save outputs with sample-specific names.
- Close: Click “Close” to exit the application.
Output Files:
- analysis_results_{sample_name}.txt: Text file with results of analysys for sample with a list of main peaks.
- max_values_{sample_name}.csv: Sample peak wavelengths and absorbances.
- comparison_plot_{sample_name}.png: Plot of sample vs. best-matching standard.
- subtraction_{sample_name}_{std_file}.png: Subtraction plots for each standard.
评论