def acc_plot_fn(ax1, ax2, x, freq): s = np.square(x[:, 2:]) mag = np.sum(s, axis=1) mag = np.column_stack((x[:, 1], mag)) plot_time_domain(ax1, mag) plot_freq_domain(ax2, mag[:, 1], freq)
def output(x): if args["export_csv"]: np.savetxt(args["acc_csv"], x, delimiter=',') if int(args["type"][0]) == 0: s = np.square(x[:, 1:]) mag = np.sum(s, axis=1) mag = np.column_stack((x[:, 0], mag)) plot_time_domain(ax1, mag) plot_freq_domain(ax2, mag[:, 1], ACC_FS)
def output(x): if args["export_csv"]: np.savetxt(args["ppg_csv"], x, delimiter=',') if int(args["type"][0]) == 12: plot_time_domain(ax1, x) plot_freq_domain(ax2, x[:, 1], PPG_FS_512)
def default_plot_fn(ax1, ax2, x, freq): plot_time_domain(ax1, x[:, 1:]) plot_freq_domain(ax2, x[:, 2], freq)
else: size = len(ppg_data) ppg_data = ppg_data[start:size] # Read annotation file annot = [] if args.annotation_file: annot_f = open(args.annotation_file) annot = parse_annotation(annot_f) filtered_ecg_data = ecg_data[:,1] filtered_ecg_data = high_pass_filter(filtered_ecg_data, ECG_FS, HIGH_PASS_CUTOFF) filtered_ecg_data = low_pass_filter(filtered_ecg_data, ECG_FS, LOW_PASS_CUTOFF) filtered_ecg_data = np.column_stack((ecg_data[:,0], filtered_ecg_data)) filtered_ppg_data = ppg_data[:,1] filtered_ppg_data = high_pass_filter(filtered_ppg_data, PPG_FS_512, HIGH_PASS_CUTOFF) filtered_ppg_data = low_pass_filter(filtered_ppg_data, PPG_FS_512, LOW_PASS_CUTOFF) filtered_ppg_data = np.column_stack((ppg_data[:,0], filtered_ppg_data)) fig = plot.figure() ax1 = fig.add_subplot(2, 1, 1) ax2 = fig.add_subplot(2, 1, 2, sharex=ax1) plot_time_domain(ax1, filtered_ppg_data, color='blue') plot_time_domain(ax2, filtered_ecg_data, color='black') plot_annotation(ax1, annot) plot_annotation(ax2, annot) plot.show()