lumicks.pylake.kymo.Kymo

class Kymo(name, file, start, stop, json, position_offset=0, calibration=None)

A Kymograph exported from Bluelake

Parameters:
name : str

Kymograph name

file : lumicks.pylake.File

Parent file. Contains the channel data.

start : int

Start point in the relevant info wave.

stop : int

End point in the relevant info wave.

json : dict

Dictionary containing kymograph-specific metadata.

position_offset : float

Coordinate position offset with respect to the original raw data.

calibration : PositionCalibration

Class defining calibration from microns to desired position units.

__init__(name, file, start, stop, json, position_offset=0, calibration=None)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(name, file, start, stop, json[, …]) Initialize self.
calibrate_to_kbp(length_kbp) Calibrate from microns to other units.
crop_by_distance(lower, upper) Crop the kymo by position.
downsampled_by([time_factor, …]) Return a copy of this Kymograph which is downsampled by time_factor in time and position_factor in space.
from_dataset(h5py_dset, file) Construct a confocal class from dataset.
plot_blue(**kwargs) Plot an image of the blue photon channel
plot_green(**kwargs) Plot an image of the green photon channel
plot_red(**kwargs) Plot an image of the red photon channel
plot_rgb(**kwargs) Plot a full rbg kymograph image
plot_with_force(force_channel, color_channel) Plot kymo with force channel downsampled over scan lines
plot_with_position_histogram(color_channel) Plot kymo with histogram along position axis
plot_with_time_histogram(color_channel[, …]) Plot kymo with histogram along time axis
save_tiff(filename[, dtype, clip]) Save the RGB photon counts to a TIFF image

Attributes

blue_image
blue_photon_count
blue_power
center_point_um Returns a dictionary of the x/y/z center coordinates of the scan (w.r.t.
fast_axis
green_image
green_photon_count
green_power
has_fluorescence

Deprecated since version 0.8.0.

has_force

Deprecated since version 0.8.0.

infowave
json

Deprecated since version 0.8.0.

line_time_seconds Line time in seconds
pixels_per_line
pixelsize Returns a List of axes dimensions in calibrated units.
pixelsize_um Returns a List of axes dimensions in um.
red_image
red_photon_count
red_power
rgb_image
scan_width_um Returns a List of scan widths as configured in the Bluelake UI. The length of the list
size_um Returns a List of scan sizes in um along axes.
sted_power
timestamps Timestamps for image pixels, not for samples
__getitem__(item)

All indexing is in timestamp units (ns)

calibrate_to_kbp(length_kbp)

Calibrate from microns to other units.

Parameters:
length : float

length of the kymo in kilobase pairs

crop_by_distance(lower, upper)

Crop the kymo by position.

Crops the kymograph down to lower <= x < upper.

Parameters:
lower : float

Lower bound in physical units.

upper : float

Upper bound in physical units.

downsampled_by(time_factor=1, position_factor=1, reduce=<function sum>)

Return a copy of this Kymograph which is downsampled by time_factor in time and position_factor in space.

Parameters:
time_factor : int

The number of pixels that will be averaged in time (default: 1).

position_factor : int

The number of pixels that will be averaged in space (default: 1).

reduce : callable

The numpy function which is going to reduce multiple pixels into one. The default is np.sum.

classmethod from_dataset(h5py_dset, file)

Construct a confocal class from dataset.

Parameters:
h5py_dset : h5py.Dataset

The original HDF5 dataset containing confocal scan information

file : lumicks.pylake.File

The parent file. Used to loop up channel data

plot_blue(**kwargs)

Plot an image of the blue photon channel

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

plot_green(**kwargs)

Plot an image of the green photon channel

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

plot_red(**kwargs)

Plot an image of the red photon channel

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

plot_rgb(**kwargs)

Plot a full rbg kymograph image

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

plot_with_force(force_channel, color_channel, aspect_ratio=0.25, reduce=<function mean>, **kwargs)

Plot kymo with force channel downsampled over scan lines

Note that high frequency channel data must be available for this function to work.

Parameters:
force_channel: str

name of force channel to downsample and plot (e.g. ‘1x’)

color_channel: str

color channel of kymo to plot (‘red’, ‘green’, ‘blue’, ‘rgb’)

aspect_ratio: float

aspect ratio of the axes (i.e. ratio of y-unit to x-unit)

reduce : callable

The numpy function which is going to reduce multiple samples into one. Forwarded to Slice.downsampled_over()

**kwargs

Forwarded to Slice.plot().

plot_with_position_histogram(color_channel, pixels_per_bin=1, hist_ratio=0.25, **kwargs)

Plot kymo with histogram along position axis

Parameters:
color_channel: str

color channel of kymo to plot (‘red’, ‘green’, ‘blue’, ‘rgb’).

pixels_per_bin: int

number of pixels along position axis to bin together.

hist_ratio: float

width of the histogram with respect to the kymo image.

**kwargs

Forwarded to histogram bar plot.

plot_with_time_histogram(color_channel, pixels_per_bin=1, hist_ratio=0.25, **kwargs)

Plot kymo with histogram along time axis

Parameters:
color_channel: str

color channel of kymo to plot (‘red’, ‘green’, ‘blue’, ‘rgb’).

pixels_per_bin: int

number of pixels along time axis to bin together.

hist_ratio: float

height of the histogram with respect to the kymo image.

**kwargs

Forwarded to histogram bar plot.

save_tiff(filename, dtype=<class 'numpy.float32'>, clip=False)

Save the RGB photon counts to a TIFF image

Parameters:
filename : str

The name of the TIFF file where the image will be saved.

dtype : np.dtype

The data type of a single color channel in the resulting image.

clip : bool

If enabled, the photon count data will be clipped to fit into the desired dtype. This option is disabled by default: an error will be raise if the data does not fit.

center_point_um

Returns a dictionary of the x/y/z center coordinates of the scan (w.r.t. brightfield field of view)

has_fluorescence

Deprecated since version 0.8.0: By definition, confocal images always have fluorescence data.

has_force

Deprecated since version 0.8.0: This property is always False and therefore not needed.

json

Deprecated since version 0.8.0: Access to raw metadata will be removed in a future release. Use accessor properties instead. (see docs)

line_time_seconds

Line time in seconds

pixelsize

Returns a List of axes dimensions in calibrated units. The length of the list corresponds to the number of scan axes.

pixelsize_um

Returns a List of axes dimensions in um. The length of the list corresponds to the number of scan axes.

scan_width_um
Returns a List of scan widths as configured in the Bluelake UI. The length of the list
corresponds to the number of scan axes. Note that these widths can deviate from the actual scan widths performed in practice

Deprecated since version 0.8.2: The property scan_width_um has been deprecated. Use size_um to get the actual size of the scan. When performing a scan, Bluelake determines an appropriate scan width based on the desired pixel size and the desired scan width. This means that the size of the performed scan could deviate from the width provided in this property.

size_um

Returns a List of scan sizes in um along axes. The length of the list corresponds to the number of scan axes.

timestamps

Timestamps for image pixels, not for samples

The returned array has the same shape as the *_image arrays.