AttributeError:“元组”对象没有属性“ p_signals”

时间:2019-01-28 21:30:46

标签: python-3.x time-series

请帮忙解决这个错误。 这是我的代码:

import numpy as np 
import pandas as pd 
from subprocess import check_output
print(check_output(["ls", "/home/mahmood/apnea-ecg"]).decode("utf8"))
import os
os.listdir("/home/mahmood/apnea-ecg")
import wfdb
import numpy as np
import matplotlib.pyplot as plt
recordname = "/home/mahmood/apnea-ecg/a04"
record = wfdb.rdsamp(recordname)
record.p_signals

1 个答案:

答案 0 :(得分:1)

来自wfdb.rdsamp源代码:

Returns ------- signals : numpy array A 2d numpy array storing the physical signals from the record. fields : dict A dictionary containing several key attributes of the read record: - fs: The sampling frequency of the record - units: The units for each channel - sig_name: The signal name for each channel - comments: Any comments written in the header

因此,您将获得一个由2个元素,信号和场组成的元组。 我会写:

p_signals, _ = wfdb.rdsamp(recordname)