Repository navigation
specio3 v0.1.3 - High-Performance SPC File Reader
Overview
specio3 is a high-performance Python library for reading Galactic SPC (Spectral Data Collection) files. Built with C++ for speed and wrapped with pybind11 for seamless Python integration.
✨ Key Features
- 🚀 High-Performance C++ Core: Spectral file parsing implemented in optimized C++ with pybind11 bindings
- 📊 Comprehensive SPC Format Support:
- Y-only (evenly spaced X-axis)
- XY (explicit X values)
- XYY (shared X-axis, multiple Y spectra)
- XYXY (per-spectrum X-axis)
- 🐍 Pythonic API: Clean, well-typed interface with comprehensive documentation
- 📈 NumPy Integration: Returns data as numpy arrays for seamless scientific computing
- 🛡️ Robust Error Handling: Comprehensive validation with clear error messages
- 🔄 Cross-Platform: Supports Linux, macOS, and Windows
- 📦 Easy Installation: Available on PyPI with pre-built wheels
🏆 Performance
3.6x faster than spectrochempy - the reference Python implementation:
| File | Size | specio3 | spectrochempy | Speedup |
|---|---|---|---|---|
| 103b4anh.spc | 131 KB | 2.4 ms | 8.1 ms | 3.4x faster |
| 087b4ana.spc | 258 KB | 4.1 ms | 14.2 ms | 3.4x faster |
| 040b4ana.spc | 131 KB | 2.0 ms | 7.8 ms | 3.9x faster |
📦 Installation
pip install specio3🔧 Quick Start
import specio3
import matplotlib.pyplot as plt
# Read an SPC file
spectra = specio3.read_spc('your_file.spc')
# Get the first spectrum
x_values, y_values = spectra[0]
# Plot the spectrum
plt.figure(figsize=(10, 6))
plt.plot(x_values, y_values)
plt.xlabel('Wavenumber (cm⁻¹)')
plt.ylabel('Intensity')
plt.title('Spectral Data')
plt.show()
print(f"Loaded {len(spectra)} spectra")
print(f"First spectrum has {len(x_values)} data points")🔄 What's New in v0.1.3
- Performance: Optimized GitHub Actions wheel builds (5.6x faster CI/CD)
- Security: Comprehensive security audit and vulnerability fixes
- Organization: Improved project structure with docs/ and scripts/ directories
- Testing: Enhanced test reliability and removed .DS_Store from test output
- CI/CD: Fixed wheel platform tags and deployment issues
- Documentation: Updated API documentation and examples
🛠️ Technical Details
Supported File Types
- Y-only: Evenly spaced X-axis with generated X values
- XY: Explicit X and Y values for single spectrum
- XYY: Shared X-axis with multiple Y spectra
- XYXY: Individual X-axis per spectrum
API Reference
read_spc(path: str) -> List[Tuple[NDArray[np.float64], NDArray[np.float64]]]- Returns list of (x_array, y_array) tuples
- Comprehensive error handling for file access and format issues
🧪 Testing & Quality
- Comprehensive Test Suite: Tested against real SPC files from EPA Spectra dataset
- Multi-Platform CI/CD: Automated testing on Linux, macOS, and Windows
- Python 3.10+ Support: Compatible with Python 3.10, 3.11, and 3.12
- Type Safety: Full type hints for optimal IDE support
- Security Audited: Comprehensive security analysis included
🤝 Contributing
We welcome contributions! See our Contributing Guidelines for details.
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- Built with pybind11 for Python-C++ bindings
- Uses NumPy for efficient array operations
- Tested with spectral data from EPA Spectra dataset
- Performance benchmarks compared against spectrochempy
Made with ❤️ for the spectroscopy community
For support, documentation, and discussions, visit our GitHub repository.