Python package for reading Bruker OPUS files.
Go to file
William Wu d2a22afde7
Merge pull request #6 from thanakijwanavit/patch-1
Add installation with pip instruction
2019-07-13 11:12:51 +02:00
brukeropusreader version bump to 1.2 2018-11-26 10:10:34 +01:00
tests * Unused functions removed 2018-10-31 12:15:00 +01:00
.gitignore Moving bruker opus reader to python 3 2017-10-10 16:52:26 +02:00
LICENSE.txt Preparing package 2018-07-11 00:20:47 +02:00
README.md Add installation with pip instruction 2019-07-13 16:11:47 +07:00
example.py * Unused functions removed 2018-10-31 12:15:00 +01:00
requirements.in Minimal version requirements in setup.py and exhaustive listing of pinned versions in requirements.txt. Added matplotlib 2019-02-19 11:16:16 +01:00
requirements.txt Minimal version requirements in setup.py and exhaustive listing of pinned versions in requirements.txt. Added matplotlib 2019-02-19 11:16:16 +01:00
setup.py Minimal version requirements in setup.py and exhaustive listing of pinned versions in requirements.txt. Added matplotlib 2019-02-19 11:16:16 +01:00

README.md

Bruker OPUS Reader

Introduction

The brukeropusreader Python package enables reading the binary OPUS files generated by Bruker spectrometers.

Installation

Install with pip

pip install brukeropusreader

Usage

read_file parses OPUS file and returns OpusData object:

from brukeropusreader import read_file

opus_data = read_file('opus_file.0')

OpusData consists of three fields wave_nums, spectrum and meta:

print(f'Dimension of data: '
      f'{len(opus_data.wave_nums)}')

print(f'Spectrum range: ['
      f'{min(opus_data.spectrum)}; '
      f'{max(opus_data.spectrum)}]')

print(f'Metadata: '
      f'{opus_data.meta}')

Spectrum can be plotted with matplotlib library:

plt.plot(opus_data.wave_nums, opus_data.spectrum)
plt.show()

For full code see example.

Structure of OPUS files

OPUS files consist of several series of spectra. Each series is described by a few parameters:

  • NPT (number of points)
  • FXV (value of first wavelength)
  • LXV (value of last wavelength)
  • END (address of spectra series)

These parameters are found by searching for ASCII strings in the binary files. After finding a match with one of these parameters, we move the pointer a few bytes further to read the values. Unfortunately, there is no published open standard describing how much further the pointer should be moved. We empirically checked that this shift factor is 8 bytes for NPT, FXV, and LXV, and 12 bytes for END. In addition, each file contains some metadata about the hardware used for measurement.

Known issues

As Bruker's OPUS file format is not described openly, we do not know its exact structure. One problem is, given only a few series, how to decide which are absorption spectra? Our solution, empirically developed, is as follows:

  1. Remove broken series (such as ones where FXV > LXV, missing NPT information, etc.)
  2. Remove interferograms. (See simplerspec.) Interferograms have a starting value of 0.
  3. If after these two steps we still have more than one series left, choose the one with highest average value. We empirically verified that other series are usually random noise with values near 0.

Contact

For developer issues, please start a ticket in Github. You can also write to the dev team directly at brukeropusreader-dev@qed.ai. For other issues, please write to: brukeropusreader@qed.ai

License

Copyright (c) 2018 Quantitative Engineering Design. All rights reserved. This project is released under the terms of the AGPL license, which is included in LICENSE.txt.

-- QED | https://qed.ai