def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg_10_converter.yml') # Add examples folder to entity search paths package_path = os.path.dirname( online_monitor.__file__ ) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) cls.configuration = create_forwarder_config_yaml(10) with open(cls.config_path, 'w') as outfile: outfile.write(cls.configuration) cls.configuration = yaml.load(cls.configuration)
def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg_5_producer.yml') # Add examples folder to entity search paths settings.add_producer_sim_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) with open(cls.config_path, 'w' ) as outfile: # 10 forwarder converters connected in a chain config_file = create_producer_config_yaml(5) outfile.write(config_file)
def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg.yml') # Add examples folder to entity search paths package_path = os.path.dirname(online_monitor.__file__) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) with open(cls.config_path, 'w') as outfile: config_file = create_config_yaml() outfile.write(config_file) # linux CI travis runs headless, thus virtual x server is needed for gui testing if os.getenv('TRAVIS', False): from xvfbwrapper import Xvfb cls.vdisplay = Xvfb() cls.vdisplay.start() # Start the simulation producer to create some fake data cls.producer_process = run_script_in_shell(producer_manager_path, cls.config_path) # Start converter cls.converter_manager_process = run_script_in_shell(converter_manager_path, cls.config_path) # Create Gui time.sleep(2) cls.app = QApplication(sys.argv) cls.online_monitor = OnlineMonitor.OnlineMonitorApplication(cls.config_path) time.sleep(2)
def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg_5_producer.yml') # Add examples folder to entity search paths settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) with open(cls.config_path, 'w') as outfile: # 10 forwarder converters connected in a chain config_file = create_producer_config_yaml(5) outfile.write(config_file)
def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg_10_converter.yml') # Add examples folder to entity search paths package_path = os.path.dirname(online_monitor.__file__) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) cls.configuration = create_forwarder_config_yaml(10) with open(cls.config_path, 'w') as outfile: outfile.write(cls.configuration) cls.configuration = yaml.load(cls.configuration)
def test_entities_settings(self): settings.add_converter_path(r'C:\\test\\converter\\path') settings.add_receiver_path(r'/home/receiver/path') settings.add_producer_sim_path(r'test/producer_sim/path') self.assertTrue(r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertTrue(r'/home/receiver/path' in settings.get_receiver_path()) self.assertTrue(r'test/producer_sim/path' in settings.get_producer_sim_path()) settings.delete_converter_path(r'C:\\test\\converter\\path') settings.delete_receiver_path(r'/home/receiver/path') settings.delete_producer_sim_path(r'test/producer_sim/path') self.assertFalse(r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertFalse(r'/home/receiver/path' in settings.get_receiver_path()) self.assertFalse(r'test/producer_sim/path' in settings.get_producer_sim_path())
def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg_2.yml') # Add examples folder to entity search paths package_path = os.path.dirname(online_monitor.__file__) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) with open(cls.config_path, 'w') as outfile: config_file = create_config_yaml() outfile.write(config_file) # linux CI travis runs headless, thus virtual x server is needed for gui testing if os.getenv('TRAVIS', False): from xvfbwrapper import Xvfb cls.vdisplay = Xvfb() cls.vdisplay.start()
def setUpClass(cls): # Set the config file path to the test folder, otherwise they are created where nosetests are called cls.config_path = os.path.join(os.path.dirname(__file__), 'tmp_cfg.yml') # Add examples folder to entity search paths package_path = os.path.dirname( online_monitor.__file__ ) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) with open(cls.config_path, 'w') as outfile: config_file = create_config_yaml() outfile.write(config_file) # linux CI travis runs headless, thus virtual x server is needed for gui testing if os.getenv('TRAVIS', False): from xvfbwrapper import Xvfb cls.vdisplay = Xvfb() cls.vdisplay.start() # Start the simulation producer to create some fake data cls.producer_process = run_script_in_shell(producer_manager_path, cls.config_path) # Start converter cls.converter_manager_process = run_script_in_shell( converter_manager_path, cls.config_path) # Create Gui time.sleep(2) cls.app = QApplication(sys.argv) cls.online_monitor = OnlineMonitor.OnlineMonitorApplication( cls.config_path) time.sleep(2)
def main(): # If no configuration file is provided show a demo of the online monitor if sys.argv[1:]: args = utils.parse_arguments() else: # Add examples folder to entity search paths to be able to show DEMO using the examples package_path = os.path.dirname(online_monitor.__file__) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) class Dummy(object): def __init__(self): self.config_file = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/configuration.yaml')) self.log = 'INFO' args = Dummy() logging.warning('No configuration file provided! Show a demo of the online monitor!') utils.setup_logging(args.log) # Start the simulation producer to create some fake data producer_sim_process = run_script_in_shell('', args.config_file, 'start_producer_sim') # Start the converter converter_manager_process = run_script_in_shell('', args.config_file, 'start_converter') # Helper function to run code after OnlineMonitor Application exit def appExec(): app.exec_() # Stop other processes try: kill(producer_sim_process) except psutil.NoSuchProcess: # If the process was never started it cannot be killed pass try: kill(converter_manager_process) except psutil.NoSuchProcess: # If the process was never started it cannot be killed pass # Start the online monitor app = Qt.QApplication(sys.argv) win = OnlineMonitorApplication(args.config_file) win.show() sys.exit(appExec())
def test_entities_settings(self): settings.add_converter_path(r'C:\\test\\converter\\path') settings.add_receiver_path(r'/home/receiver/path') settings.add_producer_sim_path(r'test/producer_sim/path') self.assertTrue( r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertTrue(r'/home/receiver/path' in settings.get_receiver_path()) self.assertTrue( r'test/producer_sim/path' in settings.get_producer_sim_path()) settings.delete_converter_path(r'C:\\test\\converter\\path') settings.delete_receiver_path(r'/home/receiver/path') settings.delete_producer_sim_path(r'test/producer_sim/path') self.assertFalse( r'C:\\test\\converter\\path' in settings.get_converter_path()) self.assertFalse( r'/home/receiver/path' in settings.get_receiver_path()) self.assertFalse( r'test/producer_sim/path' in settings.get_producer_sim_path())
author_email = '*****@*****.**' # requirements for core functionality from requirements.txt with open('requirements.txt') as f: install_requires = f.read().splitlines() setup( name='silab_online_monitor', version=version, description='Specific converters and receivers for SiLab data acquisition systems to be used with the generic online_monitor python package.', url='https://github.com/SiLab-Bonn/silab_online_monitor', license='MIT License', long_description='', author=author, maintainer=author, author_email=author_email, maintainer_email=author_email, install_requires=install_requires, packages=find_packages(), include_package_data=True, # accept all data files and directories matched by MANIFEST.in or found in source control package_data={'': ['README.*', 'VERSION'], 'docs': ['*'], 'examples': ['*']}, keywords=['silab', 'online monitor', 'real time plots'], platforms='any' ) # print os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/producer_sim/')) from online_monitor.utils import settings settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/receiver')))
install_requires=install_requires, packages=find_packages(), setup_requires=['setuptools', 'online_monitor>=0.4.2<0.5'], include_package_data= True, # accept all data files and directories matched by MANIFEST.in or found in source control keywords=['silicon', 'detector', 'telescope', 'Mimosa26', 'EUDET'], platforms='any', entry_points={ 'console_scripts': [ 'pymosa = pymosa.m26:main', 'pymosa_monitor = pymosa.online_monitor.start_pymosa_online_monitor:main', ] }, ) # FIXME: bad practice to put code into setup.py # Add the online_monitor Pymosa plugins try: import os import pymosa from online_monitor.utils import settings # Get the absoulte path of this package package_path = os.path.dirname(pymosa.__file__) # Add online_monitor plugin folder to entity search paths settings.add_producer_sim_path(os.path.join(package_path, 'online_monitor')) settings.add_converter_path(os.path.join(package_path, 'online_monitor')) settings.add_receiver_path(os.path.join(package_path, 'online_monitor')) except (ImportError, pkg_resources.DistributionNotFound): pass
def main(): # If no configuration file is provided show a demo of the online monitor if sys.argv[1:]: args = utils.parse_arguments() else: # Add examples folder to entity search paths to be able to show DEMO using the examples package_path = os.path.dirname( online_monitor.__file__ ) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) class Dummy(object): def __init__(self): self.config_file = os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(__file__)) + r'/configuration.yaml')) self.log = 'INFO' args = Dummy() logging.warning( 'No configuration file provided! Show a demo of the online monitor!' ) utils.setup_logging(args.log) # Start the simulation producer to create some fake data producer_sim_process = run_script_in_shell('', args.config_file, 'start_producer_sim') # Start the converter converter_manager_process = run_script_in_shell('', args.config_file, 'start_converter') # Helper function to run code after OnlineMonitor Application exit def appExec(): app.exec_() # Stop other processes try: kill(producer_sim_process) except psutil.NoSuchProcess: # If the process was never started it cannot be killed pass try: kill(converter_manager_process) except psutil.NoSuchProcess: # If the process was never started it cannot be killed pass # Start the online monitor app = Qt.QApplication(sys.argv) win = OnlineMonitorApplication(args.config_file) win.show() sys.exit(appExec())
''' This script start the online monitor with the example entities (simulation producer, converter, receiver) Thre online monitor should actually be used from the console und not with a start script like used here! Go to this folder and type: start_online_monitor configuration.yaml ''' import subprocess import os import online_monitor from online_monitor.utils import settings def run_script_in_shell(script, arguments, command=None): return subprocess.Popen("%s %s %s" % ('python' if not command else command, script, arguments), shell=True, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if os.name == 'nt' else 0) if __name__ == '__main__': package_path = os.path.dirname(online_monitor.__file__) # Get the absoulte path of the online_monitor installation settings.add_producer_sim_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/producer_sim'))) settings.add_converter_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/converter'))) settings.add_receiver_path(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(package_path)) + r'/examples/receiver'))) run_script_in_shell('', 'configuration.yaml', 'start_online_monitor')
author_email=author_email, maintainer_email=author_email, install_requires=install_requires, packages=find_packages(), include_package_data= True, # accept all data files and directories matched by MANIFEST.in or found in source control package_data={ '': ['README.*', 'VERSION'], 'docs': ['*'], 'examples': ['*'] }, keywords=['silab', 'online monitor', 'real time plots'], platforms='any') # print os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/producer_sim/')) from online_monitor.utils import settings settings.add_producer_sim_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/producer_sim'))) settings.add_converter_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/converter'))) settings.add_receiver_path( os.path.abspath( os.path.join( os.path.dirname(os.path.realpath(__file__)) + r'/silab_online_monitor/receiver')))
# starts the online monitor application + converters + producer # simulation defined on the configuration.yaml 'start_online_monitor = online_monitor.start_online_monitor:main', # Helper function to clean up crashed instances 'stop_online_monitor = online_monitor.stop_online_monitor:main', ] }, platforms='any' ) # FIXME: bad practice to put code into setup.py # Add the online_monitor bdaq53 plugins try: import online_monitor import os from online_monitor.utils import settings # Get the absoulte path of this package package_path = os.path.dirname(online_monitor.__file__) # Add online_monitor plugin folder to entity search paths settings.add_producer_sim_path(os.path.join(package_path, 'utils')) settings.add_converter_path(os.path.join(package_path, 'converter')) settings.add_receiver_path(os.path.join(package_path, 'receiver')) # Add example online_monitor plugins to entity search paths settings.add_producer_sim_path(os.path.join(package_path, 'examples', 'producer_sim')) settings.add_converter_path(os.path.join(package_path, 'examples', 'converter')) settings.add_receiver_path(os.path.join(package_path, 'examples', 'receiver')) except ImportError: pass