def plotmultichannel(data, params=None):
# TODO Receive Labels as arguments
"""
Creates a plot to present multichannel data
Arguments
data: Multichannel Data [n_samples, n_channels]
params: information about the data acquisition device being
"""
plt.figure()
n_samples = data.shape[0]
n_channels = data.shape[1]
if params is not None:
fs = params['sampling frequency']
names = params['names of channels']
else:
fs = 1
names = [""] * n_channels
time_vec = np.arange(n_samples) / float(fs)
data = np.fliplr(data)
offset = 0
for i_channel in range (0, n_channels):
data_ac = data[:,i_channel] - np.mean(data[:,i_channel])
offset = offset + 2 * np.max(np.abs(data_ac))
plt.plot(time_vec, data_ac + offset, label=names[i_channel])
plt.xlabel('Time [s]');
plt.ylabel('Amplitude');
plt.legend()
plt.draw()
评论列表
文章目录