WCP

Support is provided for reading data from files recorded using WinWCP.

The WcpFile class implements Myokit’s shared myokit.formats.SweepSource interface.

class myokit.formats.wcp.WcpFile(path)

Represents a read-only WinWCP file (.wcp), stored at path.

Only files in the newer file format version 9 can be read. This version of the format was introduced in 2010. New versions of WinWCP can read older files and will convert them to the new format automatically when opened.

WinWCP is a tool for recording electrophysiological data written by John Dempster of Strathclyde University. For more information, see https://documentation.help/WinWCP-V5.3.8/IDH_Topic750.htm

WinWCP files contain a number of records NR, each containing data from NC channels. Every channel has the same length, NP samples. Sampling happens at a fixed sampling rate.

When a WcpFile is created, the file at path is read in its entirety and the file handle is closed. No try-catch or with statements are required.

channel(channel_id, join_sweeps=False)

Returns the data for a single channel, identified by integer or string channel_id.

With join_sweeps=False, the data is returned as a tuple (times, sweeps) where times and sweeps are 2d numpy arrays indexed so that times[i][j] is the j-th time point for sweep i.

If join_sweeps=True the sweeps are joined together, and a tuple (times, values) is returned times and values are 1d arrays.

channel_count()

Returns the number of channels.

channel_names(index=None)

Returns the names of all channels or the name of a specific channel index.

channel_units(index=None)

Returns the units (as myokit.Unit) of all channels or the units of a specific channel index.

channels()

Deprecated alias of channel_count().

da_count()

Returns the available number of reconstructed D/A output channels.

This should return 0 if D/A channels are not supported.

equal_length_sweeps()

Returns True only if each sweep in this source has the same length.

filename()

Returns this file’s name.

info()

Deprecated alias of meta_str()

log(join_sweeps=False, use_names=False, include_da=True)

Returns a myokit.DataLog containing the data from all channels.

The log will have a single entry time corresponding to the time of the first sweep if join_sweeps is False, or the time of all points when join_sweeps is True.

Names will have a systematic form i_sweep.i_channel.label, for example 0.1.channel for sweep 0 of recorded channel 1, or 3.0.da for sweep 3 of reconstructed D/A output 0. These can also be accessed using the syntax log['channel', 1, 0] and log['da', 0, 3].

To obtain a log with the user-specified names from the source instead, set use_names to True. This will result in names such as 0.IN 1 or 3.Cmd 0.

To exclude D/A signal reconstructions, set include_da to False.

A call with join_sweeps=False on a source where equal_length_sweeps() returns False will raise a ValueError.

matplotlib_figure()

Creates and returns a matplotlib figure with this file’s data.

meta_str(verbose=False)

Optional method that returns a multi-line string with unstructured meta data about the source and its contents.

Will return None if no such string is available.

myokit_log()

Deprecated method. Please use WcpFile.log(use_names=True) instead.

path()

Returns the path to this file.

plot()

Deprecated method, please use matplotlib_figure() instead.

Creates and shows a matplotlib figure of all data in this file.

record_count()

Alias of sweep_count().

records()

Deprecated alias of sweep_count().

sample_count()

Returns the number of samples in each channel.

sweep_count()

Returns the number of sweeps.

Note that a source with zero recorded channels may still report a non-zero number of sweeps if it can provide D/A outputs.

time_unit()

Returns the time unit used in this source.

times()

Returns the time points sampled at.

values(record, channel)

Returns the values of channel channel, recorded in record record.

version()

Returns this file’s version, as a string.