Changeset 9b5e70c in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- Apr 9, 2017 9:28:45 AM (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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- a9f9ca4
- Parents:
- 7b8e843 (diff), d26f025 (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. - Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/batchfitpage.py
ree4b3cb r7432acb 200 200 # self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection() 201 201 # 202 # if self.model !=None:202 # if self.model is not None: 203 203 # self._set_copy_flag(True) 204 204 # self._set_paste_flag(True) 205 # if self.data !=None:205 # if self.data is not None: 206 206 # self._set_bookmark_flag(False) 207 207 # self._keep.Enable(False) … … 225 225 # 226 226 # 227 # if event !=None:227 # if event is not None: 228 228 # ## post state to fit panel 229 229 # new_event = PageInfoEvent(page = self) … … 254 254 # is_modified = False 255 255 # 256 # if self.model != None:256 # if self.model is not None: 257 257 # ##Check the values 258 258 # self._check_value_enter( self.fittable_param) … … 291 291 # else: 292 292 # #self.btFit.Enable(True) 293 # if self._is_2D() and self.data !=None:293 # if self._is_2D() and self.data is not None: 294 294 # self.btEditMask.Enable(True) 295 295 # … … 335 335 # self._set_save_flag(False) 336 336 # else: 337 # if self.model !=None:337 # if self.model is not None: 338 338 # self._set_bookmark_flag(False) 339 339 # self._keep.Enable(False) -
src/sas/sasgui/perspectives/fitting/fitting.py
r9c0f3c17 r7432acb 302 302 Make new model 303 303 """ 304 if self.new_model_frame !=None:304 if self.new_model_frame is not None: 305 305 self.new_model_frame.Show(False) 306 306 self.new_model_frame.Show(True) … … 386 386 help for setting list of the edit model menu labels 387 387 """ 388 if menu ==None:388 if menu is None: 389 389 menu = self.edit_custom_model 390 390 list_fnames = os.listdir(models.find_plugins_dir()) … … 441 441 wx.PostEvent(self.parent, StatusEvent(status=msg)) 442 442 443 if page !=None:443 if page is not None: 444 444 return set_focus_page(page) 445 445 if caption == "Const & Simul Fit": … … 634 634 state = self.temp_state[self.state_index] 635 635 #panel state should have model selection to set_state 636 if state.formfactorcombobox !=None:636 if state.formfactorcombobox is not None: 637 637 #set state 638 638 data = self.parent.create_gui_data(state.data) … … 1016 1016 return False 1017 1017 ## If a thread is already started, stop it 1018 #if self.calc_fit !=None and self.calc_fit.isrunning():1018 #if self.calc_fitis not None and self.calc_fit.isrunning(): 1019 1019 # self.calc_fit.stop() 1020 1020 msg = "Fitting is in progress..." … … 1106 1106 page = self.fit_panel.add_empty_page() 1107 1107 # add data associated to the page created 1108 if page !=None:1108 if page is not None: 1109 1109 evt = StatusEvent(status="Page Created", info="info") 1110 1110 wx.PostEvent(self.parent, evt) … … 1125 1125 page = self.fit_panel.set_data(data) 1126 1126 # page could be None when loading state files 1127 if page ==None:1127 if page is None: 1128 1128 return page 1129 1129 #append Data1D to the panel containing its theory … … 1193 1193 """ 1194 1194 # case that uid is not specified 1195 if uid ==None:1195 if uid is None: 1196 1196 for page_id in self.page_finder.keys(): 1197 1197 self.page_finder[page_id].schedule_tofit(value) … … 1216 1216 for item in param: 1217 1217 ## check if constraint 1218 if item[0] != None and item[1] !=None:1218 if item[0] is not None and item[1] is not None: 1219 1219 listOfConstraint.append((item[0], item[1])) 1220 1220 new_model = model … … 1231 1231 """ 1232 1232 panel = self.plot_panel 1233 if panel ==None:1233 if panel is None: 1234 1234 raise ValueError, "Fitting:_onSelect: NonType panel" 1235 1235 Plugin.on_perspective(self, event=event) … … 1335 1335 if not correct_result or res.fitness is None or \ 1336 1336 not np.isfinite(res.fitness) or \ 1337 np.any(res.pvec ==None) or not \1337 np.any(res.pvec is None) or not \ 1338 1338 np.all(np.isfinite(res.pvec)): 1339 1339 data_name = str(None) … … 1457 1457 cell.value = index 1458 1458 1459 if theory_data !=None:1459 if theory_data is not None: 1460 1460 #Suucessful fit 1461 1461 theory_data.id = wx.NewId() … … 1526 1526 if res.fitness is None or \ 1527 1527 not np.isfinite(res.fitness) or \ 1528 np.any(res.pvec ==None) or \1528 np.any(res.pvec is None) or \ 1529 1529 not np.all(np.isfinite(res.pvec)): 1530 1530 fit_msg += "\nFitting did not converge!!!" … … 1544 1544 #(CallAfter is important to MAC) 1545 1545 try: 1546 #if res !=None:1546 #if res is not None: 1547 1547 wx.CallAfter(cpage.onsetValues, res.fitness, 1548 1548 res.param_list, … … 1587 1587 """ 1588 1588 event.Skip() 1589 if self.menu1 ==None:1589 if self.menu1 is None: 1590 1590 return 1591 1591 menu_item = self.menu1.FindItemById(self.id_reset_flag) … … 1646 1646 caption = evt.caption 1647 1647 enable_smearer = evt.enable_smearer 1648 if model ==None:1648 if model is None: 1649 1649 return 1650 1650 if uid not in self.page_finder.keys(): … … 1698 1698 new_plot.title = data.name 1699 1699 new_plot.group_id = data.group_id 1700 if new_plot.group_id ==None:1700 if new_plot.group_id is None: 1701 1701 new_plot.group_id = data.group_id 1702 1702 new_plot.id = data_id … … 2002 2002 chisqr = None 2003 2003 #to compute chisq make sure data has valid data 2004 # return None if data ==None2005 if not check_data_validity(data_copy) or data_copy ==None:2004 # return None if data is None 2005 if not check_data_validity(data_copy) or data_copy is None: 2006 2006 return chisqr 2007 2007 2008 2008 # Get data: data I, theory I, and data dI in order 2009 2009 if data_copy.__class__.__name__ == "Data2D": 2010 if index ==None:2010 if index is None: 2011 2011 index = np.ones(len(data_copy.data), dtype=bool) 2012 if weight !=None:2012 if weight is not None: 2013 2013 data_copy.err_data = weight 2014 2014 # get rid of zero error points … … 2017 2017 fn = data_copy.data[index] 2018 2018 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2019 if theory_data ==None:2019 if theory_data is None: 2020 2020 return chisqr 2021 2021 gn = theory_data.data[index] … … 2023 2023 else: 2024 2024 # 1 d theory from model_thread is only in the range of index 2025 if index ==None:2025 if index is None: 2026 2026 index = np.ones(len(data_copy.y), dtype=bool) 2027 if weight !=None:2027 if weight is not None: 2028 2028 data_copy.dy = weight 2029 if data_copy.dy ==None or data_copy.dy == []:2029 if data_copy.dy is None or data_copy.dy == []: 2030 2030 dy = np.ones(len(data_copy.y)) 2031 2031 else: … … 2037 2037 2038 2038 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2039 if theory_data ==None:2039 if theory_data is None: 2040 2040 return chisqr 2041 2041 gn = theory_data.y … … 2080 2080 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2081 2081 gn = theory_data.data 2082 if weight ==None:2082 if weight is None: 2083 2083 en = data_copy.err_data 2084 2084 else: … … 2101 2101 else: 2102 2102 # 1 d theory from model_thread is only in the range of index 2103 if data_copy.dy ==None or data_copy.dy == []:2103 if data_copy.dy is None or data_copy.dy == []: 2104 2104 dy = np.ones(len(data_copy.y)) 2105 2105 else: 2106 if weight ==None:2106 if weight is None: 2107 2107 dy = np.ones(len(data_copy.y)) 2108 2108 ## Set consitently w/AbstractFitengine: … … 2142 2142 ##group_id specify on which panel to plot this data 2143 2143 group_id = self.page_finder[page_id].get_graph_id() 2144 if group_id ==None:2144 if group_id is None: 2145 2145 group_id = data.group_id 2146 2146 new_plot.group_id = "res" + str(group_id) -
src/sas/sasgui/perspectives/fitting/model_thread.py
r9a5097c r7432acb 53 53 self.starttime = time.time() 54 54 # Determine appropriate q range 55 if self.qmin ==None:55 if self.qmin is None: 56 56 self.qmin = 0 57 if self.qmax ==None:58 if self.data !=None:57 if self.qmax is None: 58 if self.data is not None: 59 59 newx = math.pow(max(math.fabs(self.data.xmax), 60 60 math.fabs(self.data.xmin)), 2) -
src/sas/sasgui/perspectives/fitting/report_dialog.py
rd85c194 r7432acb 39 39 self.nimages = len(self.report_list[2]) 40 40 41 if self.report_list[2] !=None:41 if self.report_list[2] is not None: 42 42 # put image path in the report string 43 43 if len(self.report_list[2]) == 1: -
src/sas/sasgui/perspectives/fitting/simfitpage.py
r7b8e843 r9b5e70c 528 528 if not self.batch_on: 529 529 _PageAnchor = "#simultaneous-fit-mode" 530 else: 530 else: 531 531 _PageAnchor = "#combined-batch-fit-mode" 532 532 _TreeLocation = "user/sasgui/perspectives/fitting/fitting_help.html" -
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r5295cf5 r9d93c37 636 636 637 637 Example: radius [2 : 5] , radius [10 : 25] 638 639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 640 641 .. note:: This help document was last changed by Steve King, 10Oct2016 638 639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 640 641 Combined Batch Fit Mode 642 ----------------------- 643 644 Batch mode does not allow for multiple models. In other words in batch mode 645 all the data sets must be fit with single model and set of parameter. At times 646 there may be a shape change occuring in the series that requires changing the 647 model part way through the series. In this case set up two batch fit pages 648 following the instructions in :ref:`Batch Fit Mode`. However *be careful!* each 649 time a batch fit panel runs fit it will overwrite the table of values. 650 651 However there may be occassion when one wants to run these two (or more) batch 652 fits and then plot one of the common parameters (e.g. radius of shere and 653 eventually cylinder). In this case the Combined Batch Fit can be used. 654 Similarly to the Simultaneous Fit page a new page will appear. In this case, 655 instead of a check box for each fitpage model there will be a check box for each 656 batchpage. Clicking the Fit button will run each batch fit *in sequence*. 657 658 .. image:: combine_batch_page.png 659 660 The batch table will then pop up at the end as before with the following 661 caveats: 662 663 .. note:: 664 The order matters. The parameters in the table will be taken from the model 665 used in the first batch page of the list. Any parameters from the 666 second and on batch pages that have the same name as a parameter in the first 667 will show up allowing for plotting of that parameter across the models. 668 .. note:: 669 a corralary of the above is that currently models created as a sum|multiply 670 model will not work as desired because the generated model parameters have a 671 p#_ appended to the beginning and thus radius and p1_radius will not be 672 recognized as the same parameter. 673 674 .. image:: combine_batch_grid.png 675 676 In this case the series is a time series. Unfortunately the time is not listed 677 in the file but the file name contains the information. A column can be added 678 manually, in this case called time. Clicking on the top of a column will select 679 it. Clicking next on the Add button next to the x or y row will add the cell 680 information to use in a plot. The axis labels will be automatically populated 681 from the top row information. Units can be specified as well using text and a 682 subset of in line Latex. Once this is set up, in this case using the peak 683 position from the two different models for the y axis and time on the x axis, 684 one clicks the Plot button. 685 686 .. image:: combine_batch_plot.png 687 688 Note the discontinuity in the peak position. This 689 is due to the fact that the Guassian fit is actually pretty bad and is not 690 actually finding the peak. 691 692 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 693 694 .. note:: This help document was last changed by Paul Butler, 06April2017
Note: See TracChangeset
for help on using the changeset viewer.