コード例 #1
0
    def show_extraction_graph(self):
        if not self.has_active_editor(klass=RecallEditor):
            return

        from pychron.graph.stacked_graph import StackedGraph
        from numpy import array
        import struct
        import base64

        an = self.active_editor.analysis
        data = an.get_extraction_data()

        def extract_blob(blob):
            blob = base64.b64decode(blob)
            if blob != 'No Response':
                x, y = array([
                    struct.unpack('<ff', blob[i:i + 8])
                    for i in range(0, len(blob), 8)
                ]).T
                x[0] = 0
            else:
                x, y = [], []

            return x, y

        g = StackedGraph()
        g.window_title = 'Extraction Results - {}'.format(an.record_id)
        g.new_plot(padding=[70, 10, 10, 60])

        xx, yy = extract_blob(data['request'])
        g.new_series(xx, yy, plotid=0)
        g.set_y_limits(pad='0.1')

        g.new_plot(padding=[70, 10, 10, 10])
        xx, yy = extract_blob(data['response'])
        g.new_series(xx, yy, plotid=1)

        g.set_y_title('Temp (C)', plotid=0)
        g.set_x_title('Time (s)', plotid=0)
        g.set_y_title('% Output', plotid=1)
        open_view(g)
コード例 #2
0
ファイル: browser_task.py プロジェクト: NMGRL/pychron
    def show_extraction_graph(self):
        if not self.has_active_editor(klass=RecallEditor):
            return

        from pychron.graph.stacked_graph import StackedGraph
        from numpy import array
        import struct
        import base64

        an = self.active_editor.analysis
        data = an.get_extraction_data()

        def extract_blob(blob):
            blob = base64.b64decode(blob)
            if blob != 'No Response':
                x, y = array([struct.unpack('<ff', blob[i:i + 8]) for i in range(0, len(blob), 8)]).T
                x[0] = 0
            else:
                x, y = [], []

            return x, y

        g = StackedGraph()
        g.window_title = 'Extraction Results - {}'.format(an.record_id)
        g.new_plot(padding=[70, 10, 10, 60])

        xx, yy = extract_blob(data['request'])
        g.new_series(xx, yy, plotid=0)
        g.set_y_limits(pad='0.1')

        g.new_plot(padding=[70, 10, 10, 10])
        xx, yy = extract_blob(data['response'])
        g.new_series(xx, yy, plotid=1)

        g.set_y_title('Temp (C)', plotid=0)
        g.set_x_title('Time (s)', plotid=0)
        g.set_y_title('% Output', plotid=1)
        open_view(g)