Skip to content

ACDBio/raman-open-forge-imai

Repository files navigation

raman-open-forge-imai

A user-friendly PyQt5-based application for controlling line spectrometers, acquiring spectral data, performing Raman shift conversions with calibration, preprocessing spectra, managing a reference database, and searching for spectral matches. Optimized for Raman spectroscopy workflows. The app is specifically optimized for Hamamatsu CCD sensors and has been tested with the IRM785 spectrometer from Imai Optics. It supports DIY Raman systems based on Hamamatsu CCDs (see separate GitHub repository for details). It also allows laser control for Imai Optics probe YM_RPL_785_500.

Overview

Raman Open Forge Imai provides an integrated interface for spectrometer operation and data analysis. It handles device communication via serial port, real-time spectrum acquisition, advanced preprocessing using the ramanspy library, software/hardware calibration, and a database management for storing and querying reference spectra. The application is designed to streamline Raman spectroscopy tasks, from data collection to identification. Key capabilities include device parameter control, background subtraction, Raman shift calibration to correct peak positions, spectral preprocessing pipelines, peak detection, database management, and similarity-based searches with multiple metrics.

Ramanbase.org integration

We provide .ipynb showing how to make custom reference databases based on ramanbase.org spectra for working with the app. An example of a small-scale database is presented here (to work, it should be unzipped and renamed to rbase_specdictcur.pkl) and a larger processed database covering ~85k spectra can be downloaded here.

Key capabilities include:

  • Device control (integration time, averaging, gain, offset, laser voltage (if probe is present), smoothing).
  • Spectrum acquisition (single or continuous mode) with background subtraction.
  • Conversion to Raman shifts with optional quadratic software calibration to correct peak positions.
  • Advanced preprocessing: cropping, denoising (SavGol), baseline correction (ASLS), normalization.
  • Peak detection and export.
  • Spectral database management (add, delete, load/save as pickle files).
  • Database search using similarity metrics (SAD, SID, MAE, MSE, IUR for peaks).
  • Interactive plotting with zoom, reference overlay, and export options.

Features

Device Connection and Control

  • Scan and connect to serial ports (e.g., USB spectrometers).
  • Set integration time (1–60,000 ms), hardware averaging (1–255).
  • Advanced settings: gain (0–255), offset (-255–255), laser voltage (0–5000 mV), trigger out (HIGH/LOW), smoothing level (1–10).
  • Read current device parameters on connection.
  • Save parameters to device flash.

Spectrum Acquisition

  • Single acquisition or continuous mode with pause.
  • Background spectrum acquisition and automatic subtraction.
  • Real-time FPS display and acquisition count.
  • Raw spectrum plotting with optional auto-zoom.

Raman Shift Conversion and Calibration

  • Toggle conversion to Raman shifts using excitation wavelength (adjustable, default 785 nm).
  • Software calibration: polynomial fit on observed vs expected shifts (from table input).
  • Hardware calibration: read/write coefficients for wavelength, Raman shift, and intensity groups.
  • Preview calibrated axis and save to device flash.
  • Load/save calibration files as CSV.

Spectrum Processing

Pipeline based on ramanspy:

  • Crop region (min/max shift).

  • Savitzky-Golay denoising.

  • ASLS baseline correction.

  • Normalization (MinMax).

  • Peak finding with prominence and width thresholds.

  • Processed spectrum plotting with peak labels.

  • Export processed data and peaks as CSV.

Database Management

  • Load/save databases as pickle files (.pkl).
  • Add current spectrum to database with custom name.
  • Delete spectra from database.
  • Create new empty database.
  • Auto-load default database on startup.
  • Reload current database.

Database Search

  • Enable/disable search in processing panel.
  • Metrics: SAD, SID, MAE, MSE, IUR (peak-based intersection over union with tolerance).
  • Preprocess database spectra option.
  • Minimum axis overlap threshold.
  • Top-N results display and download as CSV.
  • Reference plotting from search results or entire database.

Motorized table control and automated scans

Plotting and Visualization

  • Interactive plots using pyqtgraph.
  • Overlay reference spectra (green line).
  • Auto-zoom with margin; default views for wavelength (796–1119 nm) and Raman (0–2000 cm⁻¹).
  • Peak lines and labels (dashed red).
  • Log widget for application events.

UI Layout

  • Main window: control buttons, plot, log.
  • Docks: Process Spectra (left), Calibration (right), Manage Database (left), Advanced Settings (right).
  • Status bar with FPS and acquisition count.

Installation

git clone [https://github.com/yourusername/line-spectra-viewer.git](https://github.com/ACDBio/raman-open-forge-imai)
cd raman-open-forge-imai
pip install PyQt5 pyqtgraph numpy scipy pandas ramanspy pyserial
python3 Main.py

Usage

Here we illustrate the usage of the software in the process of soft Raman shift calibration.

1. Obtaining acetone spectrum and calibration

Obtaining acetone spectrum (the probe YM_RPL_785_500 and 3d printed quartz cuvette holder was used), comparison with the reference database spectrum,
peak search and software calibration based on the obtained data using a polynomial fit
(the reference DB acetone spectrum peaks were determined prior to the procedure with the same software) Acetone calibration


2. DMSO sanity check with IUR

Searching spectra similar to the measured DMSO spectrum using IUR procedure and plotting the found spectrum along with the measured one. Note: IUR is sensitive to tolerance — adjust settings for your database and hardware. DMSO sanity check


3. Isopropyl alcohol calibration test

IPA test


4. Data collection and saving spectra

Data collection

Acknowledgments

Special thanks to Imai Optics for supporting the project by providing a discount on YM_RPL_785_500, which was instrumental in testing and validating the software. Their high-quality equipment ensured reliable performance during development. Also thyanks to ramanbase.org developers and contributors and ramanspy developers. Grok4, ChatGpt, Claude assisted the development.

Contributing

Contributions are welcome! Please submit issues or pull requests for bugs, features, or improvements. The software is at the active development stage. This project is licensed under the MIT License - see the LICENSE file for details.<|control12|># Line Spectra Viewer

About

A free, open-source desktop application for controlling low-cost Hamamatsu CCD Raman spectrometers, acquiring, processing spectra, creating and managing spectral databases (DBs) and performing basic spectra search in the DBs. The app is also adapted to work with ramanbase.org database materials.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors