Changeset 51a4d78 in sasview for src/sas/sasgui/perspectives/fitting/basepage.py
- Timestamp:
- Oct 8, 2016 3:33:04 PM (8 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
r7988501 r51a4d78 9 9 import copy 10 10 import math 11 import string12 11 import json 13 12 import logging … … 340 339 self.data.detector[index].beam_center.x = qmax 341 340 self.data.detector[index].beam_center.y = qmax 342 ## create x_bins and y_bins of the model 2D343 #pixel_width_x = self.data.detector[index].pixel_size.x344 #pixel_width_y = self.data.detector[index].pixel_size.y345 #center_x = self.data.detector[index].beam_center.x/pixel_width_x346 #center_y = self.data.detector[index].beam_center.y/pixel_width_y347 # theory default: assume the beam348 #center is located at the center of sqr detector349 341 xmax = qmax 350 342 xmin = -qmax … … 365 357 # set all True (standing for unmasked) as default 366 358 mask = numpy.ones(len(qx_data), dtype=bool) 367 # calculate the range of qx and qy: this way,368 # it is a little more independent369 #x_size = xmax - xmin370 #y_size = ymax - ymin371 359 # store x and y bin centers in q space 372 360 x_bins = x 373 361 y_bins = y 374 # bin size: x- & y-directions375 #xstep = x_size / len(x_bins - 1)376 #ystep = y_size / len(y_bins - 1)377 362 378 363 self.data.source = Source() … … 415 400 batch_menu.Enable(self.batch_on and flag) 416 401 417 def set_page_info(self, page_info):418 """419 set some page important information at once420 """421 # THIS METHOD/FUNCTION NO LONGE APPEARS TO BE CALLED. Started up program422 # and started new fit window and PR and Invariant and a fit in fitting423 # but never entered this routine which should be an initialization424 # routine. Leave for a while but probably something to clean up at425 # some point?426 #427 # PDB April 13 2014428 #429 ##window_name430 self.window_name = page_info.window_name431 ##window_caption432 self.window_caption = page_info.window_caption433 ## manager is the fitting plugin434 self._manager = page_info.manager435 ## owner of the page (fitting plugin)436 self.event_owner = page_info.event_owner437 ## current model438 self.model = page_info.model439 ## data440 self.data = page_info.data441 ## dictionary containing list of models442 self.model_list_box = page_info.model_list_box443 ## Data member to store the dispersion object created444 self.populate_box(model_dict=self.model_list_box)445 446 402 def onContextMenu(self, event): 447 403 """ 448 404 Retrieve the state selected state 449 405 """ 450 # Skipping the save state functionality for release 0.9.0451 #return452 453 406 pos = event.GetPosition() 454 407 pos = self.ScreenToClient(pos) 455 456 408 self.PopupMenu(self.popUpMenu, pos) 457 409 … … 570 522 def initialize_combox(self): 571 523 """ 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: 596 527 self._populate_box(self.structurebox, 597 528 self.model_list_box["Structure Factors"]) … … 602 533 self.structurebox.Disable() 603 534 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 611 535 612 536 def set_dispers_sizer(self): … … 746 670 else: 747 671 wx.CallAfter(self.get_copy) 748 749 672 750 673 def on_paste(self, event): … … 960 883 self.state.orientation_params) 961 884 self._copy_parameters_state(self.orientation_params_disp, 962 885 self.state.orientation_params_disp) 963 886 964 887 self._copy_parameters_state(self.parameters, self.state.parameters) 965 888 self._copy_parameters_state(self.fittable_param, 966 889 self.state.fittable_param) 967 890 self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 968 891 #save chisqr … … 1052 975 self.disp_cb_dict = state.disp_cb_dict 1053 976 self.disp_list = state.disp_list 1054 1055 ## set the state of the radio box1056 #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)1060 977 1061 978 ## fill model combobox … … 1886 1803 if mod_cat == custom_model: 1887 1804 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]) 1890 1806 else: 1891 1807 cat_dic = self.master_category_dict[mod_cat] … … 1893 1809 if enabled: 1894 1810 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"))1899 1811 except Exception: 1900 1812 msg = traceback.format_exc() … … 2067 1979 form_factor = self.formfactorbox.GetClientData(f_id) 2068 1980 2069 if not form_factor in self.model_list_box["multiplication"]:1981 if form_factor is None or not form_factor.is_form_factor: 2070 1982 self.structurebox.Hide() 2071 1983 self.text2.Hide() … … 3474 3386 self.by_model_dict = defaultdict(list) 3475 3387 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() 3490 3392 3491 3393 def _regenerate_model_dict(self):
Note: See TracChangeset
for help on using the changeset viewer.