Changeset 17e2d502 in sasview
- Timestamp:
- Nov 5, 2018 2:58:21 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 490e230
- Parents:
- 4396300
- Location:
- src/sas/qtgui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r4396300 r17e2d502 373 373 374 374 all_data = {} 375 all_data['is_batch'] = str(self.chkBatch.isChecked()) 376 375 377 for key, value in data.items(): 376 378 all_data[key] = value … … 414 416 415 417 for key, value in all_data.items(): 416 data_dict = {key:value['fit_data']} 417 items = self.updateModelFromData(data_dict) 418 # send newly created item to its perspective 419 if 'fit_params' in value: 418 if key=='is_batch': 419 self.chkBatch.setChecked(True if value=='True' else False) 420 continue 421 # send newly created items to the perspective 422 self.updatePerspectiveWithProperties(key, value) 423 424 # See if there are any batch pages defined and create them, if so 425 self.updateWithBatchPages(all_data) 426 427 def updateWithBatchPages(self, all_data): 428 """ 429 Checks all properties and see if there are any batch pages defined. 430 If so, pull out relevant indices and recreate the batch page(s) 431 """ 432 batch_page_counter = 0 433 # {counter:[[item1, item2,...], {properties}]} 434 batch_page_dict = {} 435 batch_pages = [] 436 for key, value in all_data.items(): 437 if 'fit_params' not in value: 438 continue 439 params = value['fit_params'] 440 for page in params: 441 if page['is_batch_fitting'][0] != 'True': 442 continue 443 batch_ids = page['data_id'] 444 batch_pages.append(batch_ids) 445 # Now we have all batchpages in batch_pages. 446 # remove duplicates 447 #for page in batch_pages: 448 # if page in 449 450 def updatePerspectiveWithProperties(self, key, value): 451 """ 452 """ 453 data_dict = {key:value['fit_data']} 454 # Create new model items in the data explorer 455 items = self.updateModelFromData(data_dict) 456 457 if 'fit_params' in value: 458 params = value['fit_params'] 459 # Make the perspective read the rest of the read data 460 if not isinstance(params, list): 461 params = [params] 462 for page in params: 463 # Check if this set of parameters is for a batch page 464 # if so, skip the update 465 if page['is_batch_fitting'][0] == 'True': 466 continue 467 # Send current model item to the perspective 420 468 self.sendItemToPerspective(items[0]) 421 # Make the perspective read the rest of the read data 422 self._perspective().updateFromParameters(value['fit_params']) 423 469 # Assign parameters to the most recent (current) page. 470 self._perspective().updateFromParameters(page) 424 471 pass # debugger 425 472 … … 430 477 with open(filename, 'r') as infile: 431 478 all_data = GuiUtils.readDataFromFile(infile) 432 # simulate full project structure 433 all_data_dict = {1:all_data['fit_data']} 434 items = self.updateModelFromData(all_data_dict) 435 # TODO: allow other perspectives 436 # send newly created item to its perspective 437 if len(items) > 0: 438 self.sendItemToPerspective(items[0]) 439 # Make the perspective read the rest of the read data 440 self._perspective().updateFromParameters(all_data['fit_params']) 441 442 pass 479 480 # send newly created items to the perspective 481 self.updatePerspectiveWithProperties(1, all_data) 443 482 444 483 def updateModelFromData(self, data): … … 449 488 # model items for top level datasets 450 489 items = [] 451 #self.model.beginResetModel()452 490 for key, value in data.items(): 453 491 # key - cardinal number of dataset … … 455 493 # add the main index 456 494 if not value: continue 495 #if key=='is_batch': 496 # self.chkBatch.setChecked(True if value=='True' else False) 497 # continue 457 498 new_data = value[0] 458 499 from sas.sascalc.dataloader.data_info import Data1D as old_data1d -
src/sas/qtgui/MainWindow/GuiManager.py
r186d678 r17e2d502 579 579 580 580 for id, data in all_data.items(): 581 if id=='is_batch': 582 analysis['is_batch'] = data 583 continue 581 584 data_content = {"fit_data":data} 582 585 if id in params.keys(): -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
ra3c59503 r17e2d502 120 120 tab_data = self.getSerializedFitpage(tab) 121 121 if tab.tab_id is None: continue 122 if 'data_id' not in tab_data: continue 122 123 id = tab_data['data_id'][0] 123 params[id] = tab_data 124 if isinstance(id, list): 125 for i in id: 126 if i in params: 127 params[i].append(tab_data) 128 else: 129 params[i] = [tab_data] 130 else: 131 if id in params: 132 params[id].append(tab_data) 133 else: 134 params[id] = [tab_data] 124 135 return params 125 136 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r48df831 r17e2d502 3512 3512 3513 3513 param_list.append(['is_data', str(self.data_is_loaded)]) 3514 if self.data_is_loaded: 3515 param_list.append(['data_id', str(self.logic.data.id)]) 3516 param_list.append(['data_name', str(self.logic.data.filename)]) 3517 3514 data_ids = [] 3515 filenames = [] 3516 if self.is_batch_fitting: 3517 for item in self.all_data: 3518 # need item->data->data_id 3519 data = GuiUtils.dataFromItem(item) 3520 data_ids.append(data.id) 3521 filenames.append(data.filename) 3522 else: 3523 if self.data_is_loaded: 3524 data_ids = [str(self.logic.data.id)] 3525 filenames = [str(self.logic.data.filename)] 3526 param_list.append(['is_batch_fitting', str(self.is_batch_fitting)]) 3527 param_list.append(['data_name', filenames]) 3528 param_list.append(['data_id', data_ids]) 3518 3529 # option tab 3519 3530 param_list.append(['q_range_min', str(self.q_range_min)]) -
src/sas/qtgui/Utilities/GuiUtils.py
r4396300 r17e2d502 1198 1198 def readDataFromFile(fp): 1199 1199 ''' 1200 Reads in Data1D/Data2 datasets from the file. 1201 Datasets are stored in the JSON format. 1200 1202 ''' 1201 1203 supported = [
Note: See TracChangeset
for help on using the changeset viewer.