def performParameterExploration(self): """ performParameterExploration() -> None Perform the exploration by collecting a list of actions corresponding to each dimension """ actions = self.peWidget.table.collectParameterActions() if self.controller.current_pipeline and actions: explorer = ActionBasedParameterExploration() (pipelines, performedActions) = explorer.explore( self.controller.current_pipeline, actions) dim = [max(1, len(a)) for a in actions] if (registry.has_module('edu.utah.sci.vistrails.spreadsheet', 'CellLocation') and registry.has_module('edu.utah.sci.vistrails.spreadsheet', 'SheetReference')): modifiedPipelines = self.virtualCell.positionPipelines( 'PE#%d %s' % (QParameterExplorationTab.explorationId, self.controller.name), dim[2], dim[1], dim[0], pipelines) else: modifiedPipelines = pipelines mCount = [] for p in modifiedPipelines: if len(mCount)==0: mCount.append(0) else: mCount.append(len(p.modules)+mCount[len(mCount)-1]) # Now execute the pipelines totalProgress = sum([len(p.modules) for p in modifiedPipelines]) progress = QtGui.QProgressDialog('Performing Parameter ' 'Exploration...', '&Cancel', 0, totalProgress) progress.setWindowTitle('Parameter Exploration') progress.setWindowModality(QtCore.Qt.WindowModal) progress.show() QParameterExplorationTab.explorationId += 1 interpreter = get_default_interpreter() for pi in xrange(len(modifiedPipelines)): progress.setValue(mCount[pi]) QtCore.QCoreApplication.processEvents() if progress.wasCanceled(): break def moduleExecuted(objId): if not progress.wasCanceled(): progress.setValue(progress.value()+1) QtCore.QCoreApplication.processEvents() interpreter.execute( None, modifiedPipelines[pi], self.controller.locator, self.controller.current_version, self.controller.current_pipeline_view, moduleExecutedHook=[moduleExecuted], reason='Parameter Exploration', actions=performedActions[pi]) progress.setValue(totalProgress)
def inspect_spreadsheet_cells(self, pipeline): """ inspect_spreadsheet_cells(pipeline: Pipeline) -> None Inspect the pipeline to see how many cells is needed """ self.spreadsheet_cells = [] if not pipeline: return # Sometimes we run without the spreadsheet! if registry.has_module('edu.utah.sci.vistrails.spreadsheet', 'SpreadsheetCell'): # First pass to check cells types cellType = registry.get_descriptor_by_name('edu.utah.sci.vistrails.spreadsheet', 'SpreadsheetCell').module for mId, module in pipeline.modules.iteritems(): desc = registry.get_descriptor_by_name(module.package, module.name, module.namespace) if issubclass(desc.module, cellType): self.spreadsheet_cells.append(mId)