2024-auto-openraman

Python package for automation and extension of OpenRaman

https://github.com/arcadia-science/2024-auto-openraman

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Python package for automation and extension of OpenRaman

Basic Info
  • Host: GitHub
  • Owner: Arcadia-Science
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 7.97 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 13
  • Releases: 1
Created over 1 year ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

AutoOpenRaman

This repo contains a Python package called autoopenraman. It uses Micro-Manager and Pycro-Manager to interface with the OpenRaman spectrometer. It provides a UI for spectrum visualization and uses the Pycro-Manager backend to control additional hardware. For more details, see our pub "AutoOpenRaman: Low-cost, automated Raman spectroscopy".

neon-livemode-trimmed-cropped

Installation

First, make sure you have poetry installed.

Then, clone the repository, install dependencies, and install the package: bash git clone https://github.com/Arcadia-Science/2024-auto-openraman cd 2024-auto-openraman conda env create -n autoopenraman-dev -f envs/dev.yml conda activate autoopenraman-dev poetry install --no-root --with dev pip install -e .

Usage

First, download this repository to your local machine.

Then, copy the configuration file to your home directory and rename it to profile.yml like this:

On Mac:

bash cp .sample_autoopenraman_profile.yml ~/autoopenraman/profile.yml

On Windows:

bash copy .sample_autoopenraman_profile.yml %USERPROFILE%\autoopenraman\profile.yml

Download the latest version of Micro-Manager 2.0 compatible with your OS. This package was built around Micro-Manager 2.0.3-20250602 but should work with subsequent nightly builds.

Start Micro-Manager with the configuration autoopenraman_mmconfig_demo.cfg found in the root directory of this repo. No physical devices need to be connected to run tests.

In Micro-Manager, go to Tools>Options and enable the checkbox "Run pycro-manager server on port 4827". You will only need to do this once.

After installation, launch the application GUI with:

bash autoopenraman

Features

The GUI provides a unified interface where you can switch between: - Live Mode: Real-time spectrum visualization with filtering options - Acquisition Mode: Configure and run automated acquisitions across multiple positions

Live Mode Features

  • Real-time visualization: Continuous spectrum display from the spectrometer
  • Background subtraction: Capture, store, and subtract background spectra to highlight sample features
  • Median filtering: Apply configurable kernel size median filtering to reduce noise
  • X-axis reversal: Option to reverse the x-axis for compatibility with different spectrometer orientations

Acquisition Mode Features

  • Multi-position acquisition: Acquire spectra at multiple stage positions defined in a Micro-Manager position list file
  • Spectra averaging: Configurable number of acquisitions to average per position
  • Position randomization: Option to randomize the order of stage positions during acquisition
  • Timelapse acquisition: Configure multiple time points with specified intervals
  • Automatic file saving: Saves spectra and metadata to CSV and JSON files

Calibration Features

  • Wavenumber calibration: Two-step calibration process using neon lamp and acetonitrile reference spectra
  • Save/load calibrations: Save calibration for later use or load previously saved calibrations
  • Adjustable excitation wavelength: Configure the excitation wavelength for accurate Raman shift calculation

Requirements

Optional Hardware

  • XY stage for multi-position acquisition
  • Arduino/Teensy-controlled shutter device for controlling laser exposure
  • Arduino/Teensy-controlled neon light source for rough calibration

The Arduino firmware for the shutter and neon light source is available in the arduino directory of this repository. You can upload it to your Arduino/Teensy board using the Arduino IDE.

Profile Configuration

AutoOpenRaman uses profile.yml to track hardware connections and configurations. The file is located in the ~/autoopenraman directory on Mac and Linux, and in %USERPROFILE%\autoopenraman on Windows.

The profile includes the following key settings:

```yaml

Default environment (testing or deployment)

environment: testing

Testing environment settings (uses simulated devices)

testing: savedir: ~/autoopenraman/data shuttername: DemoShutter

Deployment environment settings (for real hardware)

deployment: savedir: ~/experiments/ramandata shutter_name: ArduinoShutter # Replace with your actual shutter device name ```

When using real hardware, it is recommended to set the environment to deployment in the profile.yml file and update the corresponding section with your hardware information.

Set save_dir to the default directory where you want to save the acquired spectra. This directory will be created if it does not exist.

If using a real shutter, set shutter_name to match the name of the shutter in Micro-Manager.

Calibration

AutoOpenRaman provides a two-step calibration process to convert from pixel coordinates to Raman shift (wavenumbers):

  1. Rough calibration using a neon lamp spectrum to establish the coarse pixel-to-wavelength relationship
  2. Fine calibration using acetonitrile reference spectrum to convert wavelengths to Raman shifts

Calibration Procedure

  1. In the GUI, click the "Calibrate" button
  2. Select a neon lamp reference spectrum file (CSV format)
  3. Select an acetonitrile reference spectrum file (CSV format)
  4. Enter the excitation laser wavelength (default: 532 nm)
  5. Click "Calibrate" to perform the calibration
  6. Use "Save Calibration" to save the calibration for future use

The software identifies peaks in these reference spectra and matches them to known reference values: - Neon peaks at specific wavelengths (585.249 - 653.288 nm) - Acetonitrile peaks at specific Raman shifts (918, 1376, 2249, 2942, 2999 cm⁻¹)

After calibration, you can switch between "Pixels" and "Wavenumbers (cm⁻¹)" display modes using the dropdown menu.

Data Output Format

Spectrum Files

Spectra are saved in CSV format with either 2 or 3 columns: - Without calibration: Pixel, Intensity - With calibration: Pixel, Wavenumber (cm⁻¹), Intensity

Metadata Files

Each spectrum has an accompanying JSON metadata file with the same base filename (but .json extension) containing:

  1. Acquisition Parameters:

    • Number of averages: Number of spectra averaged for each measurement
    • Stage position file: Path to the position list file used
    • DateTime: Timestamp of acquisition (YYYY-MM-DD HH:MM:SS)
  2. Timelapse Information:

    • NumTimePoints: Number of time points in the timelapse
    • TimeIntervalSeconds: Interval between time points in seconds
  3. Processing Parameters:

    • MedianFilter: Settings for filtering (Applied boolean and KernelSize)
    • ReverseX: Whether the X-axis was reversed
  4. Calibration Information:

    • Applied: Whether calibration was applied
    • ExcitationWavelength: Laser wavelength in nm (if calibrated)
  5. Position Information:

    • PositionName: Name of the stage position from MM position list
    • Time point information from the acquisition

This metadata provides complete context for interpreting each spectrum and reproducing acquisition settings.

Development

Follow the installation instructions above to set up the development environment.

Testing

Make sure the configuration file profile.yml is set up correctly and Micro-Manager is running with the demo configuration before running the tests.

We use pytest for testing. The tests are found in autoopenraman/tests/test_gui.py. To run the tests, run the following command from the root directory of the repository:

bash pytest -v

Managing dependencies

We use poetry to manage dependencies. To add a new dependency, use the following command:

bash poetry add some-package

To add a new development dependency, use the following command:

bash poetry add -G dev some-dev-package

To update a dependency, use the following command:

bash poetry update some-package

Whenever you add or update a dependency, poetry will automatically update both pyproject.toml and the poetry.lock file. Make sure to commit the changes to these files to the repo.

Owner

  • Name: Arcadia Science
  • Login: Arcadia-Science
  • Kind: organization
  • Location: United States of America

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite the associated publication.
title: 'AutoOpenRaman: Low-cost, automated Raman spectroscopy'
doi: 10.57844/arcadia-7vbd-n3ry
authors:
- family-names: Braverman
  given-names: Ben
  affiliation: Arcadia Science
  orcid: https://orcid.org/0009-0005-0334-7004
- family-names: Hochstrasser
  given-names: Megan L.
  affiliation: Arcadia Science
  orcid: https://orcid.org/0000-0002-4404-078X
- family-names: Kolb
  given-names: Ilya
  affiliation: Arcadia Science
  orcid: https://orcid.org/0000-0001-5100-849X
- family-names: Mets
  given-names: David G.
  affiliation: Arcadia Science
  orcid: https://orcid.org/0000-0002-0803-0912
- family-names: Sharma
  given-names: Sunanda
  affiliation: Arcadia Science
  orcid: https://orcid.org/0000-0001-8822-7960
preferred-citation:
  title: 'AutoOpenRaman: Low-cost, automated Raman spectroscopy'
  type: article
  doi: 10.57844/arcadia-7vbd-n3ry
  authors:
  - family-names: Braverman
    given-names: Ben
    affiliation: Arcadia Science
    orcid: https://orcid.org/0009-0005-0334-7004
  - family-names: Kolb
    given-names: Ilya
    affiliation: Arcadia Science
    orcid: https://orcid.org/0000-0001-5100-849X
  - family-names: Mets
    given-names: David G.
    affiliation: Arcadia Science
    orcid: https://orcid.org/0000-0002-0803-0912
  - family-names: Sharma
    given-names: Sunanda
    affiliation: Arcadia Science
    orcid: https://orcid.org/0000-0001-8822-7960
  year: 2025

GitHub Events

Total
  • Issues event: 2
  • Push event: 1
  • Public event: 1
  • Create event: 1
Last Year
  • Issues event: 2
  • Push event: 1
  • Public event: 1
  • Create event: 1

Dependencies

.github/workflows/lint.yml actions
  • actions/cache v4 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/test.yml actions
  • abatilo/actions-poetry v2 composite
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
poetry.lock pypi
  • 219 dependencies
pyproject.toml pypi