Skip to main content

A package to convert Brillouin spectra to a HDF5 file

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.3.tar.gz (5.4 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.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hdf5_bls-0.0.3.tar.gz
  • Upload date:
  • Size: 5.4 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.3.tar.gz
Algorithm Hash digest
SHA256 e45405ae99afc9f7a59106ab32f1f221cdeaf0e32425e63a7400474b78a29136
MD5 2d05891365faf666be0b1706f30fdbe7
BLAKE2b-256 2decd06badacf1abd082610e89bfc0275d4cbed47cf23bb169f5cd8f2b04a742

See more details on using hashes here.

File details

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

File metadata

  • Download URL: HDF5_BLS-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c57166ea3a783d812c392cbdc9fa2d42aa5ad81989ae7db16e0068db9c99078d
MD5 426ed71a1cddaa297b3f2c73381916c7
BLAKE2b-256 521331194d86a9c9fe6f14f09a6a72f4b1fda2d9d29793e5d8eed19b3cd41ca1

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