コード例 #1
0
        print('--> writing the value 5 to', chan1.channel.name)
        await chan1.write((5, ), notify=True)
        reading = await chan1.read()

        print()
        print('reading:', chan1.channel.name, reading)

        print('--> writing the value 6 to', chan1.channel.name)
        await chan1.write((6, ), notify=True)

        reading = await chan1.read()
        print()
        print('reading:', chan1.channel.name, reading)

        reading = await chan2.read()
        print()
        print('reading:', chan2.channel.name, reading)

        print('last heard', chan1.time_since_last_heard())
        await chan2.go_idle()
        await chan1.go_idle()

    assert called
    print('Done')


if __name__ == '__main__':
    ca.config_caproto_logging(level='DEBUG')
    ca.asyncio.utils.run(main(), debug=False)
コード例 #2
0
                elif key == 'CH6':
                    await self.CH6.write(io_dict[key])
                elif key == 'CH7':
                    await self.CH7.write(io_dict[key])


def start(config_filename):
    from lcp_flir import flir_camera_DL
    camera = flir_camera_DL.FlirCamera()
    camera.init(config_filename)
    return camera


if __name__ == "__main__":  #for testing
    from tempfile import gettempdir
    import sys

    config_filename = '/net/femto/C/All Projects/LaserLab/Software/instruments/Aerosols/config_top_12bit_server.conf'
    camera = start(config_filename=config_filename)
    camera.broadcast_frames = True

    from caproto import config_caproto_logging
    config_caproto_logging(file=gettempdir() + '/camera_DLS.log',
                           level='DEBUG')

    ioc_options, run_options = ioc_arg_parser(
        default_prefix=f"{camera.config['network_name']}:",
        desc=dedent(Server.__doc__))
    ioc = Server(**ioc_options)
    run(ioc.pvdb, **run_options)
コード例 #3
0
        return figure

    def figure_to_array(self, figure):
        from io import BytesIO
        from PIL.Image import open
        from numpy import asarray
        figure_buf = BytesIO()
        figure.savefig(figure_buf, format='jpg')
        figure_buf.seek(0)
        image = asarray(open(figure_buf))
        return image


if __name__ == "__main__":
    from tempfile import gettempdir
    print(f'temp-dir {gettempdir()}')

    from caproto import config_caproto_logging

    config_caproto_logging(file=gettempdir() + '/big_image_noisy_neibhor.log',
                           level='DEBUG')

    ioc_options, run_options = ioc_arg_parser(
        default_prefix="bitmap_generator:",
        desc="Run an IOC that updates via I/O interrupt on key-press events.",
    )

    ioc = Server(**ioc_options)
    print(ioc.image)
    run(ioc.pvdb, **run_options)
コード例 #4
0
        return figure

    def figure_to_array(self, figure):
        from io import BytesIO
        from PIL.Image import open
        from numpy import asarray
        figure_buf = BytesIO()
        figure.savefig(figure_buf, format='jpg')
        figure_buf.seek(0)
        image = asarray(open(figure_buf))
        return image


if __name__ == "__main__":
    from tempfile import gettempdir
    print(f'temp-dir {gettempdir()}')

    from caproto import config_caproto_logging

    config_caproto_logging(file=gettempdir() + '/chart_generator.log',
                           level='DEBUG')

    ioc_options, run_options = ioc_arg_parser(
        default_prefix="chart:",
        desc="SoftIOC generates a matplotlib plot of some data.",
    )

    ioc = softIOC(**ioc_options)
    print(ioc.image)
    run(ioc.pvdb, **run_options)
コード例 #5
0
#!/usr/bin/env python3
from sequence_server_wrapper.template import Server, ThreadingClient
from sequence_server_wrapper.examples.example_device import DeviceExample

from caproto.server import pvproperty, PVGroup, SubGroup, ioc_arg_parser, run

import traceback

try:
    from caproto import config_caproto_logging
    config_caproto_logging()
except:
    print(traceback.format_exc())

from logging import debug, info, warning, error

from time import sleep

class ServerExample(PVGroup):
    io_put_queue = None
    io_get_queue = None
    device = None

    io_get_queue = None
    io_put_queue = None

    # Creates the SubGroup for this IO with 'seq.' as subgroup name. The PV banes become: TEST:SERVER.seq.CMD (and ACK, values).
    seq = SubGroup(Server, prefix='seq.')

    # Define PVs for this specific server
    example_pv = pvproperty(value=0.0)
コード例 #6
0


"""
from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
import caproto
from textwrap import dedent
from pdb import pm

from numpy import random, array, zeros, ndarray, nan, isnan
from time import time,sleep

if __name__ == '__main__':

    from caproto import config_caproto_logging
    config_caproto_logging(file='/tmp/dio_controller.log', level='DEBUG')

    from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
    from textwrap import dedent
    from pdb import pm

    from numpy import random, array, zeros, ndarray, nan, isnan
    from time import time, sleep

    from icarus_nmr.dio_server import Server
    from icarus_nmr.dio_client import Client
    from icarus_nmr.dio_handler import Handler

    import socket
    client = Client(device_ca_server_prefix = f'{socket.gethostname()}_device_controller:')
    device = Handler(client)
コード例 #7
0
Date: November 2017 - August 2021

This is an example script that starts "mock" device channel access server.

The variable SERVER_NAME needs to be changed to launch the server with a unique name that corresponds to the desired server.


"""
import socket

SERVER_NAME = socket.gethostname()

if __name__ == '__main__':

    from caproto import config_caproto_logging
    config_caproto_logging(file='/tmp/device_controller_mock.log', level='INFO')


    from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
    from textwrap import dedent
    from pdb import pm




    from numpy import random, array, zeros, ndarray, nan, isnan
    from time import time, sleep

    # import device (DI_4108_DL) class and initiate device instance.
    from icarus_nmr.device_daq import Device
    device = Device()
コード例 #8
0
"""
from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
import caproto
from textwrap import dedent
from pdb import pm

from numpy import random, array, zeros, ndarray, nan, isnan
from time import time, sleep
import socket
SERVER_NAME = socket.gethostname()

if __name__ == '__main__':
    from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
    from caproto import config_caproto_logging
    config_caproto_logging(file='/tmp/event_controller.log', level='INFO')

    from textwrap import dedent
    from pdb import pm

    from numpy import random, array, zeros, ndarray, nan, isnan
    from time import time, sleep

    from pdb import pm

    from icarus_nmr.event_handler import Handler
    from icarus_nmr.event_daq import DAQ
    from icarus_nmr.event_client import Client
    from icarus_nmr.event_server import Server

    client = Client(