Skip to main content

Bruker OPUS

brukeropus is a Python package for interacting with Bruker's OPUS spectroscopy software. Currently, the package can read OPUS data files and communicate/control OPUS through the DDE interface (e.g. for scripting measurement sequences).

Reading OPUS Data Files

brukeropus can read the binary data files saved by OPUS. The parsing algorithm in this package is more complete than previous efforts, with a goal to achieve 100% extraction accuracy.

Features

  • Extracts spectral data (e.g. sample, reference, absorbance, transmittance, etc.)
  • Extracts 3D spectral data (e.g. spectral time series)
  • Extracts file metadata (e.g. beamsplitter, source, aperture, etc.) with human readable metadata labels for over 2000 parameters (extracted directly from OPUS software parameter file)
  • Very fast data parsing and assigning to OPUSFile class (limited by disk I/O)
  • Low-level parsing functions are well documented and could be used to build your own custom OPUS file class if OPUSFile does not suit your needs)

Usage

from brukeropus import read_opus
from matplotlib import pyplot as plt

opus_file = read_opus('file.0')  # Returns an OPUSFile class

opus_file.print_parameters()  # Pretty prints all metadata in the file to the console

if 'a' in opus_file.data_keys:  # If absorbance spectra was extracted from file
    plt.plot(opus_file.a.x, opus_file.a.y)  # Plot absorbance spectra
    plt.title(opus_file.sfm + ' - ' + opus_file.snm)  # Sets plot title to Sample Form - Sample Name
    plt.show()  # Display plot

Known Limitations

  • I have only tested this on ~5000 files generated in my lab (all very similiar) as well as a handful of files I've found online (most of which had some error when being read by other tools). This package is capable of reading all of those files, but thorough testing on a wide variety of files is incomplete.

    • If you have a file that cannot be read by brukeropus, please open an issue with a description about the file and what seems to be failing. Also provide a link for me to download the file. Make sure the file can be read by OPUS first (i.e. if the file is corrupted and unreadable by OPUS then brukeropus will not be able to read it either).

Controlling OPUS Software

brukeropus can send commands and perform queries to an OPUS software instance through the DDE communication protocol. OPUS must be open and logged in on the same PC where brukeropus is called from to operate.

Features

  • Initiate a sample or reference measurement
  • Change/define measurement parameters prior to performing measurement (useful for sweeping parameters like aperture size, mirror velocity, etc.)
  • Send commands for interacting with motors and other accessories (e.g. moving mirrors, rotating polarizers, etc.)
  • Control vacuum operation for vacuum-equipped spectrometers (e.g. Vertex 80V FTIR)
  • Unload files from OPUS software (so they can be unlocked for moving, renaming, etc.)

Usage

from brukeropus import opus, read_opus
from matplotlib import pyplot as plt

opus = Opus()  # Connects to actively running OPUS software

apt_options = opus.get_param_options('apt') # Get all valid aperture settings

for apt in apt_options[2:-2]: # Loop over all but the two smallest and two largest aperature settings
    filepath = opus.measure_sample(apt=apt, nss=10, unload=True) # Perform measurement and unload file from OPUS
    data = read_opus(filepath) # Read OPUS file from measurement
    plt.plot(data.sm.x, data.sm.y, label=apt) # Plot single-channel sample spectra
plt.legend()
plt.show()

Future Plans

  • Continue to improve the file reader towards 100% compliance.
  • Add additional control interface options (e.g. http or .dll)

Installation

Requirements

  • Python 3.6+
  • numpy

Optional

  • matplotlib (for plotting examples)

pip

pip install brukeropus

https://pypi.org/project/brukeropus/

Documentation

https://joshduran.github.io/brukeropus/brukeropus.html

Metadata

Release files for brukeropus 1.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brukeropus 1.4.3
File Size Uploaded
brukeropus-1.4.3.tar.gz 68.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brukeropus 1.4.3
File Interpreter ABI Platform
brukeropus-1.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 139.1 kB

Release files / brukeropus-1.4.3.tar.gz

Download URL brukeropus-1.4.3.tar.gz
Size 68.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0e67c27d6dcc8fbe06e8c56eec616aec9d55457ae06666520e7bcdc5c91b59cb
BLAKE2b-256 checksum
How to use checksums
3da2c132b13b718ef926d96f66ec05b5fec2feb29d8d717f6a110fce0c036ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release files / brukeropus-1.4.3-py3-none-any.whl

Download URL brukeropus-1.4.3-py3-none-any.whl
Size 70.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
428b275158182c74adf106ffc9ad2e48c85825032b4c4997c070a21fa753c528
BLAKE2b-256 checksum
How to use checksums
9914ffc40f49847bb9eb60c304d54e1f6fe07cd6cbf486703ed5dea81620af1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.18

Release history Release notifications | RSS feed

This release

1.4.3 This release

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4

2 release files

1.3.1

2 release files

1.3

2 release files

1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page