Changeset 17e2d502 in sasview for src/sas/qtgui/MainWindow/DataExplorer.py
- 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
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.