Changeset 2abe6bf in sasview for src/sas/sasgui


Ignore:
Timestamp:
Oct 8, 2016 9:45:52 AM (8 years ago)
Author:
mathieu
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
3f9a18a, 47f2b5d
Parents:
450c6f6
Message:

Let custom models have different class names. Fixes #732

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r212bfc2 r2abe6bf  
    99import copy 
    1010import math 
    11 import string 
    1211import json 
    1312import logging 
     
    335334        self.data.detector[index].beam_center.x = qmax 
    336335        self.data.detector[index].beam_center.y = qmax 
    337         ## create x_bins and y_bins of the model 2D 
    338         #pixel_width_x = self.data.detector[index].pixel_size.x 
    339         #pixel_width_y = self.data.detector[index].pixel_size.y 
    340         #center_x = self.data.detector[index].beam_center.x/pixel_width_x 
    341         #center_y = self.data.detector[index].beam_center.y/pixel_width_y 
    342         # theory default: assume the beam 
    343         #center is located at the center of sqr detector 
    344336        xmax = qmax 
    345337        xmin = -qmax 
     
    360352        # set all True (standing for unmasked) as default 
    361353        mask = numpy.ones(len(qx_data), dtype=bool) 
    362         # calculate the range of qx and qy: this way, 
    363         # it is a little more independent 
    364         #x_size = xmax - xmin 
    365         #y_size = ymax - ymin 
    366354        # store x and y bin centers in q space 
    367355        x_bins = x 
    368356        y_bins = y 
    369         # bin size: x- & y-directions 
    370         #xstep = x_size / len(x_bins - 1) 
    371         #ystep = y_size / len(y_bins - 1) 
    372357 
    373358        self.data.source = Source() 
     
    410395            batch_menu.Enable(self.batch_on and flag) 
    411396 
    412     def set_page_info(self, page_info): 
    413         """ 
    414         set some page important information at once 
    415         """ 
    416 #       THIS METHOD/FUNCTION NO LONGE APPEARS TO BE CALLED.  Started up program 
    417 #       and started new fit window and PR and Invariant and a fit in fitting 
    418 #       but never entered this routine which should be an initialization 
    419 #       routine.  Leave for a while but probably something to clean up at 
    420 #       some point? 
    421 # 
    422 #       PDB April 13 2014 
    423 # 
    424         ##window_name 
    425         self.window_name = page_info.window_name 
    426         ##window_caption 
    427         self.window_caption = page_info.window_caption 
    428         ## manager is the fitting plugin 
    429         self._manager = page_info.manager 
    430         ## owner of the page (fitting plugin) 
    431         self.event_owner = page_info.event_owner 
    432         ## current model 
    433         self.model = page_info.model 
    434         ## data 
    435         self.data = page_info.data 
    436         ## dictionary containing list of models 
    437         self.model_list_box = page_info.model_list_box 
    438         ## Data member to store the dispersion object created 
    439         self.populate_box(model_dict=self.model_list_box) 
    440  
    441397    def onContextMenu(self, event): 
    442398        """ 
    443399        Retrieve the state selected state 
    444400        """ 
    445         # Skipping the save state functionality for release 0.9.0 
    446         #return 
    447  
    448401        pos = event.GetPosition() 
    449402        pos = self.ScreenToClient(pos) 
    450  
    451403        self.PopupMenu(self.popUpMenu, pos) 
    452404 
     
    568520            return 
    569521        if len(self.model_list_box) > 0: 
    570         ## This is obsolete code since form factor box is no longer static. 
    571         ## It is now set dynamically through _show_combox and _show_combos_helper 
    572         ## These are called for first time by formfactor_combo_init 
    573         ## itself called from fitpanel only.  If we find that I'm wrong and 
    574         ## we DO need to initialize somehow here - do it by a call to 
    575         ## formfactor_combo_init 
    576         ## self.formfator_combo_init() 
    577         ## BUT NOT HERE -- make it last line of this 
    578         ## method so that structure box is populated before _show_comboox_helper 
    579         ## is called.  Otherwise wx will complain mightily:-) 
    580         ## 
    581         ## Also change the name to initiatlize_structurebox along with changes 
    582         ## to other combobox methods (_populate_listbox --> _populate_categorybox 
    583         ## etc ) 
    584         ## 
    585         ##     PDB 4/26/2014 
    586 #            self._populate_box(self.formfactorbox, 
    587 #                               self.model_list_box["Shapes"]) 
    588522            self._populate_box(self.structurebox, 
    589523                               self.model_list_box["Structure Factors"]) 
     
    600534                self.structurebox.Enable() 
    601535                self.text2.Enable() 
    602  
    603536 
    604537    def set_dispers_sizer(self): 
     
    738671        else: 
    739672            wx.CallAfter(self.get_copy) 
    740  
    741673 
    742674    def on_paste(self, event): 
     
    952884                                     self.state.orientation_params) 
    953885        self._copy_parameters_state(self.orientation_params_disp, 
    954                                      self.state.orientation_params_disp) 
     886                                    self.state.orientation_params_disp) 
    955887 
    956888        self._copy_parameters_state(self.parameters, self.state.parameters) 
    957889        self._copy_parameters_state(self.fittable_param, 
    958                                      self.state.fittable_param) 
     890                                    self.state.fittable_param) 
    959891        self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 
    960892        #save chisqr 
     
    1044976        self.disp_cb_dict = state.disp_cb_dict 
    1045977        self.disp_list = state.disp_list 
    1046  
    1047         ## set the state of the radio box 
    1048         #self.shape_rbutton.SetValue(state.shape_rbutton) 
    1049         #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 
    1050         #self.struct_rbutton.SetValue(state.struct_rbutton) 
    1051         #self.plugin_rbutton.SetValue(state.plugin_rbutton) 
    1052978 
    1053979        ## fill model combobox 
     
    18611787            if mod_cat == custom_model: 
    18621788                for model in self.model_list_box[mod_cat]: 
    1863                     str_m = model.id if hasattr(model, 'id') else model.name 
    1864                     m_list.append(self.model_dict[str_m]) 
     1789                    m_list.append(self.model_dict[model.name]) 
    18651790            else: 
    18661791                cat_dic = self.master_category_dict[mod_cat] 
     
    18681793                    if enabled: 
    18691794                        m_list.append(self.model_dict[model]) 
    1870                     #else: 
    1871                     #    msg = "This model is disabled by Category Manager." 
    1872                     #    wx.PostEvent(self.parent.parent, 
    1873                     #                 StatusEvent(status=msg, info="error")) 
    18741795        except Exception: 
    18751796            msg = traceback.format_exc() 
Note: See TracChangeset for help on using the changeset viewer.