FdCurve

lumicks.pylake.fdcurve.FdCurve

class FdCurve(file, start, stop, name, force='2', distance='1')

An FD curve exported from Bluelake

By default, the primary force and distance channels are downsampled_force2 and distance1. Alternatives can be selected using FdCurve.with_channels(). Note that it does not modify the FD curve in place but returns a copy.

Note

The default channel downsampled_force2 is the total force on trap 2, e.g. \(\sqrt{F_{2, x}^2 + F_{2, y}^2}\)

Examples

import lumicks.pylake as lk
f = lk.File("fdcurves.h5")

# Show FdCurve "1"
fd_curve = f.fdcurves["1"]
fd_curve.plot()

# Make a new F,d curve based on the `start` and `stop` time of FdCurve "1", but only include
# the x-component of the force on trap 2
fd_curve = fd_curve.with_channels("2x", distance="1")
file

The parent file. Used to look up channel data.

Type:

lumicks.pylake.File

start, stop

The time range (ns) of this FD curve within the file.

Type:

int

name

The name of this FD curve as it appeared in the timeline.

Type:

str

distance_range_selector(show=True, max_gap=0) FdDistanceRangeSelectorWidget

Open a widget for selecting data ranges by distance.

Please refer to the tutorial for more information.

Actions:
  • left-click – Define distance ranges by clicking the left and then the right boundary of the region you wish to select.

  • right-click – Remove previously selected distance range.

Parameters:
  • show (bool, optional.) – Show the widget. Default is True.

  • max_gap (int, optional) – Sometimes the distance bounds are exceeded by short sections of data due to noise. The max_gap parameter controls how many data points have to exceed the threshold to be considered not part of the slice. Default is 0.

Return type:

FdDistanceRangeSelectorWidget

plot_scatter(**kwargs)

Plot the FD curve points

Parameters:

**kwargs – Forwarded to matplotlib.pyplot.scatter().

range_selector(show=True) FdTimeRangeSelectorWidget

Open a widget used to select ranges from force extension curves.

Please refer to the tutorial for more information.

Actions:
  • left-click – Define time ranges by clicking the left and then the right boundary of the region you wish to select.

  • right-click – Remove previously selected time range.

Parameters:

show (bool, optional) – Show the widget. Default is True.

Return type:

FdTimeRangeSelectorWidget

with_baseline_corrected_x()

Return a copy of this F,d curve with baseline correction applied to force channel. Note: only the x component is available with baseline correction. Note: All previous data manipulations (eg. subtraction of another curve) will be lost.

with_channels(force, distance)

Return a copy of this FD curve with different primary force and distance channels

Parameters:
  • force (str) – Force channel to use (i.e. “1”, “2”, “1x”, “1y”).

  • distance (str) – Distance channel to use (i.e. “1”, “2”).

Return type:

FdCurve

Examples

import lumicks.pylake as lk
f = lk.File("fdcurves.h5")

# Grab the FdCurve with the name "1"
fd_curve = f.fdcurves["1"]

# Make a new F,d curve based on the start and stop time of FdCurve "1" but only include
# the x-component of the force on trap 2
fd_curve = fd_curve.with_channels("2x", distance="1")
with_offset(force_offset=0, distance_offset=0)

Add a constant force offset from the force data in this F,d curve. Note that points where the distance is defined as zero are ignored and that subtracting a distance offset bigger than the minimum distance in the F,d curve will result in an error.

Parameters:
  • force_offset (float) –

  • distance_offset (float) –

property d

The primary distance channel associated with this FD curve

property f

The primary force channel associated with this FD curve