caproto.ioc_examples.mini_beamline.Edge

class caproto.ioc_examples.mini_beamline.Edge(prefix, *, macros=None, parent=None, name=None)[source]

An edge simulation device.

Edge pvproperties

Attribute

Suffix

Docs

Type

Notes

Alarm Group

det

det

Scalar detector value

float

Read-only Inherited from _JitterDetector Get

exp

exp

Exponential value

float

Inherited from _JitterDetector Put

mtr

mtr

Motor

float (ai)

Inherited from _JitterDetector Startup Put

mtr_tick_rate

mtr_tick_rate

Update tick rate

float

Inherited from _JitterDetector

vel

vel

Velocity

float

Inherited from _JitterDetector

Methods

group_read(instance)

Generic read called for channels without get defined

group_write(instance, value)

Generic write called for channels without put defined

Attributes

default_values

type_map

type_map_read_only

pvproperty methods

exp.putter(self, instance, value)
51
52
53
54
@exp.putter
async def exp(self, instance, value):
    value = np.clip(value, a_min=0, a_max=None)
    return value
mtr.startup(self, instance, async_lib)
56
57
58
59
@mtr.startup
async def mtr(self, instance, async_lib):
    instance.ev = async_lib.library.Event()
    instance.async_lib = async_lib
mtr.putter(self, instance, value)
Source code: mtr.putter
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
    @mtr.putter
    @no_reentry
    async def mtr(self, instance, value):
        # "tick" at 10Hz
        dwell = 1 / self.mtr_tick_rate.value

        disp = (value - instance.value)
        # compute the total movement time based an velocity
        total_time = abs(disp / self.vel.value)
        # compute how many steps, should come up short as there will
        # be a final write of the return value outside of this call
        N = int(total_time // dwell)

        for j in range(N):
            # hide a possible divide by 0
            step_size = disp / N
            await instance.write(instance.value + step_size)
            await instance.async_lib.library.sleep(dwell)

        return value