lumicks.pylake.scan.Scan

class Scan(name, file, start, stop, json)

A confocal scan exported from Bluelake

Parameters:
name : str

Scan 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 scan-specific metadata.

__init__(name, file, start, stop, json)

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

Methods

__init__(name, file, start, stop, json) Initialize self.
export_video_blue(file_name[, start_frame, …]) Export multi-frame scan as video.
export_video_green(file_name[, start_frame, …]) Export multi-frame scan as video.
export_video_red(file_name[, start_frame, …]) Export multi-frame scan as video.
export_video_rgb(file_name[, start_frame, …]) Export multi-frame scan as video.
frame_timestamp_ranges([exclude]) Get start and stop timestamp of each frame in the scan.
from_dataset(h5py_dset, file) Construct a confocal class from dataset.
plot(channel[, axes]) Show a formatted plot for the requested color channel.
plot_blue(**kwargs) Plot an image of the blue photon channel
plot_correlated(channel_slice[, frame, …]) Downsample channel on a frame by frame basis and plot the results.
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 an image of all color channels.
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.

lines_per_frame
num_frames
pixels_per_line
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 frames

export_video_blue(file_name, start_frame=None, end_frame=None, fps=15, **kwargs)

Export multi-frame scan as video.

Parameters:
file_name : str

File name to export to.

start_frame : int

Initial frame.

end_frame : int

Last frame.

fps : int

Frames per second.

**kwargs

Forwarded to matplotlib.pyplot.imshow().

export_video_green(file_name, start_frame=None, end_frame=None, fps=15, **kwargs)

Export multi-frame scan as video.

Parameters:
file_name : str

File name to export to.

start_frame : int

Initial frame.

end_frame : int

Last frame.

fps : int

Frames per second.

**kwargs

Forwarded to matplotlib.pyplot.imshow().

export_video_red(file_name, start_frame=None, end_frame=None, fps=15, **kwargs)

Export multi-frame scan as video.

Parameters:
file_name : str

File name to export to.

start_frame : int

Initial frame.

end_frame : int

Last frame.

fps : int

Frames per second.

**kwargs

Forwarded to matplotlib.pyplot.imshow().

export_video_rgb(file_name, start_frame=None, end_frame=None, fps=15, **kwargs)

Export multi-frame scan as video.

Parameters:
file_name : str

File name to export to.

start_frame : int

Initial frame.

end_frame : int

Last frame.

fps : int

Frames per second.

**kwargs

Forwarded to matplotlib.pyplot.imshow().

frame_timestamp_ranges(exclude=True)

Get start and stop timestamp of each frame in the scan.

Parameters:
exclude : bool

Exclude dead time at the end of each frame.

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(channel, axes=None, **kwargs)

Show a formatted plot for the requested color channel.

Parameters:
channel : {‘red’, ‘green’, ‘blue’, ‘rgb’}

Color channel to plot.

axes : mpl.axes.Axes or None

If supplied, the axes instance in which to plot.

**kwargs

Forwarded to matplotlib.pyplot.plot() or matplotlib.pyplot.imshow()

plot_blue(**kwargs)

Plot an image of the blue photon channel

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

.. deprecated:: 0.11.1

plot_blue() is deprecated. Use `plot(channel=’blue’) instead.

plot_correlated(channel_slice, frame=0, reduce=<function mean>, channel='rgb', figure_scale=0.75)

Downsample channel on a frame by frame basis and plot the results. The downsampling function (e.g. np.mean) is evaluated for the time between a start and end time of a frame. Note: In environments which support interactive figures (e.g. jupyter notebook with ipywidgets or interactive python) this plot will be interactive.

Parameters:
channel_slice : pylake.channel.Slice

Data slice that we with to downsample.

frame : int

Frame to show.

reduce : callable

The function which is going to reduce multiple samples into one. The default is numpy.mean(), but numpy.sum() could also be appropriate for some cases e.g. photon counts.

channel : ‘rgb’, ‘red’, ‘green’, ‘blue’, None; optional

Channel to plot for RGB images (None defaults to ‘rgb’) Not used for grayscale images

figure_scale : float

Scaling of the figure width and height. Values greater than one increase the size of the figure.

Examples

from lumicks import pylake

file = pylake.File("example.h5")
scan = file.scans["my scan"]
scan.plot_correlated(file.force1x, channel="red")
plot_green(**kwargs)

Plot an image of the green photon channel

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

.. deprecated:: 0.11.1

plot_green() is deprecated. Use `plot(channel=’green’) instead.

plot_red(**kwargs)

Plot an image of the red photon channel

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

.. deprecated:: 0.11.1

plot_red() is deprecated. Use `plot(channel=’red’) instead.

plot_rgb(**kwargs)

Plot an image of all color channels.

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.imshow().

.. deprecated:: 0.11.1

plot_rgb() is deprecated. Use `plot(channel=’rgb’) instead.

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)

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.