[409112]: / preprocessOfApneaECG / __pycache__ / denoising.cpython-36.pyc

Download this file

42 lines (36 with data), 2.0 kB

3

$└]}Ń@s,dZdZdZdZddlZddlZddäZdS)uŢ
	This file is to solve the problem of baseline drift of ECG signal.
	
	The methods come from Yildiz et al. paper, "An expert system for automated recognition of patients with obstructive sleep apnea using electrocardiogram recordings".
	
	Firstly, use wavelet decomposition on ECG signal to six level and get cD1 to cD6, cA6. Secondly, set the cD6 to zero.
	Lastly, use wavelet reconstruction on cD1 to cD6(zeros) and cA6, and achieve denoising ECG signal.
	
	I summarize frequency band of some waves in ECG signals.
	P wave: atrial depolarization, ň┐⊳┐ÚÖĄŠ×ü.
	QRS complexes: ventricular depolarization´╝îň┐âň«ĄňÄ╗Š×ü.
	T wave: ventricular repolarization, ň┐âň«ĄňĄŹŠ×ü.
	P and T waves range: 0.5hz-10hz.
	QRS complex range: 10hz-25hz.
	Detail signal D2 is used as a reference signal for the detection of QRS fiducial location.

	cD1: 25-50hz
	cD2: 12.5-25hz
	cD3: 6.25-12.5hz
	cD4: 3.125-6.25hz
	cD5: 1.5625-3.125hz
	cD6: 0.78125-1.5625hz
	cD7: 0.390625-0.78125hz
	cA7: 0-0.390625hz
	
z0.1z
2019.06.22┌zzklove3344ÚNc	Csńd}d}g}tj|t|ââ}x.t|âD]"}tj||â\}}|j|â|}q&W|j|âtjt||ââ||<||}xVt|âD]J}||d|}t|ât|âkr║tj|t|âdddŹ}tj	|||â}q~Wtj|t|âdfâ}|S)z╗
	Remove baseline drafts from ECG signal.
	:param ecg_segment: ecg record, a numpy array.
	:return: denoised ecg record, a numpy array.
	
	Example:
	denoising_ecg = denoise_ecg(raw_ecg)
	ÚZdb6Úr)┌axis)
┌np┌reshape┌len┌range┌pywtZdwt┌append┌zeros┌deleteZidwt)	Zecg_segmentZdenoising_wd_levelZdenoising_wd_waveletZ
coffes_setZ	cA_signalZ	index_decZcAZcDZ	cD_signalęr˙@G:\python project\apneaECGCode\preprocessOfApneaECG\denoising.py┌denoise_ecg%s$


r)┌__doc__┌__version__┌__time__┌
__author__r
┌numpyrrrrrr┌<module>s