added pvcombination class but is no longer needed. can be deleted
This commit is contained in:
@ -1,40 +1,30 @@
|
||||
from slic.core.adjustable import Adjustable
|
||||
from slic.core.adjustable import Adjustable,DummyAdjustable,PVAdjustable
|
||||
import numpy as np
|
||||
|
||||
class PVCombiAdjustable(Adjustable):
|
||||
def __init__(self, adjustables,values):
|
||||
self.adjustables = adjustables
|
||||
self.values = values # array or indiviual array values
|
||||
self.process_time = np.max(np.array([adj.process_time for adj in self.adjustables]))
|
||||
|
||||
def set_target_value(self, value):
|
||||
intval = int(value)
|
||||
if intval < 0 or intval >= len(self.values[0]):
|
||||
tname = typename(self)
|
||||
raise AdjustableError(f"Outside of array bounds for {tname} \"{self.name}\" to set target values")
|
||||
|
||||
for adj in self.adjustables:
|
||||
adj._wait_for_ready()
|
||||
|
||||
|
||||
|
||||
def set_target_value(self, value):
|
||||
print('##### Setvalue:',value)
|
||||
# check if values are in range
|
||||
for i,adj in enumerate(self.adjustables):
|
||||
val=self.values[i,intval]
|
||||
ret = adj.pvs.setvalue.put(val, wait=True, use_complete=True) # use_complete=True enables status in PV.put_complete
|
||||
error = handle_put_return_value(ret)
|
||||
if error is not None:
|
||||
tname = typename(adj)
|
||||
raise AdjustableError(f"changing {tname} \"{adj.name}\" to {val} {adj.units} failed due to {error}")
|
||||
|
||||
sleep(self.process_time)
|
||||
|
||||
for adj in self.adjustables:
|
||||
adj._wait_for_done()
|
||||
idx = int(value[i])
|
||||
print('### Index',i, idx)
|
||||
val=self.values[i][idx]
|
||||
print('### Setting',adj.name,'to',val)
|
||||
adj.set_target_value(val)
|
||||
|
||||
@property
|
||||
def units(self):
|
||||
[adj.units() for adj in self.adjustables]
|
||||
return ['m' for adj in self.adjustables]
|
||||
# return [adj.units() for adj in self.adjustables if adj is not None]
|
||||
|
||||
|
||||
def get_current_value(self, readback=True):
|
||||
return [adj.get_current_value(readback) for adj in self.adjustables]
|
||||
return [adj.get_current_value() for adj in self.adjustables] # this is different for dummy elements
|
||||
|
||||
def stop(self):
|
||||
for adj in self.adjustbale:
|
||||
|
Reference in New Issue
Block a user