Changeset 5ef55d2 in sasview for sansview/perspectives
- Timestamp:
- Mar 9, 2011 7:00:04 PM (14 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 99abf5d
- Parents:
- bfa73ca
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r6bbeacd4 r5ef55d2 1653 1653 qstep= float(self.npts_x), 1654 1654 id=self.id, 1655 state = self.state, 1655 1656 enable2D=self.enable2D) 1656 1657 -
sansview/perspectives/fitting/fitting.py
r883e5f5 r5ef55d2 316 316 317 317 data.group_id = state.data.group_id 318 self.parent.add_data(data_list=[data]) 318 319 wx.PostEvent(self.parent, NewPlotEvent(plot=data, 319 320 title=data.title)) 320 321 page = self.fit_panel.set_state(state) 321 322 else: 323 self.parent.add_data(data_list=[data]) 322 324 wx.PostEvent(self.parent, NewPlotEvent(plot=data, 323 325 title=data.title)) … … 452 454 def draw_model(self, model, id, data=None, smearer=None, 453 455 enable1D=True, enable2D=False, 456 state=None, 454 457 qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, qstep=DEFAULT_NPTS): 455 458 """ … … 477 480 qmin=qmin, 478 481 qmax=qmax, 482 state=state, 479 483 qstep=qstep) 480 484 else: … … 487 491 qmin=qmin, 488 492 qmax=qmax, 493 state=state, 489 494 qstep=qstep) 490 495 … … 629 634 get this page and store it into the page_finder of this plug-in 630 635 """ 636 631 637 page = self.fit_panel.set_data(data) 632 638 page_caption = page.window_name 633 639 #append Data1D to the panel containing its theory 634 640 #if theory already plotted 641 635 642 if page.id in self.page_finder: 636 643 theory_data = self.page_finder[page.id].get_theory_data() … … 642 649 if group_id not in data.group_id: 643 650 data.group_id.append(group_id) 651 self.parent.update_data(prev_data=theory_data, new_data=data) 652 644 653 self.store_data(id=page.id, data=data, caption=page.window_name) 645 654 if self.sim_page is not None: … … 1079 1088 1080 1089 1081 def _complete1D(self, x,y, id, elapsed,index,model, data=None):1090 def _complete1D(self, x,y, id, elapsed,index,model,state=None, data=None): 1082 1091 """ 1083 1092 Complete plotting 1D data … … 1095 1104 theory_data = self.page_finder[id].get_theory_data() 1096 1105 if theory_data is not None: 1097 print "theory_data", theory_data.group_id1098 1106 group_id = theory_data.group_id[len(theory_data.group_id)-1] 1099 1107 if group_id not in data.group_id: 1100 1108 data.group_id.append(group_id) 1101 print "data", data.group_id1102 1109 #data is plotted before the theory, then take its group_id 1103 1110 #assign to the new theory … … 1126 1133 new_plot.yaxis(_yaxis, _yunit) 1127 1134 self.page_finder[id].set_theory_data(new_plot) 1128 1129 1135 if data is None: 1130 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1131 title=str(new_plot.title))) 1136 theory_data = self.page_finder[id].get_theory_data() 1137 self.parent.add_data_helper(data_list=[theory_data]) 1138 data_id = theory_data.id 1132 1139 else: 1133 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1140 data_id = data.id 1141 self.parent.append_theory(data_id=data_id, 1142 theory=new_plot, state=state) 1143 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1134 1144 title= str(new_plot.title))) 1135 1145 current_pg = self.fit_panel.get_page_by_id(id) … … 1156 1166 1157 1167 def _complete2D(self, image, data, model, id, elapsed, index, qmin, 1158 qmax, qstep=DEFAULT_NPTS):1168 qmax, state=None,qstep=DEFAULT_NPTS): 1159 1169 """ 1160 1170 Complete get the result of modelthread and create model 2D … … 1193 1203 theory.xmin = data.xmin 1194 1204 theory.xmax = data.xmax 1205 theory.name = model.name + " ["+ str(model.__class__.__name__)+ "]" 1195 1206 theory.title = "Analytical model 2D " 1196 self.page_finder[id].set_theory_data(theory) 1197 1207 theory_data = deepcopy(theory) 1208 theory_data.name = "Unknown" 1209 self.page_finder[id].set_theory_data(theory_data) 1210 1211 if data is None: 1212 theory_data = self.page_finder[id].get_theory_data() 1213 self.parent.add_data_helper(data_list=[theory_data]) 1214 data_id = theory_data.id 1215 else: 1216 data_id = data.id 1217 self.parent.append_theory(data_id=data_id, 1218 theory=theory, state=state) 1219 1198 1220 ## plot 1199 1221 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, … … 1208 1230 def _draw_model2D(self, model, id, data=None, smearer=None, 1209 1231 description=None, enable2D=False, 1232 state=None, 1210 1233 qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, 1211 1234 qstep=DEFAULT_NPTS): … … 1257 1280 qmax=qmax, 1258 1281 qstep=qstep, 1282 state=state, 1259 1283 completefn=self._complete2D, 1260 1284 updatefn=self._update2D) … … 1269 1293 def _draw_model1D(self, model, id, data=None, smearer=None, 1270 1294 qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, 1295 state=None, 1271 1296 qstep=DEFAULT_NPTS, enable1D=True): 1272 1297 """ … … 1305 1330 qmax=qmax, 1306 1331 smearer=smearer, 1332 state=state, 1307 1333 completefn=self._complete1D, 1308 1334 updatefn=self._update1D) -
sansview/perspectives/fitting/model_thread.py
r6bbeacd4 r5ef55d2 16 16 def __init__(self, x, y, data,model,smearer,qmin, qmax,qstep, 17 17 id , 18 state=None, 18 19 completefn = None, 19 20 updatefn = None, … … 33 34 self.data= data 34 35 self.page_id = id 36 self.state = None 35 37 # the model on to calculate 36 38 self.model = model … … 121 123 id=self.page_id, 122 124 model=self.model, 125 state=self.state, 123 126 elapsed=elapsed, 124 127 index=index_model, … … 138 141 qmax=None, 139 142 smearer=None, 143 state=None, 140 144 completefn = None, 141 145 updatefn = None, … … 154 158 self.qmax= qmax 155 159 self.model = model 160 self.state = state 156 161 self.page_id = id 157 162 self.smearer= smearer … … 178 183 self.complete(x=self.x[index], y=output[index], 179 184 id=self.page_id, 185 state=self.state, 180 186 elapsed=elapsed,index=index, model=self.model, 181 187 data=self.data) -
sansview/perspectives/fitting/pagestate.py
r90a7bbd r5ef55d2 329 329 rep += "parameter unit: %s\n\n"%str(item[7]) 330 330 return rep 331 331 332 332 def __repr__(self): 333 333 """
Note: See TracChangeset
for help on using the changeset viewer.