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 atpath.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 fromNCchannels. Every channel has the same length,NPsamples. Sampling happens at a fixed sampling rate.When a
WcpFileis created, the file atpathis read in its entirety and the file handle is closed. No try-catch orwithstatements 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)wheretimesandsweepsare 2d numpy arrays indexed so thattimes[i][j]is thej-th time point for sweepi.If
join_sweeps=Truethe sweeps are joined together, and a tuple(times, values)is returnedtimesandvaluesare 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 channelindex.
- 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
Trueonly 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.DataLogcontaining the data from all channels.The log will have a single entry
timecorresponding to the time of the first sweep ifjoin_sweepsisFalse, or the time of all points whenjoin_sweepsisTrue.Names will have a systematic form
i_sweep.i_channel.label, for example0.1.channelfor sweep 0 of recorded channel 1, or3.0.dafor sweep 3 of reconstructed D/A output 0. These can also be accessed using the syntaxlog['channel', 1, 0]andlog['da', 0, 3].To obtain a log with the user-specified names from the source instead, set
use_namestoTrue. This will result in names such as0.IN 1or3.Cmd 0.To exclude D/A signal reconstructions, set
include_datoFalse.A call with
join_sweeps=Falseon a source whereequal_length_sweeps()returnsFalsewill raise aValueError.
- 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
Noneif 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
record_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.
Similarly, formats like WCP can report zero sweeps but have a non-zero channel count (if no data was recorded).
- 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 recordrecord.
- version()¶
Returns this file’s version, as a string.