Пример #1
0
 def _resp_plot_default(self):
     # Create plotting components
     self.resp_plot_data = ArrayPlotData(
         time=self.time,
         inhale_times=self.resp_inhale_begin_times,
         inhale_values=self.resp_inhale_begin_values,
         exhale_times=self.resp_exhale_begin_times,
         exhale_values=self.resp_exhale_begin_values,
         filtered_resp=self.resp_signal,
         lpfilt_resp=self.lpfilt_resp)
     plot = Plot(self.resp_plot_data)
     plot.plot(("time", "filtered_resp"), color="blue", line_width=1)
     plot.plot(("time", "lpfilt_resp"), color="green", line_width=1)
     # Plot the inhalation peaks
     plot.plot(("inhale_times", "inhale_values"),
               type="scatter",
               marker="square")
     plot.plot(("exhale_times", "exhale_values"),
               type="scatter",
               marker="circle")
     plot.title = "Respiration"
     plot.title_position = "right"
     plot.title_angle = 270
     plot.padding = 20
     return plot
Пример #2
0
    def _plot_default(self):

        plot = Plot(self.plotdata)

        if self.signal in ("tpr", "co", "sv"):
            rc_signal = "resp_corrected_" + self.signal
            if rc_signal in self.plotdata.arrays and self.plotdata.arrays[
                    rc_signal].size > 0:
                # Plot the resp-uncorrected version underneath
                plot.plot(("peak_times", self.signal),
                          type="line",
                          color="purple")
                signal = rc_signal
            signal = self.signal
        elif self.signal == "hr":
            plot.plot(("peak_times", self.signal), type="line", color="purple")
            signal = "mea_hr"
        else:
            signal = self.signal

        # Create the plot
        plot.plot(("peak_times", signal), type="line", color="blue")
        plot.plot(("peak_times", signal, "beat_type"),
                  type="cmap_scatter",
                  color_mapper=jet,
                  name="my_plot",
                  marker="circle",
                  border_visible=False,
                  outline_color="transparent",
                  bg_color="white",
                  index_sort="ascending",
                  marker_size=3,
                  fill_alpha=0.8)

        # Tweak some of the plot properties
        plot.title = self.signal  #"Scatter Plot With Lasso Selection"
        plot.title_position = "right"
        plot.title_angle = 270
        plot.line_width = 1
        plot.padding = 20

        # Right now, some of the tools are a little invasive, and we need the
        # actual ScatterPlot object to give to them
        my_plot = plot.plots["my_plot"][0]

        # Attach some tools to the plot
        self.selection = BeatSelection(component=my_plot)
        my_plot.active_tool = self.selection
        selection_overlay = RangeSelectionOverlay(component=my_plot)
        my_plot.overlays.append(selection_overlay)

        # Set up the trait handler for the selection
        self.selection.on_trait_change(self._selection_changed,
                                       'selection_completed')

        return plot
Пример #3
0
 def _z0_plot_default(self):
     self.z0_plot_data = ArrayPlotData(time=self.time,
                                       raw_data=self.raw_z0_signal,
                                       cleaned_data=self.resp_corrected_z0)
     plot = Plot(self.z0_plot_data)
     plot.plot(("time", "raw_data"), color="blue", line_width=1)
     plot.plot(("time", "cleaned_data"), color="green", line_width=1)
     plot.title = "z0"
     plot.title_position = "right"
     plot.title_angle = 270
     plot.padding = 20
     return plot
Пример #4
0
 def _dzdt_plot_default(self):
     """
     Creates a plot of the ecg_ts data and the signals derived during
     the Pan Tomkins algorithm
     """
     # Create plotting components
     self.dzdt_plot_data = ArrayPlotData(
         time=self.time,
         raw_data=self.raw_dzdt_signal,
         cleaned_data=self.resp_corrected_dzdt)
     plot = Plot(self.dzdt_plot_data)
     plot.plot(("time", "raw_data"), color="blue", line_width=1)
     plot.plot(("time", "cleaned_data"), color="green", line_width=1)
     plot.title = "dZ/dt"
     plot.title_position = "right"
     plot.title_angle = 270
     plot.padding = 20
     return plot
Пример #5
0
    def _plot_default(self):
        # Create plotting components
        plotdata = ArrayPlotData(time=self.time, data=self.data)
        plot = Plot(plotdata)
        self.renderer = plot.plot(("time", "data"), color=self.line_color)[0]
        plot.title = self.name
        plot.title_position = "right"
        plot.title_angle = 270
        plot.line_width = 1
        plot.padding = 25
        plot.width = 400

        # Load the censor regions and add them to the plot
        for censor_region in self.censored_regions:
            # Make a censor region on the Timeseries object
            censor_region.plot = self.renderer
            censor_region.viz
            censor_region.set_limits(censor_region.start_time,
                                     censor_region.end_time)
        return plot