Beispiel #1
0
def main():
    parser = make_parser()
    args = site_config.parse_args(agent_class='CryomechCPAAgent',
                                  parser=parser)
    print('I am in charge of device with serial number: %s' %
          args.serial_number)

    # Automatically acquire data if requested (default)
    init_params = False
    if args.mode == 'init':
        init_params = {'auto_acquire': False}
    elif args.mode == 'acq':
        init_params = {'auto_acquire': True}

    # Call launcher function (initiates connection to appropriate
    # WAMP hub and realm).

    agent, runner = ocs_agent.init_site_agent(args)

    # create agent instance and run log creation
    ptc = PTCAgent(agent,
                   args.port,
                   args.ip_address,
                   fake_errors=args.fake_errors)

    agent.register_task('init', ptc.init, startup=init_params)
    agent.register_process('acq', ptc.acq, ptc._stop_acq)

    runner.run(agent, auto_reconnect=True)
Beispiel #2
0
def main():
    '''Boot OCS agent'''
    txaio.start_logging(level=os.environ.get('LOGLEVEL', 'info'))

    parser = site_config.add_arguments()

    args = site_config.parse_args('stmACAgent')
    agent_inst, runner = ocs_agent.init_site_agent(args)
    stm_ac_agent = stmACAgent(agent_inst)

    # agent_inst.register_task(
    #     'init_pcr',
    #     stm_ac_agent.init_pcr500
    # )

    agent_inst.register_process('acq',
                                stm_ac_agent.start_acq,
                                stm_ac_agent.stop_acq,
                                startup=True)

    agent_inst.register_task('set_values', stm_ac_agent.set_values)

    agent_inst.register_task('get_values', stm_ac_agent.get_values)

    agent_inst.register_task('getACstatus', stm_ac_agent.getACstatus)

    agent_inst.register_task('rampVoltage', stm_ac_agent.rampVoltage)

    agent_inst.register_task('forceZero', stm_ac_agent.forceZero)

    runner.run(agent_inst, auto_reconnect=True)
Beispiel #3
0
def main():
    # Start logging
    txaio.start_logging(level=os.environ.get("LOGLEVEL", "info"))

    parser = make_parser()
    args = site_config.parse_args(agent_class='Lakeshore425Agent',
                                  parser=parser)

    agent, runner = ocs_agent.init_site_agent(args)

    # Automatically acquire data if requested (default)
    init_params = False
    if args.mode == 'init':
        init_params = {'auto_acquire': False}
    elif args.mode == 'acq':
        init_params = {'auto_acquire': True}

    kwargs = {'port': args.port}

    if args.sampling_frequency is not None:
        kwargs['f_sample'] = float(args.sampling_frequency)
    gauss = LS425Agent(agent, **kwargs)

    agent.register_task('init_lakeshore',
                        gauss.init_lakeshore,
                        startup=init_params)
    agent.register_task('operational_status', gauss.operational_status)
    agent.register_task('zero_calibration', gauss.zero_calibration)
    agent.register_task('any_command', gauss.any_command)
    agent.register_process('acq', gauss.acq, gauss._stop_acq)

    runner.run(agent, auto_reconnect=True)
Beispiel #4
0
def main():
    '''Boot OCS agent'''
    txaio.start_logging(level=os.environ.get('LOGLEVEL', 'info'))

    parser = site_config.add_arguments()

    args = parser.parse_args()
    site_config.reparse_args(args, 'dS378Agent')

    agent_inst, runner = ocs_agent.init_site_agent(args)

    kwargs = {}

    if args.port is not None:
        kwargs['port'] = args.port
    if args.ip is not None:
        kwargs['ip'] = args.ip

    ds_agent = dS378Agent(agent_inst, **kwargs)

    agent_inst.register_task('set_relay', ds_agent.set_relay)

    agent_inst.register_task('get_relays', ds_agent.get_relays)

    agent_inst.register_process('acq',
                                ds_agent.start_acq,
                                ds_agent.stop_acq,
                                startup=True)

    runner.run(agent_inst, auto_reconnect=True)
Beispiel #5
0
def main():
    site_parser = site_config.add_arguments()
    parser = make_parser(site_parser)

    # Get the parser to process the command line.
    args = parser.parse_args()

    # Interpret options in the context of site_config.
    site_config.reparse_args(args, 'CryomechCPAAgent')
    print('I am in charge of device with serial number: %s' %
          args.serial_number)

    # Automatically acquire data if requested (default)
    init_params = False
    if args.mode == 'init':
        init_params = {'auto_acquire': False}
    elif args.mode == 'acq':
        init_params = {'auto_acquire': True}

    # Call launcher function (initiates connection to appropriate
    # WAMP hub and realm).

    agent, runner = ocs_agent.init_site_agent(args)

    # create agent instance and run log creation
    ptc = PTCAgent(agent,
                   args.port,
                   args.ip_address,
                   fake_errors=args.fake_errors)

    agent.register_task('init', ptc.init_ptc_task, startup=init_params)
    agent.register_process('acq', ptc.start_acq, ptc.stop_acq)

    runner.run(agent, auto_reconnect=True)
Beispiel #6
0
def main():
    '''Boot OCS agent'''
    txaio.start_logging(level=os.environ.get('LOGLEVEL', 'info'))

    parser = site_config.add_arguments()

    args = parser.parse_args()
    site_config.reparse_args(args, 'BLE2Agent')

    agent_inst, runner = ocs_agent.init_site_agent(args)

    ble2_agent = BLE2Agent(agent_inst)

    agent_inst.register_task('set_values', ble2_agent.set_values)

    agent_inst.register_task('start_rotation', ble2_agent.start_rotation)

    agent_inst.register_task('stop_rotation', ble2_agent.stop_rotation)

    agent_inst.register_task('init_ble2', ble2_agent.init_ble2)

    agent_inst.register_process(
        'acq',
        ble2_agent.start_acq,
        ble2_agent.stop_acq,
    )

    runner.run(agent_inst, auto_reconnect=True)
Beispiel #7
0
def main():
    p = site_config.add_arguments()
    parser = make_parser(parser=p)

    args = parser.parse_args()

    # Interpret options in the context of site_config.
    site_config.reparse_args(args, 'CapSensorAgent')

    # Automatically acquire data if requested
    if args.mode == 'acq':
        init_params = {'auto_acquire': True}
    else:
        init_params = {'auto_acquire': False}

    agent, runner = ocs_agent.init_site_agent(args)

    kwargs = {"config_file": args.config}

    cap = CapSensor_Agent(agent, **kwargs)

    agent.register_task('init_cap', cap.init_task,
                        startup=init_params)
    agent.register_task('offset', cap.offset)
    agent.register_process('acq', cap.acq, cap.stop_acq)

    runner.run(agent, auto_reconnect=True)
    
    if args.mode != 'idle':
        agent.start('init_cap')
Beispiel #8
0
def main():
    parser = make_parser()
    args = site_config.parse_args(
        agent_class='VantagePro2Agent', parser=parser)
    init_params = False
    if args.mode == 'init':
        init_params = {'auto_acquire': False}
    elif args.mode == 'acq':
        init_params = {'auto_acquire': True}

    device_port = None

    if args.port is not None:
        device_port = args.port
    else:  # Tries to find correct USB port automatically

        # This exists if udev rules are setup properly for the 240s
        if os.path.exists('/dev/{}'.format(args.serial_number)):
            device_port = "/dev/{}".format(args.serial_number)

        elif os.path.exists('/dev/serial/by-id'):
            ports = os.listdir('/dev/serial/by-id')
            for port in ports:
                if args.serial_number in port:
                    device_port = "/dev/serial/by-id/{}".format(port)
                    print("Found port {}".format(device_port))
                    break

    if device_port is None:
        print("Could not find device port for {}".format(args.serial_number))
        return

    agent, runner = ocs_agent.init_site_agent(args)

    vPro2 = VantagePro2Agent(agent, device_port, args.sample_freq)
    agent.register_task('init', vPro2.init_VantagePro2_task,
                        startup=init_params)
    agent.register_process('acq', vPro2.start_acq, vPro2.stop_acq,
                           blocking=True)

    runner.run(agent, auto_reconnect=True)
Beispiel #9
0
def main():
    parser = site_config.add_arguments()
    parser = make_parser(parser)

    args = parser.parse_args()
    site_config.reparse_args(args, 'PysmurfArchiverAgent')

    if args.target is None:
        raise Exception("Argument --target is required")

    if type(args.target) == str:
        args.target = [args.target]
    agent, runner = ocs_agent.init_site_agent(args)

    archiver = PysmurfArchiverAgent(agent, data_dir=args.data_dir,
                                    targets=args.target,
                                    host=args.host)

    agent.register_process('run', archiver.run, archiver.stop, startup=True)

    runner.run(agent, auto_reconnect=True)
Beispiel #10
0
    pgroup.add_argument('--serial-number')
    pgroup.add_argument('--mode')
    pgroup.add_argument('--fake-data',
                        type=int,
                        default=0,
                        help='Set non-zero to fake data, without hardware.')

    # Parse comand line.
    args = parser.parse_args()

    # Interpret options in the context of site_config.
    site_config.reparse_args(args, 'Lakeshore372Agent')
    print('I am in charge of device with serial number: %s' %
          args.serial_number)

    agent, runner = ocs_agent.init_site_agent(args)

    lake_agent = LS372_Agent(agent,
                             args.serial_number,
                             args.ip_address,
                             fake_data=False)

    agent.register_task('init_lakeshore', lake_agent.init_lakeshore_task)
    agent.register_task('set_heater_range', lake_agent.set_heater_range)
    agent.register_task('set_excitation_mode', lake_agent.set_excitation_mode)
    agent.register_task('set_excitation', lake_agent.set_excitation)
    agent.register_task('set_pid', lake_agent.set_pid)
    agent.register_task('set_autoscan', lake_agent.set_autoscan)
    agent.register_task('set_active_channel', lake_agent.set_active_channel)
    agent.register_task('servo_to_temperature',
                        lake_agent.servo_to_temperature)
Beispiel #11
0
def main():
    # Start logging
    txaio.start_logging(level=os.environ.get("LOGLEVEL", "info"))

    parser = make_parser()

    #Not used anymore, but we don't it to break the agent if these args are passed
    parser.add_argument('--fake-data', help=argparse.SUPPRESS)
    parser.add_argument('--num-channels', help=argparse.SUPPRESS)

    # Interpret options in the context of site_config.
    args = site_config.parse_args(agent_class='Lakeshore240Agent',
                                  parser=parser)

    if args.fake_data is not None:
        warnings.warn(
            "WARNING: the --fake-data parameter is deprecated, please "
            "remove from your site-config file", DeprecationWarning)

    if args.num_channels is not None:
        warnings.warn(
            "WARNING: the --num-channels parameter is deprecated, please "
            "remove from your site-config file", DeprecationWarning)

    # Automatically acquire data if requested (default)
    init_params = False
    if args.mode == 'init':
        init_params = {'auto_acquire': False}
    elif args.mode == 'acq':
        init_params = {'auto_acquire': True}

    device_port = None
    if args.port is not None:
        device_port = args.port
    else:  # Tries to find correct USB port automatically

        # This exists if udev rules are setup properly for the 240s
        if os.path.exists('/dev/{}'.format(args.serial_number)):
            device_port = "/dev/{}".format(args.serial_number)

        elif os.path.exists('/dev/serial/by-id'):
            ports = os.listdir('/dev/serial/by-id')
            for port in ports:
                if args.serial_number in port:
                    device_port = "/dev/serial/by-id/{}".format(port)
                    print("Found port {}".format(device_port))
                    break

    if device_port is None:
        print("Could not find device port for {}".format(args.serial_number))
        return

    agent, runner = ocs_agent.init_site_agent(args)

    kwargs = {'port': device_port}

    if args.sampling_frequency is not None:
        kwargs['f_sample'] = float(args.sampling_frequency)

    therm = LS240_Agent(agent, **kwargs)

    agent.register_task('init_lakeshore',
                        therm.init_lakeshore,
                        startup=init_params)
    agent.register_task('set_values', therm.set_values)
    agent.register_task('upload_cal_curve', therm.upload_cal_curve)
    agent.register_process('acq', therm.acq, therm._stop_acq)

    runner.run(agent, auto_reconnect=True)