コード例 #1
0
def main(argv):
    an = wfdb.WFDB_AnninfoArray(2)
    annot = wfdb.WFDB_Annotation()
    record = raw_input("Type record name: ")
    iann = raw_input("Type input annotatior name")
    oann = raw_input("Type output annotator name: ")
    
    a = wfdb.WFDB_Anninfo()
    a.name = iann
    a.stat = wfdb.WFDB_READ
    an[0] = a
    
    a = wfdb.WFDB_Anninfo()
    a.name = oann
    a.stat = wfdb.WFDB_WRITE
    an[1] = a
    
    if wfdb.annopen(record ,an , 2) < 0:  sys.exit(1)
    
    while wfdb.getann(0 , annot) ==0:
        if wfdb.wfdb_isqrs(annot.anntyp):
            annot.anntyp = wfdb.NORMAL
            if wfdb.putann(0 , annot)<0: break
    
    wfdb.wfdbquit()
コード例 #2
0
def setupWfdb(rec_name, annotator ):
    nsig = openWfdbSignal(rec_name);
    
    #Allocate memory for sig info array
    #we can use siarray to access WFDB_Siginfo structure
    siarray = wfdb.WFDB_SiginfoArray(nsig);
    
    #Allocate memory for data
    sdata = wfdb.WFDB_SampleArray(nsig);
    
    #Open WFDB record
    wfdb.isigopen(rec_name, siarray.cast(), nsig);
    
    
    #read annotations from file
    #WFDB_Anninfor() contains name and attributes of annotator .atr etc
    a = wfdb.WFDB_Anninfo();
    
    #WFDB_Annotation describes the attributes of signals 
    #declare object in c : WFDB_Annotation annot; see below for declaring object in python
    annot = wfdb.WFDB_Annotation();
    
    #read name and status of annotation file
    #a.name="atr";
    #a.name="ecg";
    #a.name="output_annotator"
    a.name=annotator;
    a.stat = wfdb.WFDB_READ;
    
    freq=wfdb.sampfreq(rec_name);
    nsamp=siarray[0].nsamp;
    print ("sampling frequency is: " + str(freq))
    init_time=wfdb.timstr(0);
    #print("strtim for starting value is: " + str(wfdb.strtim(init_time)));
    
    ##comment june 16
    ###### print signal specification #####
    record_info=wfdb.getinfo(rec_name)
    #print("getinfor is " + str(record_info));

    # print("total num of samples: " + str(nsamp));
    # print "Starting time of record is: "+ str(init_time);
    # print("sampling frequency is:"+ str(freq));      
    ########## READ ANNOTATION ##################
    if wfdb.annopen(rec_name, a, 1) < 0: 
        print("cannot open aanopen");
        exit();
    
    return (nsamp, freq, annot, init_time,sdata);
コード例 #3
0
#Move data from record to sdata
sig0 = []
sig1 = []

#physig0 is array with physical units
physig0 = []
physig1 = []

#read annotations from file
#WFDB_Anninfor() contains name and attributes of annotator .atr etc
a = wfdb.WFDB_Anninfo()

#WFDB_Annotation describes the attributes of signals
#declare object in c : WFDB_Annotation annot; see below for declaring object in python
annot = wfdb.WFDB_Annotation()
#read name and status of annotation file

a.name = annotation
print a.name
a.stat = wfdb.WFDB_READ
freq = wfdb.sampfreq(rec_name)
nsamp = siarray[0].nsamp
init_time = wfdb.timstr(0)
print type(init_time)
print("strtim for starting value is: " + str(wfdb.strtim(init_time)))

print("total num of samples: " + str(nsamp))
print "Starting time of record is: " + str(init_time)
print("sampling frequency is:" + str(freq))