plen_aft = 1 filtered_signal = ourFilters.matched_filter(downsampled_data, SAMP_F, start_good_beats, end_good_beats, plen_bef, plen_aft) print 'filtered' ''' #extraction peaks from the signal #the user selects the parameters, with default suggested delta = 0.2 peaks = IBI.getPeaksIBI(filtered_signal,SAMP_F, delta) print 'plotting...' plt.plot(filtered_signal[:,0],filtered_signal[:,1]) plt.plot(peaks[:,0], peaks[:,1], 'o') plt.show() #calculation of the IBI #the user selects the parameters, with default suggested minFr = 40 maxFr = 200 ibi = IBI.max2interval(peaks, minFr, maxFr) ourTools.array_labels_to_csv(ibi, np.array(["timestamp", "IBI", "labels"]), "./output/preproc_"+fileName[7:-4]+".csv") #-----FEATURES EXTRACTION----- lbls = np.array([0 for i in ibi[:,0]]) winds, lbls = windowing.get_windows_contiguos(ibi[:,0], lbls, 100, 50) feat, lbls = IBI.extract_IBI_features(ibi, winds, lbls) feat_col=np.array(['RRmean', 'RRSTD', 'pNN50', 'pNN25', 'pNN10', 'RMSSD', 'SDSD']) ourTools.array_labels_to_csv(feat, feat_col, "./output/feat_"+fileName[7:-4]+".csv")
filterType=filterType) #compact timestamp, signal and labels for the next processes total_signal = filtered_signal #extraction peaks from the signal #the user selects the parameters, with default suggested delta = 1 peaks = IBI.getPeaksIBI(total_signal, SAMP_F, delta) #calculation of the IBI #the user selects the parameters, with default suggested minFr = 40 maxFr = 200 ibi = IBI.max2interval(peaks, minFr, maxFr) tools.array_labels_to_csv(ibi, np.array(["timestamp", "IBI", "lables"]), "./output/preproc_" + fileName[7:-4] + ".csv") #-----FEATURES EXTRACTION----- timestamp = ibi[:, 0] timed_vals = ibi[:, [0, 1]] lbls = ibi[:, 2] winds, lbls = windowing.get_windows_contiguos(timestamp, lbls, 100, 50) feat, lbls = IBI.extract_IBI_features(timed_vals, winds, lbls) feat_col = np.array( ['RRmean', 'RRSTD', 'pNN50', 'pNN25', 'pNN10', 'RMSSD', 'SDSD']) tools.array_labels_to_csv(feat, feat_col, "./output/feat_" + fileName[7:-4] + ".csv")
ILOSS = 0.1 IATT = 40 filtered_signal = ourFilters.filterSignal(rawdata, SAMP_F, passFr = F_PASS, stopFr = F_STOP, LOSS = ILOSS, ATTENUATION = IATT, filterType = filterType) #compact timestamp, signal and labels for the next processes total_signal = filtered_signal #extraction peaks from the signal #the user selects the parameters, with default suggested delta = 1 peaks = IBI.getPeaksIBI(total_signal,SAMP_F, delta) #calculation of the IBI #the user selects the parameters, with default suggested minFr = 40 maxFr = 200 ibi = IBI.max2interval(peaks, minFr, maxFr) tools.array_labels_to_csv(ibi, np.array(["timestamp", "IBI", "lables"]), "./output/preproc_"+fileName[7:-4]+".csv") #-----FEATURES EXTRACTION----- timestamp = ibi[:,0] timed_vals = ibi[:,[0,1]] lbls = ibi[:,2] winds, lbls = windowing.get_windows_contiguos(timestamp, lbls, 100, 50) feat, lbls = IBI.extract_IBI_features(timed_vals, winds, lbls) feat_col=np.array(['RRmean', 'RRSTD', 'pNN50', 'pNN25', 'pNN10', 'RMSSD', 'SDSD']) tools.array_labels_to_csv(feat, feat_col, "./output/feat_"+fileName[7:-4]+".csv")