Skip to main content

A package to convert Brillouin spectra to a HDF5 file and use them

Project description

HDF5_BLS

HDF5_BLS is a Python library for handling Brillouin Light Scattering (BLS) data and converting it into a standardized HDF5 format. The library provides functions to open raw data files, define and import abscissa, add metadata, and save the organized data in HDF5 files. The library is currently compatible with the following file formats:

  • "*.DAT" files: spectra returned by the GHOST software
  • "*.TIF" files: an image format that can be used to export 2D detector images.

Features

  • Load raw BLS data from .DAT and .TIF files
  • Define or import abscissa values
  • Add calibration and impulse response curves to the HDF5 file
  • Attach metadata attributes for experimental setup and measurement details
  • Save data and metadata to an HDF5 file for standardized storage

Installation

You can install HDF5_BLS directly from PyPI:

pip install HDF5_BLS

Example

This example demonstrates a full workflow with HDF5_BLS, including loading data from a .DAT file, defining the abscissa, adding metadata, and saving it to an HDF5 file.

from HDF5_BLS import HDF5_BLS

# Initialize the HDF5_BLS object
bls = HDF5_BLS()

# Open raw data from a .DAT file and store it in the object
bls.open_data("example.DAT")

# Define an abscissa for the data
bls.define_abscissa(min_val=0, max_val=100, nb_samples=1000)

# Add metadata attributes describing the measurement and spectrometer settings
bls.properties_data(
    MEASURE_Sample="Water",
    MEASURE_Date="2024-11-06",
    MEASURE_Exposure=10,                  # in seconds
    MEASURE_Dimension=3,
    SPECTROMETER_Type="TFP",
    SPECTROMETER_Model="JRS-TFP2",
    SPECTROMETER_Wavelength=532.0,          # in nm
    SPECTROMETER_Illumination_Type="CW",
    SPECTROMETER_Spectral_Resolution=15.0,  # in MHz
)

# Load and add a calibration curve from a .DAT file (optional)
bls.open_calibration("calibration_curve.dat")

# Load and add an impulse response curve (optional)
bls.open_IR("impulse_response.dat")

# Save the data, abscissa, and metadata attributes to an HDF5 file
bls.save_hdf5_as("output_data.h5")

A full example where a treatment is implemented on a water spectrum is presented in the test directory.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

hdf5_bls-0.0.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

HDF5_BLS-0.0.5-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file hdf5_bls-0.0.5.tar.gz.

File metadata

  • Download URL: hdf5_bls-0.0.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for hdf5_bls-0.0.5.tar.gz
Algorithm Hash digest
SHA256 26d54dc618426106dfa641173e8c2d9ab4b017461d8be894de44c97b86d3e7af
MD5 32c02a62e54c7fe8658ef160f1eed791
BLAKE2b-256 f7f2995063241596f42a3c239ef467f44464a039c81192bac679f86faad245f0

See more details on using hashes here.

File details

Details for the file HDF5_BLS-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: HDF5_BLS-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for HDF5_BLS-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6aa028788b1e30fdc24500a7fddade4741adb47689ec0a7888f897f14ad5cbfc
MD5 e7fdcb5681017396464f635acedb28d8
BLAKE2b-256 593c8ea80495641827d7a897321581abfeb44e4e6fb14c80e130694372ae0a44

See more details on using hashes here.

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