Releases: lumicks/pylake
Releases Β· lumicks/pylake
v1.6.0
New features
- Calibration results and parameters are now accessible via properties which are listed when items are printed. See calibration results and calibration item API documentation for more information.
- Added property
diode_calibration
to access the diode calibration model, andtrap_power
to access the used trap power in calibration item. See the new tutorial and theory for more information. - Added model to correct for bead-bead coupling when using active calibration deep in bulk with two beads. See tutorial, theory and example for more information.
- Added option to highlight a region on a time plot using
Slice.highlight_time_range()
. For more information see the tutorial. - Added
__array__
toSlice
. This allows passing slices directly tonumpy
functions such asnp.mean()
ornp.sum()
. - Added parameter
allow_overwrite
tolk.download_from_doi()
to allow re-downloading only those files where the checksum does not match. - Added force calibration information to channels accessed directly via the square bracket notation (e.g.
file["Force HF"]["Force 1x"].calibration
). - Added
applied_at
property to a calibration item obtained from a force slice. This property returns the timestamp in nanoseconds at which the force calibration was applied. - Added parameter
titles
to customize the title of each subplot inKymo.plot_with_channels()
. - Added
KymoTrack.sample_from_channel()
to downsample channel data to the time points of a kymotrack. - Added support for file names with spaces in
lk.download_from_doi()
. - Show the ranges that were excluded from a power spectrum or calibration fit by passing
show_excluded=True
toPowerSpectrum.plot()
orCalibrationResults.plot()
. - Plot the active calibration peak for a calibration result using
show_active_peak=True
withCalibrationResults.plot()
. - Added function to import a
KymoTrackGroup
from aCSV
file usingload_tracks
. - Added function to load tracks into the kymotracker widget using
KymoWidgetGreedy.load_tracks()
.
Improvements
- Added improved printing of calibration items under
channel.calibration
providing a more convenient overview of the items associated with aSlice
. - Added improved printing of calibrations performed with
Pylake
. - Improved
FdFit
error message that includes the name of the model when trying to access a model that was not added in anFdFit
using angular brackets. - Allow customizing the minimum step size during step size determination for
DwelltimeModel.profile_likelihood()
and set a more sensible default. Also ensured that the warning only gets emitted at most once per direction.
Bug fixes
- Fixed bug that prevented opening the force distance widgets when using them with the
widget
backend onmatplotlib >= 3.9.0
. - Ensure that operators such as (e.g.
+
,-
,/
) work onSlice
with all types that are convertible to scalars. Previously these failed with zero dimensional numpy arrays and other convertible objects. - Fixed a bug where bead edge determination could fail with an unhandled exception during background estimation. This raised a
np.linalg.LinAlgError
when determining the background failed rather than the expectedRuntimeError
. In this case, a simple median is used as a fallback option. - Fixed a bug to ensure that
lk.GaussianMixtureModel
can also be used with a single state. - Fixed a bug that could result in a near
0/0
during fitting when components of aDwelltimeModel
are near zero. Note that these only occurred during the computation of the model derivatives during the fitting procedure and should not impact the model simulation itself.
v1.5.3
Bug fixes
- Fixed a bug where an inverted force-distance
Model
would raise when called with a scalar value. Now it just returns the expected value. - Fixed a bug that would lead to a division by zero warning when performing no color adjustment on a
Scan
orKymo
with zero photon counts. - Fixed a bug resulting in an exception when trying to read the excitation powers from a confocal object using
Kymo.red_power
,Kymo.green_power
,Kymo.blue_power
,Kymo.sted_power
.
Other changes
- Added support for python
3.13
. Removed upper bound onnumpy
version.
v1.4.2
Changelog
- Added a fallback which allows loading scans or kymographs that have truncated photon count channels.
- Fixed a bug resulting in an exception when trying to read the excitation powers from a confocal object using
Kymo.red_power
,Kymo.green_power
,Kymo.blue_power
,Kymo.sted_power
.
v1.5.2
Improvements
- Added a fallback which allows loading scans or kymographs that have truncated photon count channels.
Bug fixes
- Fixed bug that prevented opening the kymotracking widget when using it with the
widget
backend onmatplotlib >= 3.9.0
. - Fixed bug where photon counts were not being loaded from a csv file generated with the kymotracker.
v1.4.1
Bug fixes
- Fixed statistical backing returning an incorrect value.
- Fixed bug that prevented loading an
h5
file where only a subset of the photon channels are available. This bug was introduced in Pylake1.4.0
.
v1.5.1
- Fixed bug that prevented loading an h5 file where only a subset of the photon channels are available. This bug was introduced in Pylake 1.4.0.
v1.5.0
New features
- Support Python
3.12
, dropped support for3.9
. - Added
Kymo.plot_with_channels()
for plotting a kymograph with corresponding channel data. For more information, please refer to the kymograph tutorial. - Added option to disable downsampling channel data to frame rates with correlated plots (
ImageStack.plot_correlated()
,Scan.plot_correlated()
) and exported videos (ImageStack.export_video()
,Scan.export_video()
) usingdownsample_to_frames=False
. - Added
err_kappa
anderr_Rd
to force calibration results. These contain error estimates for the calibration constants propagated from the fitting errors. - Added support for loading two-color
TIF
files withImageStack
. - Made
CalibrationResults
callable to evaluate the fitted model power spectral density at the specified frequencies. - Added
fitted_params
field toCalibrationResults
for convenience. - Allow accessing
Model
default parameters for a force-distance model by key (i.e.model["m/Lc"]
).
Improvements
- Added error message when parameters are passed to
lk.parameter_trace()
that do not have the required attributes. - Warn when parameter estimates are hitting the fitting bounds when using
lk.parameter_trace()
.
Other changes
- Switch to notebook v7 with
ipympl
. Note that this means that you have to have to invoke%matplotlib widget
in notebooks where you previously used%matplotlib notebook
. See the jupyter notebook 7 announcement for more information.
Bug fixes
- Fixed statistical backing returning an incorrect value.
- Fixed bug where the
start_frame
parameter was being ignored when exporting a movie withImageStack.export_video()
andScan.export_video()
. This bug was introduced in Pylakev1.3.0
.
v1.4.0
New features
- Added
lk.HiddenMarkovModel
for classifying data traces exhibiting transitions between discrete states. For more information, see the tutorials section on Population Dynamics. - Added option to crop beads out of a kymograph using
Kymo.crop_beads()
. - Added API to determine bead edges in a kymograph using
Kymo.estimate_bead_edges()
. - Added
emission_path()
andplot_path()
methods tolk.GaussianMixtureModel
- Added option to
File
to pass a custom mapping from Photon count detector to RGB colors colors. This is useful to reconstruct images on systems with non-standard imaging modules. - Added option to customize the filter width of the Gaussian filter that is applied prior to spot detection in
lk.track_greedy()
. Increasing this value results in fewer false detections at the cost of resolution. Note that the current default is set to half a pixel to preserve the old behavior. - Added option to determine the viscosity and density of water with NaCl dissolved in it using
lk.viscosity_of_water()
andlk.density_of_water()
. - Added
ImageStack.close()
to force close file handles. Note that this prohibits further access to images from theImageStack
it is called on, but also anyImageStack
derived from it (i.e. throughImageStack.define_tether()
orImageStack.crop_by_pixels()
). - Added option to filter kymograph spot detections where there are no detections in adjacent frames using
adjacency_filter=True
inlk.track_greedy()
. - Add option to
include_dead_time
toImageStack.plot_correlated()
forScan
andImageStack
. This parameter defaults toTrue
.
Bug fixes
- Fixed a bug where the time indicator was off by one frame in
ImageStack.plot_correlated()
andImageStack.export_video()
. - Fixed a bug where the time between frames was incorrectly not excluded when calling
ImageStack.frame_timestamp_ranges()
withinclude_dead_time=False
. Note thatScan
andKymo
are not affected. - Fixed a bug where
ImageStack.plot_correlated()
was not excluding the dead time between frames. - Fixed a bug where color adjustments on a single channel
ImageStack
would not be applied unless a channel was provided as argument. This bug was introduced inv1.3.0
. - Changed the
DateTime
tag on TIFFs exported with Pylake fromScan
andKymo
objects. Before the change, the start and end of the scanning period in nanoseconds was stored. After the change, we store the starting timestamp of the frame, followed by the starting timestamp of the next frame to be consistent with data exported from Bluelake. The scanning time is stored in the fieldExposure time (ms)
on the Description tag. - Fixed tests to be compatible with
pytest>=8.0.0
. - Ensure
in
returnsTrue
for a valid data path (e.g."Force HF/Force 1x" in file
should returnTrue
).
Improvements
ImageStack
now closes any file handles it has open upon garbage collection.
Deprecations
- Deprecated
GaussianMixtureModel.from_channel()
. The class constructor now acceptsSlice
instances directly. - Deprecated
GaussianMixtureModel.label()
. UseGaussianMixtureModel.state_path()
instead. Note, the returned instance is typeSlice
rather thannp.ndarray
. The data can be accessed viamodel.state_path(channel_slice).data
. - Deprecated
GaussianMixtureModel.exit_flag
UseGaussianMixtureModel.fit_info()
instead. Note, the returned instance is aGmmFitInfo
dataclass with attributes matching the keys of thedict
returned fromexit_flag
(along withbic
andaic
; see next point). - Deprecated
GaussianMixtureModel.bic
andGaussianMixtureModel.aic
properties. These values can now be accessed via thebic
andaic
properties ofGaussianMixtureModel.fit_info
.
Breaking changes (alpha functionality)
trace_kwargs
andlabel_kwargs
are now keyword-only arguments forGaussianMixtureModel.plot()
.
Other changes
- Bump
tifffile
dependency to>=2022.7.28
.
v1.3.1
Bug fix
- Fixed a bug in
Scan.export_video()
andImageStack.export_video()
which resulted in empty frames being written when exporting with channel data.
v1.3.0
New features
- Added option to export
ImageStack
andScan
stacks to movies correlated with channel data. Simply pass aSlice
to thechannel_slice
parameter ofScan.export_video()
orImageStack.export_video()
. - Added more options for plotting color channels for images:
- Shortcuts
"r"
,"g"
, and"b"
can now be used for plotting single color channels in addition to"red"
,"green"
, and"blue"
. - Two-channel visualizations can be plotted using
"rg"
,"gb"
, or"rb"
.
- Shortcuts
- Added option to filter tracks by duration in seconds using
lk.filter_tracks(tracks, minimum_duration=duration_in_seconds)
. - Added option to align plots vertically by passing
vertical=True
toScan.plot_correlated
andImageStack.plot_correlated()
. - Added
duration
property toKymoTrack
which returns the duration (in seconds) that the track was observed. - Added
KymoTrackGroup.filter()
to filter tracks in-place.tracks.filter(minimum_duration=2)
is equivalent totracks = lk.filter_tracks(tracks, minimum_duration=2)
.
Bug fixes
- Fixed a bug in
Scan.plot()
in which the default aspect ratio was calculated such that pixels always appeared square. For scans with non-square pixel sizes, this would result in distortion of the image. - Fixed a bug in
Slice.downsampled_like
that would fail to raise an error due to a lack of overlap between the low frequency and high frequency channel when the high frequency channel starts within the last sample of the low frequency channel. - Fixed
lk.download_from_doi()
to align with new Zenodo REST API. - Don't store animation writer in a temporary variable as this results in a
matplotlib
error when attempting to export a movie on jupyter notebook.
Improvements
- Kymographs consisting of a single scan line now return a valid
line_time_seconds
. This allows certain downstream functionality, such asKymo.plot()
. - Issue a more descriptive error when attempting to compute a diffusion constant of a track with no points.
- Pylake can now handle kymographs that were erroneously stored in the
Scan
field. Kymographs with a pre-specified number of lines to record were incorrectly being marked on the timeline and exported asScan
instead ofKymograph
in versions of Bluelake prior to2.5.0
.