lumicks.pylake.channel.Slice

class Slice(data_source, labels=None)

A lazily evaluated slice of a timeline/HDF5 channel

Users will only ever get these as a result of slicing a timeline/HDF5 channel or slicing another slice (via this class’ __getitem__), i.e. the __init__ method will never be invoked by users.

Parameters:
data_source : Any

A slice data source. Can be Continuous, TimeSeries, ‘TimeTags’, or any other source which conforms to the same interface.

labels : Dict[str, str]

Plot labels: “x”, “y”, “title”.

__init__(data_source, labels=None)

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

Methods

__init__(data_source[, labels]) Initialize self.
downsampled_by(factor[, reduce]) Return a copy of this slice which is downsampled by factor
plot(**kwargs) A simple line plot to visualize the data over time

Attributes

data The primary values of this channel slice
sample_rate The data frequency for continuous data sources or None if it’s variable
timestamps Absolute timestamps (since epoch) which correspond to the channel data
__getitem__(item)

All indexing is in timestamp units (ns)

downsampled_by(factor, reduce=<function mean>)

Return a copy of this slice which is downsampled by factor

Parameters:
factor : int

The size and sample rate of the data will be divided by this factor.

reduce : callable

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

plot(**kwargs)

A simple line plot to visualize the data over time

Parameters:
**kwargs

Forwarded to matplotlib.pyplot.plot().

data

The primary values of this channel slice

sample_rate

The data frequency for continuous data sources or None if it’s variable

timestamps

Absolute timestamps (since epoch) which correspond to the channel data