Changeset 743f480 in sasview


Ignore:
Timestamp:
Jun 26, 2012 11:35:21 AM (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:
709cd83
Parents:
21bc81b
Message:

read theory too.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/src/sans/perspectives/calculator/data_operator.py

    r21bc81b r743f480  
    5757        self.output = None 
    5858        self._notes = None 
     59        #text grayed color 
     60        self.color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND) 
    5961        #data 
    6062        self._data = self.get_datalist() 
     
    169171            children = ctrl.GetChildren() 
    170172            if len(children) > 0: 
    171                 ctrl.GetChildren()[0].SetBackGroundColour(\ 
    172                                                 self.GetBackGroundColour()) 
     173                ctrl.GetChildren()[0].SetBackGroundColour(self.color) 
    173174        else: 
    174175            if not ctrl.IsEnabled(): 
     
    201202            text = name 
    202203        state_list = self.get_datalist().values() 
    203         if text in [str(state.data.name) for state in state_list]: 
     204        name_list = [] 
     205        for state in state_list: 
     206            if state.data == None: 
     207                theory_list = state.get_theory() 
     208                theory, _ = theory_list.values()[0] 
     209                d_name = str(theory.name) 
     210            else: 
     211                d_name = str(state.data.name) 
     212            name_list.append(d_name) 
     213        if text in name_list: 
    204214            self._set_textctrl_color(self.data_namectr, 'pink') 
    205215            msg = "DataOperation: The name already exists." 
     
    300310            if data == None: 
    301311                content = "?" 
    302                 self.put_text_pic(self.data2_pic, content)  
     312                self.put_text_pic(self.data2_pic, content) 
     313                #item.SetClientData(pos, content)  
    303314            else: 
    304315                self.data2_pic.add_image(data) 
    305         else: 
    306             if data == None: 
    307                 content = str(self.numberctr.GetValue().strip()) 
    308                 try: 
    309                     content = float(content) 
    310                     data = content 
    311                 except: 
    312                     self._set_textctrl_color(self.numberctr, 'pink') 
    313                     content = "?" 
    314                     data = None 
    315                 item.SetClientData(pos, content) 
     316            self.check_data_inputs()  
     317        else: 
     318            content = str(self.numberctr.GetValue().strip()) 
     319            try: 
     320                content = float(content) 
     321                data = content 
     322            except: 
     323                self._set_textctrl_color(self.numberctr, 'pink') 
     324                content = "?" 
     325                data = None 
     326            item.SetClientData(pos, data) 
     327            if data != None: 
     328                self.check_data_inputs() 
     329                 
    316330            self.put_text_pic(self.data2_pic, content)    
    317         self.check_data_inputs() 
    318  
     331         
    319332        if self.output != None: 
    320333            self.output.name = str(self.data_namectr.GetValue()) 
     
    350363                self._set_textctrl_color(self.numberctr, 'white') 
    351364            else: 
    352                 self._set_textctrl_color(self.numberctr,  
    353                                          self.GetBackgroundColour()) 
     365                self._set_textctrl_color(self.numberctr, self.color ) 
    354366            try: 
    355367                float(data2) 
     
    369381        elif data1.__class__.__name__ != data2.__class__.__name__: 
    370382            self._set_textctrl_color(self.data1_cbox, 'pink') 
    371             self._set_textctrl_color(self.data1_cbox, 'pink') 
     383            self._set_textctrl_color(self.data2_cbox, 'pink') 
    372384            msg = "DataOperation: Data types must be same." 
    373385            self.send_warnings(msg, 'error') 
     
    393405        pos = self.operator_cbox.GetCurrentSelection() 
    394406        operator = self.operator_cbox.GetClientData(pos) 
    395         exec "output = data1 %s data2"% operator 
     407        try: 
     408            exec "output = data1 %s data2"% operator 
     409        except: 
     410            raise 
    396411        return output 
    397412     
     
    479494        self.data1_cbox.Clear() 
    480495        self.data2_cbox.Clear() 
     496 
    481497        if not self._data: 
    482498            pos = self.data1_cbox.Append('No Data Available') 
     
    486502            self.data2_cbox.SetSelection(pos2) 
    487503            self.data2_cbox.SetClientData(pos2, None) 
    488             pos3 = self.data2_cbox.Append("Number") 
    489             val = None 
    490             if (self.numberctr.IsShown() and self.numberctr.IsEnabled()): 
    491                 try: 
    492                     val = float(self.numberctr.GetValue()) 
    493                 except: 
    494                     val = None 
    495             self.data2_cbox.SetClientData(pos3, val) 
    496504            return 
    497505        pos1 = self.data1_cbox.Append('Select Data') 
     
    510518        self.data2_cbox.SetClientData(pos3, val) 
    511519        dnames = [] 
    512         for dstate in self._data.values(): 
    513             if dstate != None: 
    514                 if dstate.data != None: 
    515                     dnames.append(dstate.data.name) 
    516         if len(dnames) > 0: 
    517             ind = numpy.argsort(dnames) 
    518             for datastate in numpy.array(self._data.values())[ind]: 
     520        ids = self._data.keys() 
     521        for id in ids: 
     522            if id != None: 
     523                if self._data[id].data != None: 
     524                    dnames.append(self._data[id].data.name) 
     525                else: 
     526                    theory_list = self._data[id].get_theory() 
     527                    theory, _ = theory_list.values()[0] 
     528                    dnames.append(theory.name) 
     529        ind = numpy.argsort(dnames) 
     530        if len(ind) > 0: 
     531            val_list = numpy.array(self._data.values())[ind] 
     532            for datastate in val_list: 
    519533                data = datastate.data 
    520534                if data != None: 
     
    562576        state_list = self.get_datalist().values() 
    563577        name = self.data_namectr.GetValue().strip() 
    564         if name in [str(state.data.name) for state in state_list]: 
     578        name_list = [] 
     579        for state in state_list: 
     580            if state.data == None: 
     581                theory_list = state.get_theory() 
     582                theory, _ = theory_list.values()[0] 
     583                d_name = str(theory.name) 
     584            else: 
     585                d_name = str(state.data.name) 
     586            name_list.append(d_name) 
     587        if name in name_list: 
    565588            self._set_textctrl_color(self.data_namectr, 'pink') 
    566589            msg = "The Output Data Name already exists...   " 
     
    674697            pass 
    675698        self.subplot.figure.canvas.resizing = False 
    676         self.subplot.set_xticks([]) 
    677         self.subplot.set_yticks([]) 
     699        self.subplot.set_xticks([0.0]) 
     700        self.subplot.set_yticks([0.0]) 
    678701        # Draw zero axis lines 
    679702        self.subplot.axhline(linewidth = 1, color='r')   
  • fittingview/src/sans/perspectives/fitting/fitting.py

    rffdfd23 r743f480  
    18531853        numpy.nan_to_num(image) 
    18541854        new_plot = Data2D(image=image, err_image=data.err_data) 
    1855         new_plot.name = model.name 
     1855        new_plot.name = model.name + '2d' 
    18561856        new_plot.title = "Analytical model 2D " 
    18571857        new_plot.id = str(page_id) + "model-" + data.name 
     
    18751875            data_name = str(data.name) 
    18761876        else: 
    1877             data_name = str(model.__class__.__name__) 
     1877            data_name = str(model.__class__.__name__) + '2d' 
    18781878 
    18791879        if len(title) > 1: 
Note: See TracChangeset for help on using the changeset viewer.