Skip to main content

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.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

GNU-GPL v3.0

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-1.0.1.tar.gz (59.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-1.0.1-py3-none-any.whl (61.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hdf5_bls-1.0.1.tar.gz
  • Upload date:
  • Size: 59.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for hdf5_bls-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e3f325add0e2e67e59359f9d77070ab23673715647240806f878288389492539
MD5 a263eaee376e7d2d90b4559730fe35f7
BLAKE2b-256 0e307116dc754f623bb45676d435971e214caa5914a818b1d5897e9fc351e528

See more details on using hashes here.

File details

Details for the file hdf5_bls-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hdf5_bls-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 61.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for hdf5_bls-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43eeedc0a0b65180e3baeba8903f7e87ce20fa1a96907f79e2d9dd840a80af2c
MD5 48cdf4a206dbe75361dbfab0898511c4
BLAKE2b-256 6c087b6efbbe2689a8a7c5381cd552fc2190cf3aa3c2fb54e4db65d980971c07

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