Changeset 0b16ee3 in sasview


Ignore:
Timestamp:
Apr 22, 2009 9:19:43 PM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
4b26f8d9
Parents:
7c3aea3
Message:

hide and show error ,fix ,color change and toggle between hide and show

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/local_perspectives/plotting/Plotter1D.py

    rbb5c1c7 r0b16ee3  
    223223        
    224224        if self.graph.selected_plottable in self.plots: 
    225             if self.plots[self.graph.selected_plottable].name in self.err_dy.iterkeys()\ 
    226                 and self.errors_hide: 
    227                  
    228                 id = wx.NewId() 
    229                 slicerpop.Append(id, '&Show errors to data') 
    230                 wx.EVT_MENU(self, id, self._on_add_errors) 
    231                  
    232             elif self.plots[self.graph.selected_plottable].__class__.__name__=="Data1D"\ 
    233                 and not self.errors_hide: 
     225            selected_plot= self.plots[self.graph.selected_plottable] 
     226            #if self.plots[self.graph.selected_plottable].name in self.err_dy.iterkeys()\ 
     227            #    and self.errors_hide: 
     228            if selected_plot.__class__.__name__=="Data1D": 
     229                if selected_plot.dy ==None or selected_plot.dy== []: 
     230                    id = wx.NewId() 
     231                    slicerpop.Append(id, '&Show errors to data') 
     232                    wx.EVT_MENU(self, id, self._on_add_errors) 
     233                elif numpy.all(selected_plot.dy==0): 
     234                    id = wx.NewId() 
     235                    slicerpop.Append(id, '&Show errors to data') 
     236                    wx.EVT_MENU(self, id, self._on_add_errors) 
     237                else: 
    234238                    id = wx.NewId() 
    235239                    slicerpop.Append(id, '&Hide Error bars') 
     
    272276            import numpy 
    273277            dy= numpy.zeros(len(self.plots[self.graph.selected_plottable].y)) 
    274             new_plot = Data1D(self.plots[self.graph.selected_plottable].x, 
     278            selected_plot= self.plots[self.graph.selected_plottable] 
     279             
     280            if selected_plot.__class__.__name__=="Data1D": 
     281                new_plot = Data1D(self.plots[self.graph.selected_plottable].x, 
    275282                              self.plots[self.graph.selected_plottable].y, 
    276283                              dy=dy) 
     284            else: 
     285                 new_plot = Theory1D(self.plots[self.graph.selected_plottable].x, 
     286                          self.plots[self.graph.selected_plottable].y, 
     287                          dy=dy) 
    277288            new_plot.interactive = True 
    278289            self.errors_hide = True 
     
    292303            self.graph.delete(self.plots[self.graph.selected_plottable]) 
    293304            ## add newly created plottable to the graph with the save color 
    294             self.graph.color = color 
     305            self.graph.color += color 
    295306            self.graph.add(new_plot,color) 
    296307            ## transforming the view of the new data into the same of the previous data 
     
    325336            dy = numpy.zeros(length) 
    326337            selected_plot= self.plots[self.graph.selected_plottable] 
     338             
    327339            try: 
    328340                dy = self.err_dy[selected_plot.name] 
     341                
    329342            except: 
    330343                #for i in range(length): 
    331344                #dy[i] = math.sqrt(self.plots[self.graph.selected_plottable].y[i])       
    332                 dy= selected_plot.dy 
     345                if hasattr(selected_plot,"dy"): 
     346                    dy= selected_plot.dy 
     347                else: 
     348                    dy = numpy.zeros(selected_plot.dy) 
     349                     
    333350            ## Create a new plottable data1D 
    334             new_plot = Data1D(self.plots[self.graph.selected_plottable].x, 
    335                               self.plots[self.graph.selected_plottable].y, 
    336                               dy=dy) 
     351            if selected_plot.__class__.__name__=="Data1D": 
     352                new_plot = Data1D(self.plots[self.graph.selected_plottable].x, 
     353                          self.plots[self.graph.selected_plottable].y, 
     354                          dy=dy) 
     355            else: 
     356                ## Create a new plottable Theory1D 
     357                new_plot = Theory1D(self.plots[self.graph.selected_plottable].x, 
     358                          self.plots[self.graph.selected_plottable].y, 
     359                          dy=dy) 
    337360            new_plot.interactive = True 
    338361            
     
    352375            color=self.graph.plottables[self.plots[self.graph.selected_plottable]] 
    353376            self.graph.delete(self.plots[self.graph.selected_plottable]) 
    354             self.graph.color = color 
     377            self.graph.color += color 
    355378            ## add newly created plottable to the graph with the save color 
    356379            self.graph.add(new_plot, color) 
Note: See TracChangeset for help on using the changeset viewer.