Exemplo n.º 1
0
def createPVScannable(name,
                      pv,
                      addToNameSpace=True,
                      hasUnits=True,
                      getAsString=False):
    """
    utility function to create a scannable from a PV
    arguments:
    name - of scannable
    pv - pv 
    addToNameSpace = if True the scannable is accessible from the commandline after the call
    hasUnits - default True. The value is a number  and support is given for setUserUnits
    getAsString - default False. Useful if the PV is an enum as it returns the string representation. 
                 If true also set hasUnits to False 
    
    e.g.
    createPVScannable("acoll_average_size", "BL13J-OP-ACOLL-01:AVERAGESIZE", True)
    """
    sc = EpicsScannable()
    sc.setName(name)
    sc.setPvName(pv)
    sc.setUseNameAsInputName(True)
    sc.setHasUnits(hasUnits)
    sc.setGetAsString(getAsString)
    sc.afterPropertiesSet()
    sc.configure()
    if addToNameSpace:
        commandServer = InterfaceProvider.getJythonNamespace()
        commandServer.placeInJythonNamespace(name, sc)
    return sc
Exemplo n.º 2
0
from gda.device.scannable import PVScannable, ScannableMotionBase,\
    EpicsScannable
from peem.leem_instances import FOV
from scisoftpy.jython.jymaths import nan
from gdaserver import s4ygap

print "-"*100
print "create KB Rastering control scannables: raster, beamsize, vrastamplitude, hrastamplitude, vrastoffset, hrastoffset, rastperiod, vraststatus, hraststatus"

#Low Level Scannables
vrastamplitude=PVScannable("vrastamplitude","BL06I-EA-SGEN-01:CH2:AMP"); vrastamplitude.configure()
hrastamplitude=PVScannable("hrastamplitude","BL06I-EA-SGEN-01:CH1:AMP"); hrastamplitude.configure()
vrastoffset=PVScannable("vrastoffset","BL06I-EA-SGEN-01:CH2:OFF"); vrastoffset.configure()
hrastoffset=PVScannable("hrastoffset","BL06I-EA-SGEN-01:CH1:OFF"); hrastoffset.configure()
rastperiod=PVScannable("rastperiod","BL06I-EA-SGEN-01:PERIOD"); rastperiod.configure()
vraststatus=EpicsScannable(); vraststatus.setName("vraststatus"); vraststatus.setHasUnits(False); 
vraststatus.setPvName("BL06I-EA-SGEN-01:CH2:OUT"); vraststatus.setGetAsString(True); 
vraststatus.setUseNameAsInputName(True); vraststatus.configure()
hraststatus=EpicsScannable(); hraststatus.setName("hraststatus"); hraststatus.setHasUnits(False); 
hraststatus.setPvName("BL06I-EA-SGEN-01:CH1:OUT"); hraststatus.setGetAsString(True); 
hraststatus.setUseNameAsInputName(True); hraststatus.configure()


KEYSIGHT_OUTPUT_STATUS={0:'Off',1:'On'}
KEYSIGHT_OUTPUT_VALUE={'Off':0,'On':1}

vert,horiz,roff,undefined=['vert','horiz','roff','undefined']

class KBMirrorRasteringStateControl(ScannableMotionBase):
    '''
    control Rastering state and direction: vert,horiz,roff,undefined