Example #1
0
      type: counter
      flags: readable|writable
      number of channels: 1
      max data value: 15
      ranges: <Range unit:none min:0.0 max:1.0>
      command: (not supported)
    """
    try:
        display_modinfo('comedi')
    except ImportError as e:
        print('could not load module info (kmod not installed)')
        print('  {}'.format(e))
    except ModuleNotFound as e:
        print('could not load module info (module not found)')
        print('  {}'.format(e))
    device = _Device(filename=filename)
    device.open()
    try:
        display(device)
    finally:
        device.close()


if __name__ == '__main__':
    import pycomedi_demo_args

    args = pycomedi_demo_args.parse_args(description=__doc__,
                                         argnames=['filename', 'verbose'])

    run(filename=args.filename)
Example #2
0
      flags: readable|writable
      number of channels: 1
      max data value: 15
      ranges: <Range unit:none min:0.0 max:1.0>
      command: (not supported)
    """
    try:
        display_modinfo('comedi')
    except ImportError as e:
        print('could not load module info (kmod not installed)')
        print('  {}'.format(e))
    except ModuleNotFound as e:
        print('could not load module info (module not found)')
        print('  {}'.format(e))
    device = _Device(filename=filename)
    device.open()
    try:
        display(device)
    finally:
        device.close()


if __name__ == '__main__':
    import pycomedi_demo_args

    args = pycomedi_demo_args.parse_args(
        description=__doc__,
        argnames=['filename', 'verbose'])

    run(filename=args.filename)
Example #3
0
    <BLANKLINE>
    """
    device = _Device(filename=filename)
    device.open()
    try:
        read(device=device, **kwargs)
    finally:
        device.close()


if __name__ == '__main__':
    import pycomedi_demo_args

    args = pycomedi_demo_args.parse_args(
        description=__doc__,
        argnames=['filename', 'subdevice', 'channels', 'aref', 'range',
                  'num-scans', 'mmap', 'callback', 'frequency', 'physical',
                  'plot', 'verbose'])

    _LOG.info(('measuring device={0.filename} subdevice={0.subdevice} '
               'channels={0.channels} range={0.range} '
               'analog-reference={0.aref}'
               ).format(args))

    if args.callback:
        reader = _utility.CallbackReader
    elif args.mmap:
        reader = _utility.MMapReader
    else:
        reader = _utility.Reader
Example #4
0
    t2 = insns[2].data[0] + insns[2].data[1] / 1e6
    return (t1, insns[1].data, t2)


def display(t1, data, t2):
    _LOG.info("initial time: {}".format(t1))
    _LOG.info("final time:   {}".format(t2))
    _LOG.info("difference:   {}".format(t2 - t1))
    for x in insns[1].data:
        print(x)


if __name__ == "__main__":
    import pycomedi_demo_args

    args = pycomedi_demo_args.parse_args(
        description=__doc__,
        argnames=["filename", "subdevice", "channel", "aref", "range", "num-scans", "verbose"],
        args=args,
    )

    t1, data, t2 = run(
        filename=args.filename,
        subdevice=args.subdevice,
        channel=args.channel,
        range=args.range,
        aref=args.aref,
        num_scans=args.num_scans,
    )
    display(t1=t1, data=data, t2=t2)
Example #5
0
    >>> os.remove(one_chan_path)
    >>> os.remove(two_chan_path)
    """
    device,ao_subdevice,ao_channels = setup_device(
        filename=filename, subdevice=subdevice, channels=channels,
        range=range, aref=aref)
    for filename in files:
        frequency,unit_output_signal = load(filename=filename)
        if len(unit_output_signal.shape) == 1:
            unit_output_signal.shape = (unit_output_signal.shape[0], 1)
        output_buffer = generate_output_buffer(
            ao_subdevice, ao_channels, unit_output_signal)
        setup_command(ao_subdevice, ao_channels, frequency, output_buffer)
        run_command(device, ao_subdevice, output_buffer)
    device.close()


if __name__ == '__main__':
    import pycomedi_demo_args

    pycomedi_demo_args.ARGUMENTS['files'] = (['files'], {'nargs': '+'})
    args = pycomedi_demo_args.parse_args(
        description=__doc__,
        argnames=[
            'filename', 'subdevice', 'channels', 'range', 'aref', 'mmap',
            'files', 'verbose'])

    run(filename=args.filename, subdevice=args.subdevice,
        channels=args.channels, range=args.range, aref=args.aref,
        mmap=args.mmap, files=args.files)
Example #6
0
    t2 = insns[2].data[0] + insns[2].data[1] / 1e6
    return (t1, insns[1].data, t2)


def display(t1, data, t2):
    _LOG.info('initial time: {}'.format(t1))
    _LOG.info('final time:   {}'.format(t2))
    _LOG.info('difference:   {}'.format(t2 - t1))
    for x in insns[1].data:
        print(x)


if __name__ == '__main__':
    import pycomedi_demo_args

    args = pycomedi_demo_args.parse_args(description=__doc__,
                                         argnames=[
                                             'filename', 'subdevice',
                                             'channel', 'aref', 'range',
                                             'num-scans', 'verbose'
                                         ],
                                         args=args)

    t1, data, t2 = run(filename=args.filename,
                       subdevice=args.subdevice,
                       channel=args.channel,
                       range=args.range,
                       aref=args.aref,
                       num_scans=args.num_scans)
    display(t1=t1, data=data, t2=t2)