def runModule(module_type, setup_name = False): app = QtGui.QApplication(sys.argv) general_parameters = params.halParameters("settings_default.xml") if setup_name: general_parameters.set("setup_name", setup_name) else: setup_name = general_parameters.get("setup_name") hardware = params.hardware("xml/" + setup_name + "_hardware.xml") found = False for module in hardware.get("modules").getProps(): if (module.get("hal_type") == module_type): a_module = __import__(module.get("module_name"), globals(), locals(), [setup_name], -1) a_class = getattr(a_module, module.get("class_name")) instance = a_class(module.get("parameters", False), general_parameters, None) params.setDefaultParameters(general_parameters) setup_parameters = params.halParameters("xml/" + setup_name + "_default.xml") instance.newParameters(setup_parameters) instance.show() found = True break if found: app.exec_() instance.cleanup() else: print module_type, "not found for", setup_name, "setup"
def runModule(module_type, setup_name = False): app = QtGui.QApplication(sys.argv) parameters = params.parameters("settings_default.xml") if not setup_name: setup_name = parameters.get("setup_name") parameters = params.halParameters("xml/" + setup_name + "_default.xml") parameters.set("setup_name", setup_name) hardware = params.hardware("xml/" + setup_name + "_hardware.xml") found = False for module in hardware.modules: if (module.hal_type == module_type): a_module = __import__(module.module_name, globals(), locals(), [setup_name], -1) a_class = getattr(a_module, module.class_name) instance = a_class(module.parameters, parameters, None) instance.newParameters(parameters) instance.show() found = True break if found: app.exec_() instance.cleanup() else: print module_type, "not found for", setup_name, "setup"
def runModule(module_type, setup_name = False): app = QtGui.QApplication(sys.argv) parameters = params.parameters("settings_default.xml") if not setup_name: setup_name = parameters.get("setup_name") parameters = params.halParameters("xml/" + setup_name + "_default.xml") parameters.set("setup_name", setup_name) hardware = params.hardware("xml/" + setup_name + "_hardware.xml") found = False for module in hardware.get("modules").getSubXMLObjects(): if (module.get("hal_type") == module_type): a_module = __import__(module.get("module_name"), globals(), locals(), [setup_name], -1) a_class = getattr(a_module, module.get("class_name")) instance = a_class(module.get("parameters", False), parameters, None) instance.newParameters(parameters) instance.show() found = True break if found: app.exec_() instance.cleanup() else: print module_type, "not found for", setup_name, "setup"
def newSettings(self, parameters_filename): # parse parameters file is_valid_xml = True try: parameters = params.halParameters(parameters_filename) except params.ParametersException: is_valid_xml = False hdebug.logText("failed to parse parameters file " + parameters_filename) QtGui.QMessageBox.information(self, "Parameter file parsing error", traceback.format_exc()) if is_valid_xml: self.parameters_box.addParameters(parameters)
import camera.frame as frame # This file is available in the ZhuangLab storm-analysis project on github. import sa_library.datareader as datareader if (len(sys.argv) != 4): print "usage: <settings> <movie_in> <png_out>" exit() # Open movie & get size. data_file = datareader.inferReader(sys.argv[2]) [width, height, length] = data_file.filmSize() # Start spotCounter as a stand-alone application. app = QtGui.QApplication(sys.argv) parameters = params.halParameters(sys.argv[1]) parameters.set("setup_name", "offline") parameters.set("camera1.x_pixels", width) parameters.set("camera1.y_pixels", height) parameters.set("camera1.x_bin", 1) parameters.set("camera1.y_bin", 1) spotCounter = SingleSpotCounter(None, parameters) #spotCounter.newParameters(parameters, [[255,255,255]]) spotCounter.newParameters(parameters) # Start driver. driver = OfflineDriver(spotCounter, data_file, sys.argv[3]) # Show window & start application.
if (sys.platform == "linux2"): font = QtGui.QFont() font.setPointSize(8) app.setFont(font) # Splash Screen. pixmap = QtGui.QPixmap("splash.png") splash = QtGui.QSplashScreen(pixmap) splash.show() app.processEvents() # Load settings. if (len(sys.argv) == 4): setup_name = sys.argv[1] hardware = params.hardware(sys.argv[2]) parameters = params.halParameters(sys.argv[3]) else: parameters = params.parameters("settings_default.xml") setup_name = parameters.get("setup_name") hardware = params.hardware("xml/" + setup_name + "_hardware.xml") parameters = params.halParameters("xml/" + setup_name + "_default.xml") params.setSetupName(parameters, setup_name) # Start logger. hdebug.startLogging(parameters.get("film.directory") + "logs/", "hal4000") # Load app. window = Window(hardware, parameters) window.toggleSettings() splash.hide() window.show()
if __name__ == "__main__": app = QtGui.QApplication(sys.argv) # Splash Screen. pixmap = QtGui.QPixmap("splash.png") splash = QtGui.QSplashScreen(pixmap) splash.show() app.processEvents() # Load settings. if (len(sys.argv) == 4): setup_name = sys.argv[1] hardware = params.hardware(sys.argv[2]) parameters = params.halParameters(sys.argv[3]) else: parameters = params.parameters("settings_default.xml") setup_name = parameters.get("setup_name") hardware = params.hardware("xml/" + setup_name + "_hardware.xml") parameters = params.halParameters("xml/" + setup_name + "_default.xml") params.setSetupName(parameters, setup_name) # Start logger. hdebug.startLogging(parameters.get("film.directory") + "logs/", "hal4000") # Load app. window = Window(hardware, parameters) window.toggleSettings() splash.hide() window.show()
import camera.frame as frame # This file is available in the ZhuangLab storm-analysis project on github. import sa_library.datareader as datareader if (len(sys.argv) != 4): print "usage: <settings> <movie_in> <png_out>" exit() # Open movie & get size. data_file = datareader.inferReader(sys.argv[2]) [width, height, length] = data_file.filmSize() # Start spotCounter as a stand-alone application. app = QtGui.QApplication(sys.argv) parameters = params.halParameters(sys.argv[1]) parameters.set("setup_name", "offline") parameters.set("camera1.x_pixels", width) parameters.set("camera1.y_pixels", height) parameters.set("camera1.x_bin", 1) parameters.set("camera1.y_bin", 1) spotCounter = SingleSpotCounter(None, parameters) spotCounter.newParameters(parameters) # Set the color. # # FIXME: We should parse the shutters file listed in the parameters # file. However instead we just use white. #
app = QtGui.QApplication(sys.argv) # Set default font size for linux. if (sys.platform == "linux2"): font = QtGui.QFont() font.setPointSize(8) app.setFont(font) # Splash Screen. pixmap = QtGui.QPixmap("splash.png") splash = QtGui.QSplashScreen(pixmap) splash.show() app.processEvents() # Load general settings. general_parameters = params.halParameters("settings_default.xml") # Load setup specific settings, just to get access to the # setup name and the film (and logging) directory. if (len(sys.argv) == 4): setup_name = sys.argv[1] hardware = params.hardware(sys.argv[2]) setup_parameters_filename = sys.argv[3] else: setup_name = general_parameters.get("setup_name") hardware = params.hardware("xml/" + setup_name + "_hardware.xml") setup_parameters_filename = "xml/" + setup_name + "_default.xml" setup_parameters = params.parameters(setup_parameters_filename, True) # Update general parameters with specific settings that are needed at startup.