Exemple #1
0
    def save_animgif(self, filename='animation.gif', show_page=None):
        def show_page(args):
            k = args[0]
            self.goto_frame(k)
            self.draw()

        BookViewer.save_animgif(self, filename=filename, show_page=show_page)
Exemple #2
0
 def __init__(self, *args, **kargs):
     kargs['style'] = (wx.FRAME_FLOAT_ON_PARENT | wx.MINIMIZE_BOX
                       | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER
                       | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                       | wx.CLIP_CHILDREN)
     #        print kargs
     BookViewer.__init__(self, *args, **kargs)
     f_page = self.get_page(0)
     f_page.set_section(2)
     f_axes = self.get_axes(0, 0)
     for name, child in f_axes.get_children():
         child.destroy()
     obj = FigPlot([0], [0])
     f_axes.add_child('xslice_plot1', obj)
     obj.set_suppress(True)
     obj = FigPlot([0], [0])
     f_axes.add_child('xslice_plot2', obj)
     obj.set_suppress(True)
     f_axes.realize()
     f_axes = self.get_axes(0, 1)
     for name, child in f_axes.get_children():
         child.destroy()
     obj = FigPlot([0], [0])
     f_axes.add_child('xslice_plot1', obj)
     obj.set_suppress(True)
     obj = FigPlot([0], [0])
     f_axes.add_child('xslice_plot2', obj)
     obj.set_suppress(True)
     f_axes.realize()
Exemple #3
0
    def save_multipdf(self, filename='figure_allpage.pdf', show_page=None):
        def show_page(args):
            k = args[0]
            self.goto_frame(k)
            self.draw()

        BookViewer.save_multipdf(self, filename=filename, show_page=show_page)
Exemple #4
0
 def save_multipdf(self, filename='figure_allpage.pdf',
                   show_page = None):
     def show_page(args):
          k = args[0]
          self.goto_frame(k)
          self.draw()
     BookViewer.save_multipdf(self, filename = filename, 
                             show_page = show_page)
Exemple #5
0
 def save_animgif(self, filename='animation.gif',
                  show_page = None):
     def show_page(args):
          k = args[0]
          self.goto_frame(k)
          self.draw()
     BookViewer.save_animgif(self, filename = filename,
                             show_page = show_page)
Exemple #6
0
 def __init__(self, *args, **kargs):
     BookViewer.__init__(self, *args, **kargs)
     extra_menu = wx.Menu()
     self.menuBar.Insert(self.menuBar.GetMenuCount() - 1, extra_menu,
                         "ExtraMenu")
     self.add_menu(extra_menu, wx.ID_ANY, "Plot Something...",
                   "plot sine wave (this is string for status bar)",
                   self.onPlotSomething)
Exemple #7
0
    def image(self, *args, **kwargs):
        if len(args) == 1:
            complex_z = args[0]
            if np.iscomplexobj(complex_z):
                args = (complex_z.real, )
        elif len(args) == 3:
            complex_z = args[2]
            if np.iscomplexobj(complex_z):
                args = (
                    args[0],
                    args[1],
                    complex_z.real,
                )
        else:
            print("incorrect number of arguments: image(z) or image(x, y, z)")
            return

        try:
            o = BookViewer.image(self, *args, **kwargs)
        except ValueError as x:
            return
        o.setvar('complex_z', complex_z)
        convert_figobj(o)
        self.add_video_obj(o)
        return o
Exemple #8
0
 def plot(self, *args, **kwargs):    
     o = BookViewer.plot(self, *args, **kwargs)
     if o is None: return
     if o.getvar('y').dtype.name.startswith('complex'):
         convert_figobj(o)
         self.add_video_obj(o)
     return o
Exemple #9
0
 def plot(self, *args, **kwargs):
     o = BookViewer.plot(self, *args, **kwargs)
     if o is None: return
     if o.getvar('y').dtype.name.startswith('complex'):
         convert_figobj(o)
         self.add_video_obj(o)
     return o
Exemple #10
0
 def surf(self, *args, **kwargs):
     try:
         o = BookViewer.surf(self, *args, **kwargs)
     except ValueError as x:
         return
     convert_figobj(o)
     self.add_video_obj(o)
     return o
Exemple #11
0
 def surf(self, *args, **kwargs):
     try:
        o = BookViewer.surf(self, *args, **kwargs)            
     except ValueError as x:
        return
     convert_figobj(o)       
     self.add_video_obj(o)       
     return o
Exemple #12
0
 def plot(self, *args, **kwargs):
     o = BookViewer.plot(self, *args, **kwargs)
     if o is None:
         return
     y = args[1]
     if y.dtype.name.startswith('complex'):
         o.setvar('complex_y', y)
         convert_figobj(o)
         self.add_video_obj(o)
     return o
Exemple #13
0
    def image(self, *args, **kwargs):
        '''
        image(z)
        or
        image(x, y, z)
        '''
        if len(args) == 1:
            z = args[0]
            x = np.arange(z.shape[-1])
            y = np.arange(z.shape[-2])
        elif len(args) == 3:
            x = args[0]
            y = args[1]
            z = args[2]
        if z.ndim != 3:
            raise ValueError('z data should have ndim = 3')

        o = BookViewer.image(self, x, y, z[0], **kwargs)
        if o is None: return
        convert_figobj(o)
        o.set_video_data(z)
        self.add_video_obj(o)
        return o
Exemple #14
0
 def image(self, *args, **kwargs):
     '''
     image(z)
     or
     image(x, y, z)
     '''
     if len(args) == 1:
         z = args[0]            
         x = np.arange(z.shape[-1])
         y = np.arange(z.shape[-2])
     elif len(args) == 3:
         x = args[0]
         y = args[1]
         z = args[2]
     if z.ndim != 3:
         raise ValueError('z data should have ndim = 3')
     
     o = BookViewer.image(self, x, y, z[0], **kwargs)
     if o is None: return
     convert_figobj(o)
     o.set_video_data(z)
     self.add_video_obj(o)        
     return o
Exemple #15
0
 def __init__(self, *args, **kwargs):
     VideoViewerMode.__init__(self, *args, **kwargs)
     BookViewer.__init__(self, *args, **kwargs)
Exemple #16
0
 def onResize(self, evt):
     BookViewer.onResize(self, evt)
     if self._playerbtn is not None:
         self._playerbtn.place_right_bottom()            
Exemple #17
0
 def onPaste(self, e):
     BookViewer.onPaste(self, e)
     self.add_all_video_obj()
Exemple #18
0
 def call_draw_after_resize(self):
     if self._playerbtn is not None:
         self._playerbtn.place_right_bottom()
     BookViewer.call_draw_after_resize(self)
Exemple #19
0
 def onResize(self, evt):
     BookViewer.onResize(self, evt)
     if self._playerbtn is not None:
         self._playerbtn.place_right_bottom()
Exemple #20
0
 def __init__(self, *args, **kwargs):
     VideoViewerMode.__init__(self, *args, **kwargs)
     BookViewer.__init__(self, *args, **kwargs)
Exemple #21
0
 def call_draw_after_resize(self):
     if self._playerbtn is not None:
         self._playerbtn.place_right_bottom()
     BookViewer.call_draw_after_resize(self)
Exemple #22
0
 def onPaste(self, e):
     BookViewer.onPaste(self, e)
     self.add_all_video_obj()