def setupUi(self, *args): # called in MainWindowBase.__init__() # put the log widget at the bottom self.addDockWidget(Qt.BottomDockWidgetArea, self._setupLogWidget()) # file widget at the top self.toolbox = ToolBox(self) self._addToolboxItem(self._setupFileWidget()) self._addToolboxItem(self._setupDataWidget()) self._addToolboxItem(self._setupOptimWidget()) self._addToolboxItem(self._setupModelWidget()) self._addToolboxItem(self._setupStatsWidget()) # set up central widget of the main window self.centralLayout = QVBoxLayout() # put buttons in central widget self.centralLayout.addWidget(self.toolbox) self.centralLayout.addWidget(self._setupStartButton()) centralWidget = QWidget(self) centralWidget.setLayout(self.centralLayout) centralWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) self.setCentralWidget(centralWidget) self.onStartupSignal.connect(self.initUi) # set program icon, same for Win+Lin icopath = "resources/icon/mcsas.ico" if isMac(): icopath = "resources/icon/mcsas.icns" icopath = QFileInfo(makeAbsolutePath(icopath)).absoluteFilePath() self.setWindowIcon(QIcon(icopath))
def setUp(self): self.d = Driver() self.d.show() self.d.raise_() self.debug = self.d.config.debug QTest.qWaitForWindowShown(self.d) if not utils.isMac(): self.d.working_dir = 'Z:\Windows\pyRouterJig\images'
def main(argv=None): parser = argparse.ArgumentParser(description="Monte Carlo SAS analysis") parser.add_argument("-t", "--text", action="store_true", help="Run in text mode without graphical " "user interface") parser.add_argument("-l", "--nolog", action="store_true", help="Disable progress output during fit, " "it's written to file in any case.") parser.add_argument("-s", "--start", action="store_true", help="Start the calculation immediately.") parser.add_argument('fnames', nargs='*', metavar='FILENAME', action="store", help="One or more data files to analyse") # TODO: add info about output files to be created ... if isMac(): # on OSX remove automatically provided PID, # otherwise argparse exits and the bundle start fails silently for i in range(len(sys.argv)): if sys.argv[i].startswith("-psn"): # PID provided by osx del sys.argv[i] try: args = parser.parse_args() except SystemExit as e: # useful debugging code, ensure destination is writable! # logfn = ("/tmp/{name}_unsupported_args.log" # .format(name = SCRIPT_FILENAME)) # with open(logfn, "w") as fd: # fd.write("argv: " + str(sys.argv) + "\n") raise # forwarding logging setting, quick fix import gui.calc # importing here makes avoids import loops elsewhere gui.calc.Calculator.nolog = args.nolog # initiate logging (to console stderr for now) replaceStdOutErr() # replace all text output with our sinks if not args.text: from gui.mainwindow import eventLoop # run graphical user interface, passing argument parser result return eventLoop(args) else: # TODO: fix command line run try: from gui import calc calc(args.fnames) except Exception as e: # show detailed error traceback if there was one import traceback logging.error(traceback.format_exc())
def setUp(self): self.d = Driver() # the application must be switched to metric scales self.assertFalse(self.d.config.metric != True) self.d.show() self.d.raise_() self.debug = self.d.config.debug QTest.qWaitForWindowExposed(self.d) if not utils.isMac(): self.d.working_dir = 'Z:\Windows\pyRouterJig\images'
def initUI(self): if utils.isMac(): self.setMinimumSize(Dimension(750, 600)) else: self.setMinimumSize(Dimension(750, 700)) self.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE) self.setLocationRelativeTo(None) self.setBounds(100, 100, WINDOW_WIDTH, 600); self.content_pane = JPanel(); self.content_pane.setBorder(EmptyBorder(0, 0, 0, 0)); self.setContentPane(self.content_pane); self.content_pane.setLayout(BorderLayout(0, 0)); self.setVisible(True)
"libpyside-python2.7.so.1.2", "libshiboken-python2.7.so.1.2", "libQtGui.so.4", "libQtCore.so.4", "libQtSvg.so.4", "libQtXml.so.4", "libQtNetwork.so.4", "libQtDBus.so.4", "libaudio.so.2", "libhdf5.so.7", "libhdf5_hl.so.7", "libpng12.so.0", "libtk8.6.so", "libXss.so.1"): filepath = os.path.join(libdir, lib) if not os.path.exists(filepath): logging.warning("include not found: '{}'".format(filepath)) else: INCLUDEFILES.append(filepath) if isWindows(): INCLUDEFILES += [ "Microsoft.VC90.CRT", ] if isMac(): INCLUDEFILES += [("resources/icon/mcsas.icns", "resources/icon/mcsas.icns"), "/usr/lib/system/libdnsinfo.dylib"] BUILDOPTIONS = dict( compressed=False, include_files=INCLUDEFILES, packages=[], excludes=[ "lib2to3", # python3 compatibility fix "models.sphere" ], # source file added for dyn. loading includes=[ "PySide", "PySide.QtCore",
def postProcess(self): if not self.algo.seriesStats(): return # works similar to _writeStatistics() but not using parameters class DummyDataSet(object): """Just for the file name formatting.""" title = u"series statistics" def processSeries(series): seriesPlot = PlotSeriesStats() # data formatted for file output, gathered across histograms fileData = dict() columnNames = ( # columns appearing in the output file header ["seriesKey", "param", "lower", "upper", "weighting"] + list(Moments.fieldNames())) for seriesItem in series.items(): processSeriesStats(seriesItem, seriesPlot, fileData, columnNames) # since we are the last writer, changing outFn doesn't hurt self._outFn = OutputFilename(DummyDataSet, createDir=False) self._writeResultHelper(fileData, "", "series statistics", columnNames, extension='.dat') seriesPlot.show() def processSeriesStats(seriesItem, seriesPlot, fileData, columnNames): # gather data values indexed by columns names first stats = dict() ((sampleName, seriesKeyName, (pname, lo, hi, weight)), valuePairs) = seriesItem columnNames[0] = seriesKeyName.replace(" ", "_") for seriesKey, moments in valuePairs: values = (seriesKey, pname, lo, hi, weight) + moments for name, value in zip(columnNames, values): if name not in stats: stats[name] = [] # for plotting below, no float-str conversion here stats[name].append(value) # convert numerical stats to proper formatted text for file output for key, values in stats.items(): # proper float-str formatting for text file output if key not in fileData: fileData[key] = [] for value in values: if isList(value): value = ";".join( [AsciiFile.formatValue(v) for v in value]) fileData[key].append(AsciiFile.formatValue(value)) # simple statistics plotting, kind of a prototype for now ... stats["seriesKeyName"] = seriesKeyName stats["seriesKey"] = stats[columnNames[0]] stats["cfg"] = u"{param} [{lo},{hi}] {w}".format(param=pname, lo=lo, hi=hi, w=weight) stats["title"] = sampleName seriesPlot.plot(stats) if isMac(): processSeries(self._series) else: from multiprocessing import Process proc = Process(target=processSeries, args=(self._series, )) proc.start()