Changeset 4a4164c in sasview


Ignore:
Timestamp:
Jan 20, 2012 6:11:03 PM (12 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
cdf515f
Parents:
356d2d3
Message:

rotation for only smaller # of pixels

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plottools/src/danse/common/plottools/PlotPanel.py

    rca58654 r4a4164c  
    324324        Set the resizing (True/False) 
    325325        """ 
    326         pass # Not impleeted 
     326        pass # Not implemented 
    327327     
    328328    def schedule_full_draw(self, func='append'):     
     
    330330        Put self in schedule to full redraw list 
    331331        """ 
    332         pass # Not implemeted 
     332        pass # Not implemented 
    333333     
    334334    def add_toolbar(self): 
     
    14251425                   cmap=self.cmap, zmin=zmin_2D_temp, 
    14261426                   zmax=zmax_2D_temp) 
     1427        self.figure.canvas.draw_idle() 
    14271428       
    14281429    def image(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax,  
     
    14791480            im = self.subplot.imshow(output, interpolation='nearest',  
    14801481                                     origin='lower', 
    1481                                      #vmin=zmin_temp, vmax=self.zmax_2D, 
    1482                                      cmap=self.cmap)#,  
    1483                                      #extent=(self.xmin_2D, self.xmax_2D, 
    1484                                      #           self.ymin_2D, self.ymax_2D)) 
     1482                                     vmin=zmin_temp, vmax=self.zmax_2D, 
     1483                                     cmap=self.cmap,  
     1484                                     extent=(self.xmin_2D, self.xmax_2D, 
     1485                                                self.ymin_2D, self.ymax_2D)) 
     1486             
    14851487            cbax = self.subplot.figure.add_axes([0.84,0.2,0.02,0.7]) 
    14861488        else: 
    14871489            # clear the previous 2D from memory 
    1488             self.subplot.figure.clf() 
     1490            # mpl is not clf, so we do 
     1491            self.subplot.figure.clear() 
     1492 
    14891493            self.subplot.figure.subplots_adjust(left=0.1, right=.8, bottom=.1)   
    14901494            try: 
     
    15011505            Y = self.y_bins[0:-1] 
    15021506            X, Y = numpy.meshgrid(X, Y) 
    1503      
     1507            if len(X) > 60: 
     1508                ax.disable_mouse_rotation() 
    15041509            im = ax.plot_surface(X, Y, output, rstride=1, cstride=1, cmap=cmap, 
    15051510                                   linewidth=0, antialiased=False) 
    15061511            #ax.set_zlim3d(zmin_temp, self.zmax_2D) 
    15071512            #ax.set_frame_on(False) 
    1508             self.subplot.set_axis_off()     
     1513            self.subplot.set_axis_off()   
    15091514             
    15101515        if cbax == None: 
     
    15141519        cb.update_bruteforce(im) 
    15151520        cb.set_label('$' + self.scale + '$') 
    1516          
    1517         #if self.dimension != 3: 
    1518         self.figure.canvas.draw_idle() 
    15191521     
    15201522    def _build_matrix(self): 
  • plottools/src/danse/common/plottools/canvas.py

    r7434020 r4a4164c  
    130130        self.xaxis = None 
    131131        self.yaxis = None 
     132        self.ndraw = 0 
    132133        # Support for mouse wheel 
    133134        self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel) 
     
    166167        """ 
    167168        # Check resize whether or not True 
     169        if self.panel.dimension == 3: 
     170            return 
     171 
    168172        # This is for fast response when plot is being resized 
    169173        if not self.resizing: 
     
    191195        # Only draw if window is shown, otherwise graph will bleed through 
    192196        # on the notebook style AUI widgets. 
     197        #    raise 
    193198        fig = FigureCanvasWxAgg 
    194         if self.IsShownOnScreen(): 
     199        if self.IsShownOnScreen() and self.ndraw != 1: 
    195200            self._isRendered = True 
    196             #self.panel.parent.refresh_floating(self.panel) 
    197201            self._get_axes_switch() 
    198202            #import time 
     
    207211        else: 
    208212            self._isRendered = False 
    209     
     213        if self.ndraw <= 1: 
     214            self.ndraw += 1 
     215         
    210216    def _onMouseWheel(self, evt): 
    211217        """Translate mouse wheel events into matplotlib events""" 
  • sansguiframe/src/sans/guiframe/local_perspectives/plotting/masking.py

    r602645d r4a4164c  
    1818import wx 
    1919import sys 
     20import time 
    2021import pylab 
    2122import math 
     
    4344    FONT_VARIANT = 1 
    4445     
    45  
     46from data_util.calcthread import CalcThread 
     47 
     48class CalcPlot(CalcThread): 
     49    """ 
     50    Compute Resolution 
     51    """ 
     52    def __init__(self, 
     53                 id = -1, 
     54                 panel = None, 
     55                 image = None, 
     56                 completefn = None, 
     57                 updatefn   = None, 
     58                 elapsed = 0, 
     59                 yieldtime  = 0.01, 
     60                 worktime   = 0.01 
     61                 ): 
     62        """ 
     63        """ 
     64        CalcThread.__init__(self,completefn, 
     65                 updatefn, 
     66                 yieldtime, 
     67                 worktime) 
     68        self.starttime = 0 
     69        self.id = id  
     70        self.panel = panel 
     71        self.image = image 
     72         
     73         
     74    def compute(self): 
     75        """ 
     76        excuting computation 
     77        """ 
     78        elapsed = time.time() - self.starttime 
     79        
     80        self.complete(panel=self.panel, image=self.image, elapsed=elapsed) 
     81         
     82         
    4683class MaskPanel(wx.Dialog): 
    4784    """ 
     
    519556    window_caption = "Plot" 
    520557    ## Flag to tell the AUI manager to put this panel in the center pane 
    521     CENTER_PANE = True 
     558    CENTER_PANE = False 
     559    ID = wx.NewId() 
    522560    def __init__(self, parent=None, base=None,  
    523                  data=None, dimension=1, id=-1, *args, **kwds): 
     561                 data=None, dimension=1, id=ID, *args, **kwds): 
    524562        kwds["style"] = wx.DEFAULT_DIALOG_STYLE 
    525563        kwds["size"] = wx.Size(_STATICBOX_WIDTH*1.5, PANEL_SIZE*1.5)  
     
    552590                self.newplot = Data2D(image=self.data.data) 
    553591                self.newplot.setValues(self.data) 
    554                  
    555             self.plotpanel.add_image(self.newplot)  
     592                    # Compute and get the image plot 
     593            self.get_plot() 
     594            #self.plotpanel.add_image(self.newplot)  
    556595            self.Centre() 
    557596            self.Layout() 
    558  
    559              
     597     
     598    def get_plot(self): 
     599        """ 
     600        Get Plot panel 
     601        """ 
     602        cal_plot = CalcPlot(panel=self.plotpanel,  
     603                                   image=self.newplot,  
     604                                   completefn=self.complete) 
     605        cal_plot.queue() 
     606     
     607    def complete(self, panel, image, elapsed=None): 
     608        """ 
     609        Plot image 
     610         
     611        :param image: newplot [plotpanel] 
     612        """ 
     613        wx.CallAfter(panel.add_image, image)  
     614         
    560615    def _setup_layout(self): 
    561616        """ 
     
    566621        if self.dimension == 3: 
    567622            note = "Note: I am very SLOW.     Please be PATIENT...\n" 
     623            if len(self.data.data) > 3600: 
     624                note += "Rotation disabled for pixels > 60x60." 
    568625            note_txt = wx.StaticText(self, -1, note)  
    569626            note_txt.SetForegroundColour(wx.RED) 
     
    610667        try: 
    611668            self.plotpanel.subplot.figure.clf() 
     669            self.plotpanel.close() 
    612670        except: 
    613671            # when called by data panel 
     
    678736        self._status_info(msg, status_type) 
    679737        status_type = 'stop'            
    680          
    681738        self.graph.render(self) 
    682         if self.dimension == 3: 
    683             pass 
    684         else: 
     739        if self.dimension < 3: 
     740            self.graph.render(self) 
    685741            self.subplot.figure.canvas.draw_idle() 
    686742        msg = 'Plotting Completed.' 
Note: See TracChangeset for help on using the changeset viewer.