def showAdaptiveRefineSchemes(self): if self.adaptiveRefineRadio.isChecked(): foundLibs = LocalExecutionModule.getPsuadeInstalledModules(); foundMETIS = foundLibs['METIS'] self.schemesList.clear() self.schemesList.addItem(SamplingMethods.getFullName(SamplingMethods.METIS)) if not foundMETIS: item = self.schemesList.item(0) text = item.text() item.setText(text + ' (Not installed)') flags = item.flags() item.setFlags(flags & ~Qt.ItemIsEnabled)
def showAllSchemes(self): if self.chooseSchemeRadio.isChecked(): foundLibs = LocalExecutionModule.getPsuadeInstalledModules(); foundMETIS = foundLibs['METIS'] self.schemesList.clear() self.schemesList.addItems(SamplingMethods.fullNames[:-2]) # Remove GMETIS if not foundMETIS: item = self.schemesList.item(SamplingMethods.METIS) text = item.text() item.setText(text + ' (Not installed)') flags = item.flags() item.setFlags(flags & ~Qt.ItemIsEnabled)
def __init__(self, model, session, viewOnly=False, returnDataSignal=None, parent=None): super(SimSetup, self).__init__(parent) self.setupUi(self) self.viewOnly = viewOnly self.returnDataSignal = returnDataSignal self.sampleFileSet = ( set() ) # Contains which inputs are of the distribution "Sample from File" self.fsDataBrowser = dataBrowserFrame(session, self) self.dataViewWidget.setLayout(QStackedLayout(self.dataViewWidget)) self.dataViewWidget.layout().addWidget(self.fsDataBrowser) self.fsDataBrowser.refreshContents() self.fileLoaded = False self.samplesGenerated = False self.currentArchiveData = None self.model = model self.session = session if isinstance(model, Model): data = SampleData(model) dists = [] for i in range(model.getNumInputs()): dists = dists + ["U"] data.setInputDistributions(dists) else: data = model self.currentArchiveData = data self.ignoreDistributionCheck = False if model.getRunType() == Model.EMULATOR: self.flowsheetDataRadio.setHidden(True) if viewOnly: self.loadSamplesRadio.setEnabled(False) self.flowsheetDataRadio.setEnabled(False) self.loadSamplesRadio.clicked.connect(self.setPage) self.flowsheetDataRadio.clicked.connect(self.setPage) self.chooseSchemeRadio.clicked.connect(self.setPage) self.setPage() self.browseButton.clicked.connect(self.loadSampleFile) # self.cancelButton.clicked.connect(self.reject) self.cancelButton.clicked.connect(self.cancel) self.previewButton.clicked.connect(self.preview) self.previewButton.setEnabled(False) # self.doneButton.clicked.connect(self.accept) self.doneButton.clicked.connect(self.doneClicked) self.doneButton.setEnabled(False) if viewOnly: self.cancelButton.setText("OK") self.doneButton.setHidden(True) self.samplingTabs.setTabEnabled(1, False) # Make sure appropriate option is visible # self.chooseSchemeRadio.setChecked(True) # self.showChooseSchemePage() if not isinstance(model, Model): if model.getInputData() is not None: self.previewButton.setEnabled(True) if not viewOnly: self.doneButton.setEnabled(True) self.runData = model # Make sure distribution tab is showing self.samplingTabs.setCurrentIndex(0) self.samplingTabs.currentChanged[int].connect(self.checkDists) # Set up distributions table self.distTable.init(model, InputPriorTable.SIMSETUP, viewOnly=viewOnly) self.allFixedButton.clicked.connect(self.makeAllFixed) self.allVariableButton.clicked.connect(self.makeAllVariable) if viewOnly or model.getRunType() == Model.EMULATOR: self.allFixedButton.setHidden(True) self.allVariableButton.setHidden(True) # Set up sampling schemes tab self.generateSamplesButton.setEnabled(False) self.generateStatusText.setText("") self.allSchemesRadio.setChecked(True) foundLibs = LocalExecutionModule.getPsuadeInstalledModules() foundMETIS = foundLibs["METIS"] self.schemesList.clear() self.schemesList.addItems(SamplingMethods.fullNames[:-2] ) # Leave out GMETIS and FULL Factorial if not foundMETIS: item = self.schemesList.item(SamplingMethods.METIS) text = item.text() item.setText(text + " (Not installed)") flags = item.flags() item.setFlags(flags & ~Qt.ItemIsEnabled) if isinstance(model, SampleData): self.schemesList.setCurrentRow(model.getSampleMethod()) self.generateSamplesButton.setEnabled(True) # Change lists of schemes displayed self.allSchemesRadio.toggled.connect(self.showAllSchemes) self.paramScreenRadio.toggled.connect(self.showParamScreenSchemes) self.adaptiveRefineRadio.toggled.connect( self.showAdaptiveRefineSchemes) self.otherRadio.toggled.connect(self.showOtherSchemes) self.schemesList.currentItemChanged.connect( self.handleGenerateSamplesButton) self.generateSamplesButton.clicked.connect(self.generateSamples)