Blacked on 3.10
This commit is contained in:
parent
3e5c951a14
commit
f3a14ab8b4
@ -17,7 +17,8 @@ from ophyd import (
|
|||||||
PseudoPositioner,
|
PseudoPositioner,
|
||||||
PseudoSingle,
|
PseudoSingle,
|
||||||
PVPositioner,
|
PVPositioner,
|
||||||
Device, Signal,
|
Device,
|
||||||
|
Signal,
|
||||||
Component,
|
Component,
|
||||||
DynamicDeviceComponent,
|
DynamicDeviceComponent,
|
||||||
Kind,
|
Kind,
|
||||||
@ -208,6 +209,7 @@ class EnergyKev(VirtualEpicsSignalRO):
|
|||||||
|
|
||||||
class CurrentSum(Signal):
|
class CurrentSum(Signal):
|
||||||
"""Adds up four current signals from the parent"""
|
"""Adds up four current signals from the parent"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.parent.ch1.subscribe(self._emit_value)
|
self.parent.ch1.subscribe(self._emit_value)
|
||||||
@ -215,10 +217,15 @@ class CurrentSum(Signal):
|
|||||||
def _emit_value(self, **kwargs):
|
def _emit_value(self, **kwargs):
|
||||||
timestamp = kwargs.pop("timestamp", time.time())
|
timestamp = kwargs.pop("timestamp", time.time())
|
||||||
self.wait_for_connection()
|
self.wait_for_connection()
|
||||||
self._run_subs(sub_type='value', timestamp=timestamp, obj=self)
|
self._run_subs(sub_type="value", timestamp=timestamp, obj=self)
|
||||||
|
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
total = self.parent.ch1.get() + self.parent.ch2.get() + self.parent.ch3.get() + self.parent.ch4.get()
|
total = (
|
||||||
|
self.parent.ch1.get()
|
||||||
|
+ self.parent.ch2.get()
|
||||||
|
+ self.parent.ch3.get()
|
||||||
|
+ self.parent.ch4.get()
|
||||||
|
)
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
|
||||||
@ -233,11 +240,8 @@ class Bpm4i(Device):
|
|||||||
sum = Component(CurrentSum, kind=Kind.hinted, name="sum",)
|
sum = Component(CurrentSum, kind=Kind.hinted, name="sum",)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dut = Bpm4i("X12SA-OP1-SCALER.", name="bpm4")
|
dut = Bpm4i("X12SA-OP1-SCALER.", name="bpm4")
|
||||||
dut.wait_for_connection()
|
dut.wait_for_connection()
|
||||||
print(dut.read())
|
print(dut.read())
|
||||||
print(dut.describe())
|
print(dut.describe())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user