import numpy as np import wfdb as wf import sys import matplotlib.pyplot as plt import tensorflow as tf import os, imageio from tqdm import tqdm import mitecg ECG = mitecg.ReadMitEcg( '/Users/chen/Desktop/ecg/www.physionet.org/physiobank/database/mitdb', 10000, [1, 2, 3, 4, 5], True) batch_size = 20 HEARTBEATSAMPLES = 250 LABEL = 5 z_dim = 100 X = tf.placeholder(dtype=tf.float32, shape=[None, HEARTBEATSAMPLES, 1], name='X') y_label = tf.placeholder(dtype=tf.float32, shape=[None, HEARTBEATSAMPLES, LABEL], name='y_label') noise = tf.placeholder(dtype=tf.float32, shape=[None, z_dim], name='noise') y_noise = tf.placeholder(dtype=tf.float32, shape=[None, LABEL], name='y_noise') is_training = tf.placeholder(dtype=tf.bool, name='is_training') def lrelu(x, leak=0.2): return tf.maximum(x, leak * x)
import numpy as np import wfdb as wf import sys import matplotlib.pyplot as plt import tensorflow as tf import os, imageio from tqdm import tqdm import mitecg from scipy.fftpack import fft, ifft import seaborn SCALEDSAMPLES = 50 ECG = mitecg.ReadMitEcg( '/Users/chen/Desktop/Research/ecg/www.physionet.org/physiobank/database/mitdb', 10000, [1, 2, 3, 4, 5], False, SCALEDSAMPLES=SCALEDSAMPLES) sampleArray = ECG.oneEcgWithHeartBeatScaled() x = np.linspace(0, 1, sampleArray.size) yy = fft(sampleArray) yreal = yy.real yimag = yy.imag yf = abs(yy) yf1 = abs(yy) / len(x) yf2 = yf1[range(int(len(x) / 2))]
import tensorflow as tf import os, imageio from tqdm import tqdm import mitecg import argparse parser = argparse.ArgumentParser() parser.add_argument("datapath", help="directory to the mit ecg database") args = parser.parse_args() batch_size = 250 HEARTBEATSAMPLES = 50 LABEL = 5 z_dim = 100 ECG = mitecg.ReadMitEcg(args.datapath, 10000, [1, 2, 3, 4, 5], True, SCALEDSAMPLES=HEARTBEATSAMPLES) X = tf.placeholder(dtype=tf.float32, shape=[None, HEARTBEATSAMPLES, 1], name='X') y_label = tf.placeholder(dtype=tf.float32, shape=[None, HEARTBEATSAMPLES, LABEL], name='y_label') noise = tf.placeholder(dtype=tf.float32, shape=[None, z_dim], name='noise') y_noise = tf.placeholder(dtype=tf.float32, shape=[None, LABEL], name='y_noise') is_training = tf.placeholder(dtype=tf.bool, name='is_training') def lrelu(x, leak=0.2): return tf.maximum(x, leak * x)