- Timestamp:
- Dec 20, 2016 7:59:08 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.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:
- b61bd57
- Parents:
- d3911e3 (diff), 06a4306 (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
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/manipulations.py
rb699768 rb2b36932 143 143 :return: Data1D object 144 144 """ 145 if len(data2D.detector) !=1:145 if len(data2D.detector) > 1: 146 146 msg = "_Slab._avg: invalid number of " 147 147 msg += " detectors: %g" % len(data2D.detector) … … 299 299 error on number of counts, number of entries summed 300 300 """ 301 if len(data2D.detector) !=1:301 if len(data2D.detector) > 1: 302 302 msg = "Circular averaging: invalid number " 303 303 msg += "of detectors: %g" % len(data2D.detector) -
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r5e906207 rbbd0f37 162 162 else: 163 163 self.current_dataset.x = data_set.flatten() 164 continue 165 elif key == u'Qdev': 166 self.current_dataset.dx = data_set.flatten() 164 167 continue 165 168 elif key == u'Qy': -
src/sas/sasgui/guiframe/gui_manager.py
rd3911e3 r505706a 1950 1950 item, _, _ = value 1951 1951 item.Check(True) 1952 self._data_panel.on_remove(None, False)1953 1952 1954 1953 wx.PostEvent(self, StatusEvent(status="Loading Project file...")) … … 1963 1962 # Reset to a base state 1964 1963 self._on_reset_state() 1964 self._data_panel.on_remove(None, False) 1965 1965 # Load the project file 1966 1966 self.load_state(path=path, is_project=True) … … 2458 2458 group_id=group_id, 2459 2459 action='remove')) 2460 # remove res plot: Todo: improve2461 2460 wx.CallAfter(self._remove_res_plot, new_plot.id) 2462 2461 self._data_manager.delete_data(data_id=data_id, -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
r1a696bf rb2b36932 316 316 317 317 slicerpop.AppendSeparator() 318 if len(self.data2D.detector) == 1:318 if len(self.data2D.detector) <= 1: 319 319 item_list = self.parent.get_current_context_menu(self) 320 320 if (not item_list == None) and (not len(item_list) == 0) and\ -
src/sas/sasgui/perspectives/fitting/basepage.py
rd3911e3 r505706a 52 52 FONT_VARIANT = 1 53 53 ON_MAC = True 54 55 54 56 55 class BasicPage(ScrolledPanel, PanelBase): … … 1042 1041 disp_model = POLYDISPERSITY_MODELS['array']() 1043 1042 if hasattr(state, "values") and \ 1044 self.disp_cb_dict[item].GetValue() is True:1043 self.disp_cb_dict[item].GetValue(): 1045 1044 if len(state.values) > 0: 1046 1045 self.values = state.values … … 1435 1434 self.qmax_x = tempmax 1436 1435 is_modified = True 1437 1438 1436 if is_2Ddata: 1439 # set mask1440 1437 is_modified = self._validate_Npts() 1441 1438 else: 1439 is_modified = self._validate_Npts_1D() 1442 1440 else: 1443 1441 self.fitrange = False … … 1454 1452 # Theory case: need to get npts value to draw 1455 1453 self.npts_x = float(self.Npts_total.GetValue()) 1454 self.Npts_fit.SetValue(str(self.Npts_total.GetValue())) 1455 self._save_plotting_range() 1456 1456 self.create_default_data() 1457 1457 self.state_change = True 1458 1458 self._draw_model() 1459 # Time delay has been introduced to prevent _handle error 1460 # on Windows 1461 # This part of code is executed when model is selected and 1462 # it's parameters are changed (with respect to previously 1463 # selected model). There are two Iq evaluations occuring one 1464 # after another and therefore there may be compilation error 1465 # if model is calculated for the first time. 1466 # This seems to be Windows only issue - haven't tested on Linux 1467 # though.The proper solution (other than time delay) requires 1468 # more fundemental code refatoring 1469 # Wojtek P. Nov 7, 2016 1470 if not ON_MAC: 1471 time.sleep(0.1) 1459 1472 self.Refresh() 1460 1473 … … 2167 2180 flag = False 2168 2181 else: 2169 self.Npts_fit.SetValue(str(len(index_data[index_data is True])))2182 self.Npts_fit.SetValue(str(len(index_data[index_data]))) 2170 2183 self.fitrange = True 2171 2184 … … 2391 2404 2392 2405 # Redraw the model 2393 self._draw_model() 2406 # Wojtek P. Nov 7, 2016: Redrawing seems to be unnecessary here 2407 # self._draw_model() 2394 2408 # self._undo.Enable(True) 2395 2409 event = PageInfoEvent(page=self) … … 2610 2624 Layout after self._draw_model 2611 2625 """ 2612 if ON_MAC is True:2626 if ON_MAC: 2613 2627 time.sleep(1) 2614 2628 -
src/sas/sasgui/perspectives/fitting/fitpage.py
rc8e1996 rbf44249e 81 81 flag = check_data_validity(self.data) & (self.model is not None) 82 82 self.btFit.Enable(flag) 83 83 84 84 def on_set_focus(self, event): 85 85 """ 86 Override the basepage focus method to ensure the save flag is set 86 Override the basepage focus method to ensure the save flag is set 87 87 properly when focusing on the fit page. 88 88 """ … … 238 238 239 239 weighting_set_box = wx.StaticBox(self, wx.ID_ANY, 240 'Set Weighting by Selecting dI Source')240 'Set Weighting by Selecting dI Source') 241 241 weighting_box = wx.StaticBoxSizer(weighting_set_box, wx.HORIZONTAL) 242 242 sizer_weighting = wx.BoxSizer(wx.HORIZONTAL) … … 1164 1164 if event is not None: 1165 1165 if (event.GetEventObject() == self.formfactorbox 1166 1167 1168 1166 and self.structurebox.GetLabel() != 'None')\ 1167 or event.GetEventObject() == self.structurebox\ 1168 or event.GetEventObject() == self.multifactorbox: 1169 1169 copy_flag = self.get_copy_params() 1170 1170 is_poly_enabled = self.enable_disp.GetValue() … … 1205 1205 self._keep.Enable(not self.batch_on) 1206 1206 self._set_save_flag(True) 1207 self._set_smear(self.data) 1207 #Setting smearing for cases with and without data. 1208 self._set_smear(self.data) 1208 1209 1209 1210 # more disables for 2D … … 1212 1213 try: 1213 1214 # update smearer sizer 1214 self.onSmear(None) 1215 #This call for smearing set up caused double evaluation of 1216 #I(q) and double compilation as results 1217 #self.onSmear(None) 1215 1218 temp_smear = None 1216 1219 if not self.disable_smearer.GetValue(): … … 1226 1229 # set smearing value whether or not data contain the smearing info 1227 1230 evt = ModelEventbox(model=self.model, 1228 smearer=temp_smear,1229 enable_smearer=not self.disable_smearer.GetValue(),1230 qmin=float(self.qmin_x),1231 uid=self.uid,1232 caption=self.window_caption,1233 qmax=float(self.qmax_x))1231 smearer=temp_smear, 1232 enable_smearer=not self.disable_smearer.GetValue(), 1233 qmin=float(self.qmin_x), 1234 uid=self.uid, 1235 caption=self.window_caption, 1236 qmax=float(self.qmax_x)) 1234 1237 1235 1238 self._manager._on_model_panel(evt=evt) -
src/sas/sasgui/perspectives/fitting/fitpanel.py
rc8e1996 r67b0a99 189 189 # use while-loop, for-loop will not do the job well. 190 190 while (self.GetPageCount() > 0): 191 # delete the first page until no page exists 192 page = self.GetPage(0) 191 page = self.GetPage(self.GetPageCount() - 1) 193 192 if self._manager.parent.panel_on_focus == page: 194 193 self._manager.parent.panel_on_focus = None 195 194 self._close_helper(selected_page=page) 196 self.DeletePage( 0)195 self.DeletePage(self.GetPageCount() - 1) 197 196 # Clear list of names 198 197 self.fit_page_name = {} … … 400 399 temp = self.GetSelection() 401 400 self.DeletePage(temp) 401 if self.sim_page is not None: 402 if len(self.sim_page.model_list) == 0: 403 pos = self.GetPageIndex(self.sim_page) 404 self.SetSelection(pos) 405 self.on_close_page(event=None) 406 temp = self.GetSelection() 407 self.DeletePage(temp) 408 self.sim_page = None 409 self.batch_on = False 402 410 if self.GetPageCount() == 0: 403 411 self._manager.on_add_new_page(event=None) -
src/sas/sasgui/perspectives/fitting/fitting.py
r1a5d5f2 r06a4306 864 864 enable1D=enable1D, enable2D=enable2D, 865 865 qmin=qmin, qmax=qmax, weight=weight) 866 self._mac_sleep(0.2)867 866 868 867 def _mac_sleep(self, sec=0.2): … … 1964 1963 ## May need rethinking 1965 1964 ## 1966 ## -PDB August 12, 2014 1965 ## -PDB August 12, 2014 1967 1966 while self.calc_1D.isrunning(): 1968 1967 time.sleep(0.1) -
src/sas/sascalc/data_util/qsmearing.py
r345e7e4 rd3911e3 41 41 elif data.dqx_data == None or data.dqy_data == None: 42 42 return None 43 return P inhole2D(data)43 return PySmear2D(data, model) 44 44 45 45 if not hasattr(data, "dx") and not hasattr(data, "dxl")\ … … 142 142 width = data.dx if data.dx is not None else 0 143 143 return PySmear(Pinhole1D(q, width), model) 144 145 146 class PySmear2D(object): 147 """ 148 Q smearing class for SAS 2d pinhole data 149 """ 150 151 def __init__(self, data=None, model=None): 152 self.data = data 153 self.model = model 154 self.accuracy = 'Low' 155 self.limit = 3.0 156 self.index = None 157 self.coords = 'polar' 158 self.smearer = True 159 160 def set_accuracy(self, accuracy='Low'): 161 """ 162 Set accuracy. 163 164 :param accuracy: string 165 """ 166 self.accuracy = accuracy 167 168 def set_smearer(self, smearer=True): 169 """ 170 Set whether or not smearer will be used 171 172 :param smearer: smear object 173 174 """ 175 self.smearer = smearer 176 177 def set_data(self, data=None): 178 """ 179 Set data. 180 181 :param data: DataLoader.Data_info type 182 """ 183 self.data = data 184 185 def set_model(self, model=None): 186 """ 187 Set model. 188 189 :param model: sas.models instance 190 """ 191 self.model = model 192 193 def set_index(self, index=None): 194 """ 195 Set index. 196 197 :param index: 1d arrays 198 """ 199 self.index = index 200 201 def get_value(self): 202 """ 203 Over sampling of r_nbins times phi_nbins, calculate Gaussian weights, 204 then find smeared intensity 205 """ 206 if self.smearer: 207 res = Pinhole2D(data=self.data, index=self.index, 208 nsigma=3.0, accuracy=self.accuracy, 209 coords=self.coords) 210 val = self.model.evalDistribution(res.q_calc) 211 return res.apply(val) 212 else: 213 index = self.index if self.index is not None else slice(None) 214 qx_data = self.data.qx_data[index] 215 qy_data = self.data.qy_data[index] 216 q_calc = [qx_data, qy_data] 217 val = self.model.evalDistribution(q_calc) 218 return val 219 -
src/sas/sascalc/fit/AbstractFitEngine.py
r345e7e4 rd3911e3 359 359 if self.smearer != None: 360 360 fn.set_index(self.idx) 361 # Get necessary data from self.data and set the data for smearing362 fn.get_data()363 364 361 gn = fn.get_value() 365 362 else: -
src/sas/sasgui/perspectives/fitting/model_thread.py
r286c757 rd3911e3 82 82 fn.set_model(self.model) 83 83 fn.set_index(index_model) 84 # Get necessary data from self.data and set the data for smearing85 fn.get_data()86 84 # Calculate smeared Intensity 87 85 #(by Gaussian averaging): DataLoader/smearing2d/Smearer2D() … … 89 87 else: 90 88 # calculation w/o smearing 91 value = self.model.evalDistribution(\ 92 [self.data.qx_data[index_model], 93 self.data.qy_data[index_model]]) 89 value = self.model.evalDistribution([ 90 self.data.qx_data[index_model], 91 self.data.qy_data[index_model] 92 ]) 94 93 output = numpy.zeros(len(self.data.qx_data)) 95 94 # output default is None
Note: See TracChangeset
for help on using the changeset viewer.