Skip to main content

A project for reading spectra from Avantes AvaSoft files in python

Project description

AvaRead

DOI GitHub License GitHub Workflow Status build GitHub Workflow Status docs PyPI - Version PyPI - Python versions PyPI - Downloads Ruff Hatch project

A project for reading spectra from Avantes AvaSoft 8 files in Python.

It supports all Avantes multichannel files (e.g. .raw8, .rir8, etc.), reading all avaible channels, as well as store-to-RAM/multiframe files (.str8).

Importantly, this means you can work with these files directly in your analysis!

  • No need to convert your .raw8 (or equivalent files) to work with them

  • No need to convert your .str8 into large sets of files with very similar names!

Installing

AvaRead can be easily installed with pip and only has numpy as a dependency, which will be installed if missing.

You can install the latest release from PyPI:

pip install avaread

To install the latest development version from GitHub, you can use:

pip install git+https://github.com/AntoineTUE/avaread.git

How to use

Using avaread is fairly straightforward, you should be fine with using the read_file function to open any Avantes AvaSoft 8 file.

Depending on the detected file type, you will either receive an instance of AVSFile or STRFile, which are iterable, container-like objects that give you access to the data and metadata read from the file.

Most of the data is stored as numpy.ndarrays under the hood.

Note that these files store data differently:

  • AVSFile stores data from multiple devices (or channels), one spectrum per device, which can be of different shape.
  • STRFile stores multiple spectra recorded in sequence by a single device (or channel).

See also the documentation for more details and examples.

import avaread
from avaread.reader import AVSFile, STRFile
from pathlib import Path
import matplotlib.pyplot as plt

file1 = Path("path/to/file1.raw8")
file2 = Path("path/to/file2.str8")

data1 = avaread.read_file(file1)
data2 = avaread.read_file(file2)

assert isinstance(data1, AVSFile)
assert isinstance(data2, STRFile)

plt.figure()
# Plot the different channels stored in the `AVSFile`
for channel in data1:
    plt.plot(channel.wavelength, channel.signal, label=f"{channel.ID.SerialNumber}")

plt.figure()
# Plot the different frames stored in the `STRFile`
for i, frame in enumerate(data2):
    plt.plot(data2.wavelength, frame, label=f"Delay: {data2.delay[i]} ms")

License

AvaRead is licensed under the MIT license.

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avaread-0.2.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avaread-0.2.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file avaread-0.2.0.tar.gz.

File metadata

  • Download URL: avaread-0.2.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avaread-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b49d4ceeae9508760120e4c1789288edb7bde7aa2cd21068ae56aadd47240ded
MD5 a7e8e2ebcbfd09c00170bb9089a81fb3
BLAKE2b-256 737e3c790a53874875629b3513b3d2543a146df0ca5091a1aa45fcb3f5a8440b

See more details on using hashes here.

Provenance

The following attestation bundles were made for avaread-0.2.0.tar.gz:

Publisher: build.yml on AntoineTUE/avaread

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file avaread-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: avaread-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avaread-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af50e3bcc4c05744147a3511d9eb2e71dc0e9bedc666d239f1ccd17925ce4952
MD5 ad669722d80cc44ef579a4055daf6f17
BLAKE2b-256 feac270db503e6f1a1675f9b864c1c04952bfd2f0ba9386ad0f18b9b9984c10d

See more details on using hashes here.

Provenance

The following attestation bundles were made for avaread-0.2.0-py3-none-any.whl:

Publisher: build.yml on AntoineTUE/avaread

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page