In [1]:
%pylab inline
import bioread
pylab.rcParams['figure.figsize'] = (14.0, 12.0)  # Make figures a bit bigger
Populating the interactive namespace from numpy and matplotlib
In [2]:
# This file is included in bioread
data = bioread.read_file('test/data/physio/physio-4.4.0.acq')
In [3]:
data
Out[3]:
AcqKnowledge file (rev 128): 4 channels, 2000.0 samples/sec
In [4]:
data.channels
Out[4]:
[Channel EDA filtered, differentiated: 123787 samples, 2000.0 samples/sec, loaded: True,
 Channel EKG - ERS100C: 61893 samples, 1000.0 samples/sec, loaded: True,
 Channel RESP - RSP100C: 241 samples, 3.90625 samples/sec, loaded: True,
 Channel EDA - GSR100C: 123787 samples, 2000.0 samples/sec, loaded: True]
In [5]:
plt.subplot(211)

for chan in data.channels:
    plt.plot(chan.time_index, chan.data, label='{} ({})'.format(chan.name, chan.units))

plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
           ncol=1, mode="expand", borderaxespad=0.)
None  # Don't print a silly legend thing
In [6]:
# The computed channel is putting the others way off-scale, let's exclude it
plt.subplot(211)
for chan in data.channels[1:]:
    plt.plot(chan.time_index, chan.data, label='{} ({})'.format(chan.name, chan.units))

plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
           ncol=1, mode="expand", borderaxespad=0.)
None  # Don't print a silly legend thing
In [7]:
# And let's separate resp and ekg so we can see their traces better
plt.subplot(211)
ekg = data.channels[1]
resp = data.channels[2]
eda = data.channels[3]
plt.plot(ekg.time_index, ekg.data, label='{} ({})'.format(ekg.name, ekg.units))
plt.plot(resp.time_index, resp.data + 1.5, label='{} ({})'.format(resp.name, resp.units))
plt.plot(eda.time_index, eda.data, label='{} ({})'.format(eda.name, eda.units))

plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
           ncol=1, mode="expand", borderaxespad=0.)
None  # Don't print a silly legend thing
In [8]:
for m in data.event_markers:
    print('{0}: Channel {1}, type {2}'.format(m.text, m.channel_name, m.type))
Segment 1: Channel None, type Append
Breathe In: Channel RESP - RSP100C, type Inspire Start
Breathe Out: Channel RESP - RSP100C, type Expire Start
Deep Breath 1: Channel None, type Flag
EDA Peak: Channel EDA - GSR100C, type Skin Conductance Response
EDA Peak: Channel EDA filtered, differentiated, type Skin Conductance Response
Deep Breath 2: Channel None, type Flag
EDA Trough: Channel EDA - GSR100C, type Skin Conductance Response
EDA Trough: Channel EDA filtered, differentiated, type Skin Conductance Response
Deep Breath 3: Channel None, type Flag
In [ ]: