def process_ground_truth(file_name):
    ground_truth = GroundTruth(None, file_name)
    ground_truth.process_ground_truth(10)

    fig, ax = plt.subplots(2, 1)
    fig.suptitle("Time series", fontsize=14)

    ax[0].plot(ground_truth.time_base,
               ground_truth.ecg_wave,
               label='ECG Waveform',
               color=(0, 0, 1))
    ax[1].plot(ground_truth.time_base,
               ground_truth.ecg_heart_rate,
               label='ECG Heart rate',
               color=(1, 0, 0))
    ax[1].plot(ground_truth.time_base,
               ground_truth.ecg_average,
               label='ECG Heart rate (average)',
               color=(0, 1, 0))

    ax[0].legend(loc='best')
    ax[1].legend(loc='best')

    plt.ion()
    plt.pause(0.00001)
    plt.show()
    input("press enter")
Esempio n. 2
0
 def __process_ground_truth(self, video_file_or_camera):
     if video_file_or_camera != 0:
         # processing a video file, check to see if there is an existing ground_truth file
         # noinspection PyPep8
         try:
             folder = os.path.dirname(video_file_or_camera)
             ground_truth_file = "{}/ground_truth.txt".format(folder)
             ground_truth = GroundTruth(self.logger, ground_truth_file)
             ground_truth.process_ground_truth(
                 int(self.config["pulse_sample_frames"] /
                     self.config["video_fps"]))
             self.ground_truth = ground_truth
         except:
             e = sys.exc_info()[0]
             self.logger.error("Exception: {} ".format(e))