lumicks.pylake.File¶
-
class
File
(filename)¶ A convenient HDF5 file wrapper for reading data exported from Bluelake
Parameters: - filename : str
The HDF5 file to open in read-only mode
Examples
from lumicks import pylake file = pylake.File("example.h5") file.force1x.plot() file.kymos["name"].plot()
-
__init__
(filename)¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(filename)Initialize self. from_h5py
(h5py_file)Directly load an existing h5py.File
save_as
(filename[, compression_level, omit_data])Write a modified h5 file to disk. Attributes
SUPPORTED_FILE_FORMAT_VERSIONS
blue_photon_count
blue_photon_time_tags
bluelake_version
The version of Bluelake which exported this file corrected_force1x
corrected_force2x
description
The description of the measurement as entered by the user in Bluelake distance1
distance2
downsampled_force1
downsampled_force1x
downsampled_force1y
downsampled_force2
downsampled_force2x
downsampled_force2y
downsampled_force3
downsampled_force3x
downsampled_force3y
downsampled_force4
downsampled_force4x
downsampled_force4y
experiment
The name of the experiment as entered by the user in Bluelake export_time
The moment this file was exported fdcurves
force1x
force1y
force2x
force2y
force3x
force3y
force4x
force4y
format_version
The version of the Bluelake-specific HDF5 file structure green_photon_count
green_photon_time_tags
guid
An ID which uniquely identifies each exported file kymos
markers
point_scans
red_photon_count
red_photon_time_tags
scans
-
__getitem__
(item)¶ Return a subgroup or a bluelake timeline channel
-
classmethod
from_h5py
(h5py_file)¶ Directly load an existing
h5py.File
-
save_as
(filename, compression_level=5, omit_data={})¶ Write a modified h5 file to disk.
When transferring data, it can be beneficial to omit some channels from the h5 file, or use a higher compression ratio. High frequency channels tend to take up a lot of space and aren’t always necessary for every single analysis. It is also worth mentioning that Bluelake exports files at compression level 1 for performance reasons, so this function can help reduce the file size even when no data is omitted.
Parameters: - filename : str
Output file name.
- compression_level : int
Compression level for gzip compression (default: 5).
- omit_data : Set[str]
Which data sets to omit. Should be a set of h5 paths (e.g. {“Force HF/Force 1y”}).
fnmatch
patterns are used to specify which fields to omit, which means you can use wildcards as well (see examples below).
Examples
import lumicks.pylake as lk file = lk.File("example.h5") file.save_as("smaller.h5", compression_level=9) # Saves a file with a high compression level file.save_as("no_hf.h5", omit_data={"Force HF/*"}) # Omit high frequency force data. file.save_as("no_hf.h5", omit_data={"*/Force 1y"}) # Omit Force 1y data file.save_as("no_1y.h5", omit_data={"Force HF/Force 1y"}) # Omit high frequency force data for channel 1y
-
bluelake_version
¶ The version of Bluelake which exported this file
-
description
¶ The description of the measurement as entered by the user in Bluelake
-
experiment
¶ The name of the experiment as entered by the user in Bluelake
-
export_time
¶ The moment this file was exported
-
format_version
¶ The version of the Bluelake-specific HDF5 file structure
-
guid
¶ An ID which uniquely identifies each exported file