Ignore:
Timestamp:
Oct 8, 2016 1:33:04 PM (8 years ago)
Author:
jhbakker
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:
1fac6c0
Parents:
7988501 (diff), f7bc948 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ajj_sesans' into Jurrian1D

File:
1 edited

Legend:

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

    r7988501 r51a4d78  
    99import copy 
    1010import math 
    11 import string 
    1211import json 
    1312import logging 
     
    340339        self.data.detector[index].beam_center.x = qmax 
    341340        self.data.detector[index].beam_center.y = qmax 
    342         ## create x_bins and y_bins of the model 2D 
    343         #pixel_width_x = self.data.detector[index].pixel_size.x 
    344         #pixel_width_y = self.data.detector[index].pixel_size.y 
    345         #center_x = self.data.detector[index].beam_center.x/pixel_width_x 
    346         #center_y = self.data.detector[index].beam_center.y/pixel_width_y 
    347         # theory default: assume the beam 
    348         #center is located at the center of sqr detector 
    349341        xmax = qmax 
    350342        xmin = -qmax 
     
    365357        # set all True (standing for unmasked) as default 
    366358        mask = numpy.ones(len(qx_data), dtype=bool) 
    367         # calculate the range of qx and qy: this way, 
    368         # it is a little more independent 
    369         #x_size = xmax - xmin 
    370         #y_size = ymax - ymin 
    371359        # store x and y bin centers in q space 
    372360        x_bins = x 
    373361        y_bins = y 
    374         # bin size: x- & y-directions 
    375         #xstep = x_size / len(x_bins - 1) 
    376         #ystep = y_size / len(y_bins - 1) 
    377362 
    378363        self.data.source = Source() 
     
    415400            batch_menu.Enable(self.batch_on and flag) 
    416401 
    417     def set_page_info(self, page_info): 
    418         """ 
    419         set some page important information at once 
    420         """ 
    421 #       THIS METHOD/FUNCTION NO LONGE APPEARS TO BE CALLED.  Started up program 
    422 #       and started new fit window and PR and Invariant and a fit in fitting 
    423 #       but never entered this routine which should be an initialization 
    424 #       routine.  Leave for a while but probably something to clean up at 
    425 #       some point? 
    426 # 
    427 #       PDB April 13 2014 
    428 # 
    429         ##window_name 
    430         self.window_name = page_info.window_name 
    431         ##window_caption 
    432         self.window_caption = page_info.window_caption 
    433         ## manager is the fitting plugin 
    434         self._manager = page_info.manager 
    435         ## owner of the page (fitting plugin) 
    436         self.event_owner = page_info.event_owner 
    437         ## current model 
    438         self.model = page_info.model 
    439         ## data 
    440         self.data = page_info.data 
    441         ## dictionary containing list of models 
    442         self.model_list_box = page_info.model_list_box 
    443         ## Data member to store the dispersion object created 
    444         self.populate_box(model_dict=self.model_list_box) 
    445  
    446402    def onContextMenu(self, event): 
    447403        """ 
    448404        Retrieve the state selected state 
    449405        """ 
    450         # Skipping the save state functionality for release 0.9.0 
    451         #return 
    452  
    453406        pos = event.GetPosition() 
    454407        pos = self.ScreenToClient(pos) 
    455  
    456408        self.PopupMenu(self.popUpMenu, pos) 
    457409 
     
    570522    def initialize_combox(self): 
    571523        """ 
    572         put default value in the combobox 
    573         """ 
    574         ## fill combox box 
    575         if self.model_list_box is None: 
    576             return 
    577         if len(self.model_list_box) > 0: 
    578         ## This is obsolete code since form factor box is no longer static. 
    579         ## It is now set dynamically through _show_combox and _show_combos_helper 
    580         ## These are called for first time by formfactor_combo_init 
    581         ## itself called from fitpanel only.  If we find that I'm wrong and 
    582         ## we DO need to initialize somehow here - do it by a call to 
    583         ## formfactor_combo_init 
    584         ## self.formfator_combo_init() 
    585         ## BUT NOT HERE -- make it last line of this 
    586         ## method so that structure box is populated before _show_comboox_helper 
    587         ## is called.  Otherwise wx will complain mightily:-) 
    588         ## 
    589         ## Also change the name to initiatlize_structurebox along with changes 
    590         ## to other combobox methods (_populate_listbox --> _populate_categorybox 
    591         ## etc ) 
    592         ## 
    593         ##     PDB 4/26/2014 
    594 #            self._populate_box(self.formfactorbox, 
    595 #                               self.model_list_box["Shapes"]) 
     524        put default value in the combo box 
     525        """ 
     526        if self.model_list_box is not None and len(self.model_list_box) > 0: 
    596527            self._populate_box(self.structurebox, 
    597528                               self.model_list_box["Structure Factors"]) 
     
    602533            self.structurebox.Disable() 
    603534            self.text2.Disable() 
    604  
    605             if self.model.__class__ in self.model_list_box["P(Q)*S(Q)"]: 
    606                 self.structurebox.Show() 
    607                 self.text2.Show() 
    608                 self.structurebox.Enable() 
    609                 self.text2.Enable() 
    610  
    611535 
    612536    def set_dispers_sizer(self): 
     
    746670        else: 
    747671            wx.CallAfter(self.get_copy) 
    748  
    749672 
    750673    def on_paste(self, event): 
     
    960883                                     self.state.orientation_params) 
    961884        self._copy_parameters_state(self.orientation_params_disp, 
    962                                      self.state.orientation_params_disp) 
     885                                    self.state.orientation_params_disp) 
    963886 
    964887        self._copy_parameters_state(self.parameters, self.state.parameters) 
    965888        self._copy_parameters_state(self.fittable_param, 
    966                                      self.state.fittable_param) 
     889                                    self.state.fittable_param) 
    967890        self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 
    968891        #save chisqr 
     
    1052975        self.disp_cb_dict = state.disp_cb_dict 
    1053976        self.disp_list = state.disp_list 
    1054  
    1055         ## set the state of the radio box 
    1056         #self.shape_rbutton.SetValue(state.shape_rbutton) 
    1057         #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 
    1058         #self.struct_rbutton.SetValue(state.struct_rbutton) 
    1059         #self.plugin_rbutton.SetValue(state.plugin_rbutton) 
    1060977 
    1061978        ## fill model combobox 
     
    18861803            if mod_cat == custom_model: 
    18871804                for model in self.model_list_box[mod_cat]: 
    1888                     str_m = model.id if hasattr(model, 'id') else model.name 
    1889                     m_list.append(self.model_dict[str_m]) 
     1805                    m_list.append(self.model_dict[model.name]) 
    18901806            else: 
    18911807                cat_dic = self.master_category_dict[mod_cat] 
     
    18931809                    if enabled: 
    18941810                        m_list.append(self.model_dict[model]) 
    1895                     #else: 
    1896                     #    msg = "This model is disabled by Category Manager." 
    1897                     #    wx.PostEvent(self.parent.parent, 
    1898                     #                 StatusEvent(status=msg, info="error")) 
    18991811        except Exception: 
    19001812            msg = traceback.format_exc() 
     
    20671979            form_factor = self.formfactorbox.GetClientData(f_id) 
    20681980 
    2069         if not form_factor in  self.model_list_box["multiplication"]: 
     1981        if form_factor is None or not form_factor.is_form_factor: 
    20701982            self.structurebox.Hide() 
    20711983            self.text2.Hide() 
     
    34743386        self.by_model_dict = defaultdict(list) 
    34753387        self.model_enabled_dict = defaultdict(bool) 
    3476  
    3477         try: 
    3478             categorization_file = CategoryInstaller.get_user_file() 
    3479             if not os.path.isfile(categorization_file): 
    3480                 categorization_file = CategoryInstaller.get_default_file() 
    3481             cat_file = open(categorization_file, 'rb') 
    3482             self.master_category_dict = json.load(cat_file) 
    3483             self._regenerate_model_dict() 
    3484             cat_file.close() 
    3485         except IOError: 
    3486             raise 
    3487             print 'Problem reading in category file.' 
    3488             print 'We even looked for it, made sure it was there.' 
    3489             print 'An existential crisis if there ever was one.' 
     3388        categorization_file = CategoryInstaller.get_user_file() 
     3389        with open(categorization_file, 'rb') as f: 
     3390            self.master_category_dict = json.load(f) 
     3391        self._regenerate_model_dict() 
    34903392 
    34913393    def _regenerate_model_dict(self): 
Note: See TracChangeset for help on using the changeset viewer.