Exemplo n.º 1
0
def test_epicssignal_readonly():
    signal = EpicsSignalRO('readpv')
    signal.wait_for_connection()
    signal.value

    with pytest.raises(ReadOnlyError):
        signal.value = 10

    with pytest.raises(ReadOnlyError):
        signal.put(10)

    with pytest.raises(ReadOnlyError):
        signal.set(10)

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint_ts

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint

    signal.precision
    signal.timestamp
    signal.limits

    signal.read()
    signal.describe()
    signal.read_configuration()
    signal.describe_configuration()

    eval(repr(signal))
    time.sleep(0.2)
Exemplo n.º 2
0
def test_epicssignal_readonly():
    signal = EpicsSignalRO('readpv')
    signal.wait_for_connection()
    signal.value

    with pytest.raises(ReadOnlyError):
        signal.value = 10

    with pytest.raises(ReadOnlyError):
        signal.put(10)

    with pytest.raises(ReadOnlyError):
        signal.set(10)

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint_ts

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint

    signal.precision
    signal.timestamp
    signal.limits

    signal.read()
    signal.describe()
    signal.read_configuration()
    signal.describe_configuration()

    eval(repr(signal))
    time.sleep(0.2)
Exemplo n.º 3
0
def test_epics_signal_derived(cleanup, signal_test_ioc):
    signal = EpicsSignalRO(
        read_pv=signal_test_ioc.pvs['read_only'],
        name='original',
    )
    cleanup.add(signal)

    signal.wait_for_connection()
    assert signal.connected
    assert signal.read_access
    assert not signal.write_access

    derived = DerivedSignal(derived_from=signal, name='derived')
    derived.wait_for_connection()

    assert derived.connected
    assert derived.read_access
    assert not derived.write_access

    assert derived.timestamp == signal.timestamp
    assert derived.get() == signal.value
Exemplo n.º 4
0
def test_epicssignal_readonly(cleanup, signal_test_ioc):
    signal = EpicsSignalRO(signal_test_ioc.pvs['read_only'])
    cleanup.add(signal)
    signal.wait_for_connection()
    print('EpicsSignalRO.metadata=', signal.metadata)
    signal.get()

    assert not signal.write_access
    assert signal.read_access

    with pytest.raises(ReadOnlyError):
        signal.value = 10

    with pytest.raises(ReadOnlyError):
        signal.put(10)

    with pytest.raises(ReadOnlyError):
        signal.set(10)

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint_ts

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint

    signal.precision
    signal.timestamp
    signal.limits

    signal.read()
    signal.describe()
    signal.read_configuration()
    signal.describe_configuration()

    eval(repr(signal))
    time.sleep(0.2)
Exemplo n.º 5
0
def test_epicssignal_readonly(cleanup, signal_test_ioc):
    signal = EpicsSignalRO(signal_test_ioc.pvs['read_only'])
    cleanup.add(signal)
    signal.wait_for_connection()
    print('EpicsSignalRO.metadata=', signal.metadata)
    signal.value

    assert not signal.write_access
    assert signal.read_access

    with pytest.raises(ReadOnlyError):
        signal.value = 10

    with pytest.raises(ReadOnlyError):
        signal.put(10)

    with pytest.raises(ReadOnlyError):
        signal.set(10)

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint_ts

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint

    signal.precision
    signal.timestamp
    signal.limits

    signal.read()
    signal.describe()
    signal.read_configuration()
    signal.describe_configuration()

    eval(repr(signal))
    time.sleep(0.2)
Exemplo n.º 6
0
def ro_signal(cleanup, signal_test_ioc):
    sig = EpicsSignalRO(signal_test_ioc.pvs['pair_rbv'], name='pair_rbv')
    cleanup.add(sig)
    sig.wait_for_connection()
    return sig
Exemplo n.º 7
0
def ro_signal(cleanup, signal_test_ioc):
    sig = EpicsSignalRO(signal_test_ioc.pvs['pair_rbv'], name='pair_rbv')
    cleanup.add(sig)
    sig.wait_for_connection()
    return sig
Exemplo n.º 8
0
if acq_time % EPICS_SAMPLE_TIME != 0:
    print('Acquisition Time Should Be An Integer Multiple Of %s s' %
          EPICS_SAMPLE_TIME)
    usage()
    sys.exit(1)

outfile_name = args[3]
##############################################################################

# Instantiate EpicsSignalRO
sig_name = enc_pv.lower().replace(':', '_')
sig = EpicsSignalRO(enc_pv, auto_monitor=True, name=sig_name)

try:
    sig.wait_for_connection(timeout=3.0)
except TimeoutError:
    print('Could not connect to data from PV %s, timed out.' % enc_pv)
    print('Either on wrong subnet or the ioc is off.')
    print('Make sure you are on one of the following machines:')
    print('psbuild-rhel7-01, psbuild-rhel7-02, lfe-console (lfe PVs),'
          'kfe-console (kfe PVs')
    sys.exit(1)

tvals = []  # Time values associated with each encoder RBV
enc_vals = []  # Encoder RBV arrays, 1000 elements each
timestamps = []  # timestamp for each encoder array


def cb(value=None, old_value=None, timestamp=None, **kwargs):
    """
Exemplo n.º 9
0
def test_epicssignalro_alarm_status(cleanup, motor):
    sig = EpicsSignalRO(motor.user_readback.pvname)
    cleanup.add(sig)
    sig.wait_for_connection()
    sig.alarm_status
    sig.alarm_severity