Skip to main content

Bluelake data analysis tools

Project description

Lumicks pylake

Build Status Documentation Status

This Python package includes data analysis tools for Bluelake HDF5 data.


For general use, all you need to do is enter the following on the command line:

pip install lumicks.pylake

To upgrade to the latest version:

pip install -U lumicks.pylake

Reading HDF5 files

from lumicks import pylake

h5file = pylake.File("example.h5")

FD curves

import matplotlib.pyplot as plt

# Plot all FD curves in a file
for name, fd in h5file.fdcurves.items():

# Pick a single FD curve
fd = h5file.fdcurves["name"]
# By default, the FD channel pair is `downsampled_force2` and `distance1`
fd.with_channels(force='1x', distance='2').plot_scatter()

# Access the raw data: defaults
force = fd.f
distance = fd.d
# Access the raw data: specific
force = fd.downsampled_force1y
distance = fd.distance2

# Plot manually: FD curve
# Plot manually: force timetrace

# By default `f` is `downsampled_force2` and `d` is `distance1`
altenative_fd = fd.with_channels(force='1x', distance='2')

# Baseline subtraction
fd_baseline = h5file.fdcurves["Baseline"]
fd_measured = h5file.fdcurves["Measurement"]
fd = fd_measured - fd_baseline

Force vs. time

# Simple force plotting

# Accessing the raw data
f1x_data =
f1x_timestamps = h5file.force1x.timestamps
plt.plot(f1x_timestamps, f1x_data)

Slicing data channels

# Take the entire channel
everything = h5file.force1x

# Get the data between 1 and 1.5 seconds
part = h5file.force1x['1s':'1.5s']
# Or manually
f1x_data =
f1x_timestamps = part.timestamps
plt.plot(f1x_timestamps, f1x_data)

# More slicing examples
a = h5file.force1x[:'-5s']  # everything except the last 5 seconds
b = h5file.force1x['-1m':]  # take the last minute
c = h5file.force1x['-1m':'-500ms']  # last minute except the last 0.5 seconds
d = h5file.force1x['1.2s':'-4s']  # between 1.2 seconds and 4 seconds from the end
e = h5file.force1x['5.7m':'1h 40m']  # 5.7 minutes to an hour and 40 minutes

Scans and kymographs

The following code uses kymographs as an example. Scans work the same way -- just substitute h5file.kymos with h5file.scans.

# Plot all kymographs in a file
for name, kymo in h5file.kymos.items():

# Pick a single kymograph
kymo = h5file.kymos["name"]
# Plot a single color channel

# Access the raw image data
rgb = kymo.rgb_image  # matrix
blue = kymo.blue_image
# Plot manually

# Low-level raw data
photons = kymo.red_photons

# Saving photon counts to TIFF
scan = h5file.scans["name"]

# A scan can have multiple frames
print(scan.blue_image.shape)  # (self.num_frames, h, w) -> single color channel
print(scan.rgb_image.shape)  # (self.num_frames, h, w, 3) -> three color channels

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lumicks.pylake, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size lumicks.pylake-0.4.0-py3-none-any.whl (41.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size lumicks.pylake-0.4.0.tar.gz (31.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page