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
.DATand.TIFfiles - 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hdf5_bls-0.0.4.tar.gz.
File metadata
- Download URL: hdf5_bls-0.0.4.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3bd1290fbc764dc22dd0f5186476d243a0c5a334bf0d832432765cba4bc1ed6
|
|
| MD5 |
d66aa77ebd4915ce1895338423e430a8
|
|
| BLAKE2b-256 |
785aae47c13c6d1acdb56acf4de62dfa01bc371a43739dd20c2072ae4061d64a
|
File details
Details for the file HDF5_BLS-0.0.4-py3-none-any.whl.
File metadata
- Download URL: HDF5_BLS-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33ec091c1d5101fb2f5cac9e4e9900242863659ab5963ed0774e18951cfc618c
|
|
| MD5 |
cf788bc2e8856d0ea13641dc53dda943
|
|
| BLAKE2b-256 |
f643c25653d4999e4e15bc4bead38a6943f42e841888668d93cac772783ef049
|