コード例 #1
0
ファイル: tsc_input.py プロジェクト: piScope/piScope
def onPlotTimeDep(self, e=None, *args, **kargs):
    def plot_data(time, data):
        x = np.array(time, dtype='float').flatten()
        y = np.array(data, dtype='float').flatten()
        
        x = [t for t in x if not np.isnan(t)]
        y = [t for t in y if not np.isnan(t)]
       
        return np.array(x), np.array(y)
        
    help = self.td._var0._help
    data = self.td._var0
    import ifigure.interactive as plt

    plt.figure()
    time = data['18']['data']
    new_plot = True
    for key in help: 
        if not key in data: continue
        if key == '18': continue
        x, y = help[key]
        if y.startswith('-'):
           if not new_plot: plt.addpage()
           try:
              xdata, ydata = plot_data(time, data[key]['data'])
              plt.plot(xdata, ydata)
              plt.title(x)
              new_plot = False
           except:
              print('failed to generate picture for', key)
              new_plot = True
    pass
コード例 #2
0
def onPlotTimeDep(self, e=None, *args, **kargs):
    def plot_data(time, data):
        x = np.array(time, dtype='float').flatten()
        y = np.array(data, dtype='float').flatten()

        x = [t for t in x if not np.isnan(t)]
        y = [t for t in y if not np.isnan(t)]

        return np.array(x), np.array(y)

    help = self.td._var0._help
    data = self.td._var0
    import ifigure.interactive as plt

    plt.figure()
    time = data['18']['data']
    new_plot = True
    for key in help:
        if not key in data: continue
        if key == '18': continue
        x, y = help[key]
        if y.startswith('-'):
            if not new_plot: plt.addpage()
            try:
                xdata, ydata = plot_data(time, data[key]['data'])
                plt.plot(xdata, ydata)
                plt.title(x)
                new_plot = False
            except:
                print('failed to generate picture for', key)
                new_plot = True
    pass
コード例 #3
0
ファイル: fig_contour.py プロジェクト: piScope/piScope
    def onSlice(self, event):
        from ifigure.interactive import figure, plot, nsec, isec, update, title, xlabel, ylabel
        if event.mpl_xydata[0] is None:
            return

        app = self.get_root_parent().app
        data1, data2 = self.get_slice(event.mpl_xydata[0],
                                      event.mpl_xydata[1])
        if data1 is None:
            return
        if data2 is None:
            return
        from ifigure.widgets.book_viewer import BookViewer
        book, viewer = app.open_newbook_in_newviewer(BookViewer)
        book.get_page(0).set_section(2)
        ou = update()
        isec(0)
        plot(data1[0], data1[1])
        title('x slice : y = '+str(event.mpl_xydata[1]))
        xlabel('x')
        isec(1)
        plot(data2[0], data2[1])
        title('y slice : x = '+str(event.mpl_xydata[0]))
        xlabel('y')
        update(ou)
コード例 #4
0
    def onSlice(self, event):
        from ifigure.interactive import figure, plot, nsec, isec, update, title, xlabel, ylabel
        if event.mpl_xydata[0] is None:
            return

        for a in self._artists:
            axes = a.axes
            if axes is None:
                return
            data1, data2 = self.get_slice(event.mpl_xy[0],
                                          event.mpl_xy[1], a)
            if data1 is None:
                continue
            if data2 is None:
                continue
            figure()
            nsec(2)
            ou = update()
            isec(0)
            plot(data1[0], data1[1])
            title('y slice : y = '+str(event.mpl_xydata[1]))
            xlabel('x')
            isec(1)
            plot(data2[0], data2[1])
            title('x slice : x = '+str(event.mpl_xydata[0]))
            xlabel('y')
            update(ou)
コード例 #5
0
ファイル: fig_contour.py プロジェクト: piScope/piScope
    def onSlice(self, event):
        from  ifigure.interactive import figure, plot, nsec, isec, update, title, xlabel, ylabel
        if event.mpl_xydata[0] is None: return

        app = self.get_root_parent().app
        data1, data2 = self.get_slice(event.mpl_xydata[0],
                                        event.mpl_xydata[1])
        if data1 is None: return
        if data2 is None: return
        from ifigure.widgets.book_viewer import BookViewer
        book, viewer = app.open_newbook_in_newviewer(BookViewer)
        book.get_page(0).set_section(2)
        ou = update()
        isec(0)
        plot(data1[0], data1[1])
        title('x slice : y = '+str(event.mpl_xydata[1]))
        xlabel('x')
        isec(1)
        plot(data2[0], data2[1])
        title('y slice : x = '+str(event.mpl_xydata[0]))
        xlabel('y')
        update(ou)
コード例 #6
0
ファイル: fig_image.py プロジェクト: piScope/piScope
    def onSlice(self, event):
        from  ifigure.interactive import figure, plot, nsec, isec, update, title, xlabel, ylabel
        if event.mpl_xydata[0] is None: return

        for a in self._artists:
            axes = a.axes
            if axes is None: return     
            data1, data2 = self.get_slice(event.mpl_xy[0],
                                          event.mpl_xy[1], a)
            if data1 is None: continue
            if data2 is None: continue
            figure()
            nsec(2)
            ou = update()
            isec(0)
            plot(data1[0], data1[1])
            title('y slice : y = '+str(event.mpl_xydata[1]))
            xlabel('x')
            isec(1)
            plot(data2[0], data2[1])
            title('x slice : x = '+str(event.mpl_xydata[0]))
            xlabel('y')
            update(ou)