コード例 #1
0
ファイル: acquisition.py プロジェクト: pombredanne/minilab
def startup(sensors_groups, host='localhost', port=65000):
    """

    """
    server = []
    client = []

    samples_per_channel = 100

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)

    DaqPkgRingBuffer.configure(samples_per_channel, 0.0)
    DaqDictRingBuffer.configure(samples_per_channel * 10, 0)

    # server daq configurations
    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name]))

    server.append(DaqServer(host, port))

    # client analyzer configurations
    for name in channels:
        DaqDictRingBuffer.bind(name, channels[name])
        client.append(
            DaqAnalyzer('localhost', 65000, channels['ceramic'], name))

    client.append(DaqPlotter(samples_per_channel=samples_per_channel * 10))

    asyncore.loop()
コード例 #2
0
ファイル: daq_analyzer.py プロジェクト: xmnlab/minilab
    def start(devices):
        channels = extract_channels(devices)
        samples_per_channel = 100

        DaqDictRingBuffer.configure(samples_per_channel, 0.)
        groups = ['ceramic', 'polymer']
        for name in groups:
            DaqDictRingBuffer.bind(name, channels[name])

        plotter = DaqPlotter(samples_per_channel=samples_per_channel)

        asyncore.loop()
コード例 #3
0
    def start(devices):
        channels = extract_channels(devices)
        samples_per_channel = 100

        DaqDictRingBuffer.configure(samples_per_channel, 0.)
        groups = ['ceramic', 'polymer']
        for name in groups:
            DaqDictRingBuffer.bind(name, channels[name])

        plotter = DaqPlotter(samples_per_channel=samples_per_channel)

        asyncore.loop()
コード例 #4
0
def start(sensors_groups):
    channels = extract_channels(sensors_groups)
    DaqDictRingBuffer.configure(100000, 0.)

    for name in ['ceramic']:
        DaqDictRingBuffer.bind(name, channels[name])

    ceramic = DaqClient('localhost', 65000, channels['ceramic'], 'ceramic')
    #polymer = DaqClient('localhost', 65000, devices['polymer'])
    #plotter = DaqPlotter()

    asyncore.loop()
コード例 #5
0
ファイル: async_client.py プロジェクト: xmnlab/minilab
def start(sensors_groups):
    channels = extract_channels(sensors_groups)
    DaqDictRingBuffer.configure(100000, 0.)

    for name in ['ceramic']:
        DaqDictRingBuffer.bind(name, channels[name])

    ceramic = DaqClient('localhost', 65000, channels['ceramic'], 'ceramic')
    #polymer = DaqClient('localhost', 65000, devices['polymer'])
    #plotter = DaqPlotter()

    asyncore.loop()
コード例 #6
0
def start(devices):
    channels = extract_channels(devices)
    samples_per_channel = 100

    DaqDictRingBuffer.configure(samples_per_channel, 0.)
    groups = ['ceramic', 'polymer']
    for name in groups:
        DaqDictRingBuffer.bind(name, channels[name])

    DaqAsyncTurn.configure(groups + ['plotter'])

    ceramic = DaqClient('localhost', 65000, channels['ceramic'], 'ceramic')
    polymer = DaqClient('localhost', 65000, channels['polymer'], 'polymer')
    plotter = DaqPlotter(samples_per_channel=samples_per_channel)

    asyncore.loop()
コード例 #7
0
def startup(sensors_groups, host='localhost', port=65000):
    """

    """
    server = []

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)
    DaqPkgRingBuffer.configure(100, 0.0)

    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name]))

    server.append(DaqServer(host, port))

    asyncore.loop(0.5)
コード例 #8
0
ファイル: async_daq.py プロジェクト: xmnlab/minilab
def startup(sensors_groups, host='localhost', port=65000):
    """

    """
    server = []

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)
    DaqPkgRingBuffer.configure(100, 0.0)

    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name]))

    server.append(DaqServer(host, port))

    asyncore.loop(0.5)
コード例 #9
0
ファイル: acquisition.py プロジェクト: pombredanne/minilab
def startup(sensors_groups):
    """

    """
    server = []
    client = []

    # total samples per channel
    samples_per_channel = 15000
    # samples per channel per each read access
    samples_per_channel_read = 1000
    # quantity of package of data to be buffered
    packages_per_channel = 1

    devices = extract_devices(sensors_groups)
    channels = extract_channels(sensors_groups)
    tree_channels = defaultdict(dict)

    DaqPkgRingBuffer.configure(packages_per_channel, 0.0)
    DaqDictRingBuffer.configure(max_samples_per_channel=samples_per_channel *
                                2,
                                nothing_value=0,
                                overwritten_exception=False)

    # server daq configurations
    for name in channels:
        DaqPkgRingBuffer.bind(name, channels[name])

    for name in devices:
        server.append(DaqRegister(devices[name], samples_per_channel_read))

    # client analyzer configurations
    for name in channels:
        tree_channels[name] = dict([(ch, None) for ch in channels[name]])
        DaqDictRingBuffer.bind(name, channels[name])

        client.append(
            DaqAnalyzer(channels=channels[name],
                        daq_name=name,
                        server=DaqServer.listening(channels[name], name)))
    """
    # View all signals ring buffer
    chart = DaqPlotter(samples_per_channel=samples_per_channel*2)
    client.append(chart)
    """

    # View only segmented signals
    chart = DaqAsyncPlotter(samples_per_channel=samples_per_channel,
                            tree_channels=tree_channels)
    client.append(chart)

    def callback_process(data):
        # call the weigh method
        weight = Weigh.calculate(data)
        # call the save method
        #
        # call chart method
        chart.send(data)

    # Segmentation Module
    for name in channels:
        client.append(
            SegmentedByTrigger(buffer_name=name,
                               channels=channels[name],
                               trigger=sensors_groups[name]['trigger'],
                               chunk=samples_per_channel,
                               ring_buffer=DaqDictRingBuffer,
                               callback=callback_process))
    loop(routines=server + client, wait=0.00000001)