A package to unify the storage of Brillouin Light Scattering related data in HDF5 files
Project description
HDF5_BLS
HDF5_BLS is a Python library for storing Brillouin Light Scattering (BLS) data into a standardized HDF5 file 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: dat spectra obtained with:
- GHOST software
- Time Domain measures (format defined by Sal La Cavera)
- "*.npy" files: a numpy file
- "*.sif" files: image files obtained with Andor cameras
- All image files supported by the Pillow library (see this link)
Quickstart
Library installation
You can install HDF5_BLS directly from PyPI:
pip install HDF5_BLS
Please refer to the tutorial for more information.
Integration to workflow
Once the package is installed, you can use it in your Python scripts as follows:
import HDF5_BLS as bls
# Create a HDF5 file
wrp = bls.Wrapper(filepath = "path/to/file.h5")
###############################################################################
# Existing code to extract data from a file
###############################################################################
# Storing the data in the HDF5 file (for this example we use a random array)
data = np.random.random((50, 50, 512))
wrp.add_raw_data(data = data, parent_group = "Brillouin", name = "Raw data")
###############################################################################
# Existing code to convert the data to a PSD
###############################################################################
# Storing the Power Spectral Density in the HDF5 file together with the associated frequency array (for this example we use random arrays)
PSD = np.random.random((50, 50, 512))
frequency = np.arange(512)
wrp.add_PSD(data = PSD, parent_group = "Brillouin", name = "Power Spectral Density")
wrp.add_frequency(data = frequency, parent_group = "Brillouin", name = "Frequency")
###############################################################################
# Existing code to fit the PSD to extract shift and linewidth arrays
###############################################################################
# Storing the Power Spectral Density in the HDF5 file together with the associated frequency array (for this example we use random arrays)
shift = np.random.random((50, 50))
linewidth = np.random.random((50, 50))
wrp.add_treated_data(parent_group = "Brillouin", name_group = "Treat_0", shift = shift, linewidth = linewidth)
Extracting the data from the HDF5 file
Once the data is stored in the HDF5 file, you can extract it as follows:
import HDF5_BLS as bls
# Open the file
wrp = bls.Wrapper(filepath = "path/to/file.h5")
# Extract the data
data = wrp["Brillouin/path/in/file/Raw data"]
GUI
To faciliate the use of the package, we have interfaced it with a GUI also accessible in this repository. The GUI is now capable of:
- Creating HDF5 files following the structure of v1.0:
- Structure the file in a hierarchical way
- Import measure data (drag and drop functionality implemented)
- Import attributes from a CSV or Excel spreadsheet file (drag and drop functionality implemented)
- Modify parameters of data both by group and individually from the GUI
- Inspect existing HDF5 files and in particular, ones made with the HDF5_BLS package
- Export sub-HDF5 files from meta files
- Export Python or Matlab code to access individual datasets
- Visualize 2D arrays as images
- Analyze raw spectra obtained with a VIPA spectrometer
- Develop new algorithms for the analysis of raw spectra
Library
Documentation
You can access the documentation of the project at this link. Additionnally, a ReadTheDocs documentation for the library is accessible at this link.
Contributing
A Developper Guide is accessible at this link. This guide is meant to be used by researchers who want to expand the project to their own devices while keeping the compatibility with all the existing functionalities.
For changes that might affect the compatibility of the project with existing devices, please open an issue first to discuss what you would like to change. For more information, please refer to CONTRIBUTING.md.
License
What's new with respect to previous versions?
v1.0.2
- WrapperErrors are now included in the wrapper script
- Bug fix in the export of groups as independent HDF5 files
- Ability to export to Brim files
v1.0.1
- New "add_other" method to add datasets from non-specified type to the wrapper
- Working with temporary files: Instead of creating a temporary H5 file in the directory of the library, the file is now created in a temporary directory of the OS.
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-1.0.2.tar.gz.
File metadata
- Download URL: hdf5_bls-1.0.2.tar.gz
- Upload date:
- Size: 66.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd02eecfd3064c8c985c1beaeac0ec370a59c0735a7318cafd2249dff96c9ef8
|
|
| MD5 |
60e9da92606db9a7fc214db96423997a
|
|
| BLAKE2b-256 |
a464a90c48eb833af4bdadbdaf54d380769fd6bf2717e5d781e3d1c36fa58745
|
File details
Details for the file hdf5_bls-1.0.2-py3-none-any.whl.
File metadata
- Download URL: hdf5_bls-1.0.2-py3-none-any.whl
- Upload date:
- Size: 61.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d3ba3f6a838e191d23b514b3c19d49cae693576e7302cc74a8d43f776dbb51b
|
|
| MD5 |
caf8bc09c9f9aeec684c759d3eff0b5e
|
|
| BLAKE2b-256 |
d346f21eb3134cf61894558915fd334333b0d62ed125092394078166c877204a
|