Created
April 12, 2020 17:09
-
-
Save pbnsilva/516f5c4eb0ff9ee995cdf12c2df039c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def zero_pad(data, length): | |
extended = np.zeros(length) | |
siglength = np.min([length, data.shape[0]]) | |
extended[:siglength] = data[:siglength] | |
return extended | |
# plot a sample | |
data = sio.loadmat('training2017/A00001.mat')['val'][0] | |
# 61 seconds is the maximum length in our dataset | |
data = zero_pad(data, max_length*freq) | |
plt.figure(figsize=(15, 5)) | |
plt.title('Sample zero-padded ECG recording', fontsize=30) | |
plt.xlabel('Time (s)', fontsize=25) | |
plt.ylabel('Potential (mV)', fontsize=25) | |
plt.plot(np.arange(0, data.shape[0])/300, data/1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment