예제 #1
0
파일: quokkaConfig.py 프로젝트: nxi/gumtree
def selBs(beamstop):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController('/commands/beamstops/selbsn')
    
    # Configuring command properties
    timeout = 10
    count = 0
    sics.hset(commandController, '/bs', beamstop)
    while sics.getValue('/commands/beamstops/selbsn/bs').getIntData() != beamstop:
        time.sleep(0.1)
        count += 0.1
        if count > timeout:
            raise Exception("Time out on receiving feedback on beam stop selection")
    
    cnt = 0
    while cnt < 20:
        try:
            commandController.syncExecute();
            break
        except SicsExecutionException, e:
            em = str(e.getMessage())
            if em.__contains__('Interrupted'):
                raise e
            log('retry selecting beam stop ' + str(beamstop))
            time.sleep(1)
            while not sicsController.getServerStatus().equals(ServerStatus.EAGER_TO_EXECUTE):
                time.sleep(0.3)
            cnt += 1
예제 #2
0
파일: quokka.py 프로젝트: dailypips/gumtree
def selBs(beamstop):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController('/commands/beamstops/selbsn')
    
    # Configuring command properties
    timeout = 10
    count = 0
    sics.hset(commandController, '/bs', beamstop)
    while sics.getValue('/commands/beamstops/selbsn/bs').getIntData() != beamstop:
        time.sleep(0.1)
        count += 0.1
        if count > timeout:
            raise Exception("Time out on receiving feedback on beam stop selection")
    
    cnt = 0
    while cnt < 20:
        try:
            commandController.syncExecute();
            break
        except SicsExecutionException, e:
            em = str(e.getMessage())
            if em.__contains__('Interrupted'):
                raise e
            log('retry selecting beam stop ' + str(beamstop))
            time.sleep(1)
            while not sicsController.getServerStatus().equals(ServerStatus.EAGER_TO_EXECUTE):
                time.sleep(0.3)
            cnt += 1
예제 #3
0
파일: quokka.py 프로젝트: calltl/gumtree
def selBs(beamstop):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController('/commands/beamstops/selbsn')
    
    # Configuring command properties
    timeout = 10
    count = 0
    sics.hset(commandController, '/bs', beamstop)
    while sics.getValue('/commands/beamstops/selbsn/bs').getIntData() != beamstop:
        time.sleep(0.1)
        count += 0.1
        if count > timeout:
            raise Exception("Time out on receiving feedback on beam stop selection")
    # Synchronously run command
    commandController.syncExecute()
예제 #4
0
def selBs(beamstop):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController(
        '/commands/beamstops/selbsn')

    # Configuring command properties
    timeout = 10
    count = 0
    sics.hset(commandController, '/bs', beamstop)
    while sics.getValue(
            '/commands/beamstops/selbsn/bs').getIntData() != beamstop:
        time.sleep(0.1)
        count += 0.1
        if count > timeout:
            raise Exception(
                "Time out on receiving feedback on beam stop selection")
    # Synchronously run command
    commandController.syncExecute()
예제 #5
0
파일: quokka.py 프로젝트: nxi/gumtree
def selBsxz(beamstop, bx, bz):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController(
        '/commands/beamstops/selbsxz')

    # Configuring command properties
    sics.hset(commandController, '/bs', beamstop)
    sics.hset(commandController, '/bx', bx)
    sics.hset(commandController, '/bz', bz)

    cnt = 0
    while cnt < 20:
        try:
            commandController.syncExecute()
            break
        except SicsExecutionException, e:
            em = str(e.getMessage())
            if em.__contains__('Interrupted'):
                raise e
            log('retry selecting beam stop ' + str(beamstop))
            time.sleep(1)
            while not sicsController.getServerStatus().equals(
                    ServerStatus.EAGER_TO_EXECUTE):
                time.sleep(0.3)
            cnt += 1
예제 #6
0
파일: quokka.py 프로젝트: calltl/gumtree
def scan(scanMode, dataType, preset, force='true', saveType=saveType.save):

    controllerPath = '/commands/scan/runscan'
    sicsController = sics.getSicsController()
    scanController = sicsController.findComponentController(controllerPath)

    # Configuring scan properties
    #    sics.hset(scanController, '/scan_variable', DEVICE_SAMX)
    #    sics.hset(scanController, '/scan_start', getSampleHolderPosition())
    #    sics.hset(scanController, '/scan_stop', getSampleHolderPosition())
    sics.hset(scanController, '/numpoints', 1)
    #    # Hack to fix monitor selection in scan
    #    if (scanMode.key == 'monitor'):
    #        sics.hset(scanController, '/mode', 'MONITOR_1')
    #    else:
    #        sics.hset(scanController, '/mode', scanMode.key)
    sics.hset(scanController, '/preset', preset)
    #    sics.hset(scanController, '/datatype', dataType.key)
    #    sics.hset(scanController, '/savetype', saveType.key)
    sics.hset(scanController, '/force', force)

    sics.execute('hset /instrument/dummy_motor 0', 'general')
    sics.execute('hset /instrument/dummy_motor 1', 'scan')

    sics.execute('hset ' + controllerPath + '/scan_variable dummy_motor',
                 'scan')
    sics.execute('hset ' + controllerPath + '/scan_start 0', 'scan')
    sics.execute('hset ' + controllerPath + '/scan_stop 0', 'scan')
    sics.execute('hset ' + controllerPath + '/numpoints 1', 'scan')
    if (scanMode.key == 'monitor'):
        sics.execute('hset ' + controllerPath + '/mode MONITOR_1', 'scan')
    else:
        sics.execute('hset ' + controllerPath + '/mode ' + scanMode.key,
                     'scan')
    sics.execute('hset ' + controllerPath + '/preset ' + str(preset), 'scan')
    sics.execute('hset ' + controllerPath + '/datatype ' + dataType.key,
                 'scan')
    sics.execute('hset ' + controllerPath + '/savetype ' + saveType.key,
                 'scan')
    sics.execute('hset ' + controllerPath + '/force ' + force, 'scan')

    sics.execute('hset /instrument/dummy_motor 2', 'general')
    sics.execute('hset /instrument/dummy_motor 3', 'scan')

    # Wait 1 sec to make the setting settle
    time.sleep(2)

    # Synchronously run scan
    scanController.syncExecute()

    sics.execute('hset /instrument/dummy_motor 4', 'general')
    sics.execute('hset /instrument/dummy_motor 5', 'scan')

    # Get output filename
    filenameController = sicsController.findDeviceController('datafilename')
    savedFilename = filenameController.getValue().getStringData()
    log('Saved to ' + savedFilename)
    return savedFilename
예제 #7
0
파일: quokka.py 프로젝트: calltl/gumtree
def driveHistmem(hmMode, preset):
    sicsController = sics.getSicsController()
    histmemController = sicsController.findComponentController('/commands/histogram/histmem')
    sics.hset(histmemController, '/mode', hmMode.key)
    sics.hset(histmemController, '/preset', preset)
    sics.hset(histmemController, '/cmd', 'start')
    log('Start histmem ...')
    histmemController.syncExecute()
    time.sleep(0.8)
    log('Histmem stopped')
예제 #8
0
파일: quokka.py 프로젝트: calltl/gumtree
def scan(scanMode, dataType, preset, force='true', saveType=saveType.save):
    
    controllerPath = '/commands/scan/runscan'
    sicsController = sics.getSicsController()
    scanController = sicsController.findComponentController(controllerPath)
    
    # Configuring scan properties
#    sics.hset(scanController, '/scan_variable', DEVICE_SAMX)
#    sics.hset(scanController, '/scan_start', getSampleHolderPosition())
#    sics.hset(scanController, '/scan_stop', getSampleHolderPosition())
    sics.hset(scanController, '/numpoints', 1)
#    # Hack to fix monitor selection in scan
#    if (scanMode.key == 'monitor'):
#        sics.hset(scanController, '/mode', 'MONITOR_1')
#    else:
#        sics.hset(scanController, '/mode', scanMode.key)
    sics.hset(scanController, '/preset', preset)
#    sics.hset(scanController, '/datatype', dataType.key)
#    sics.hset(scanController, '/savetype', saveType.key)
    sics.hset(scanController, '/force', force)

    sics.execute('hset /instrument/dummy_motor 0', 'general')
    sics.execute('hset /instrument/dummy_motor 1', 'scan')
    
    sics.execute('hset ' + controllerPath + '/scan_variable dummy_motor', 'scan')
    sics.execute('hset ' + controllerPath + '/scan_start 0', 'scan')
    sics.execute('hset ' + controllerPath + '/scan_stop 0', 'scan')
    sics.execute('hset ' + controllerPath + '/numpoints 1', 'scan')
    if (scanMode.key == 'monitor'):
        sics.execute('hset ' + controllerPath + '/mode MONITOR_1', 'scan')
    else:
        sics.execute('hset ' + controllerPath + '/mode ' + scanMode.key, 'scan')
    sics.execute('hset ' + controllerPath + '/preset ' + str(preset), 'scan')
    sics.execute('hset ' + controllerPath + '/datatype ' + dataType.key, 'scan')
    sics.execute('hset ' + controllerPath + '/savetype ' + saveType.key, 'scan')
    sics.execute('hset ' + controllerPath + '/force ' + force, 'scan')

    sics.execute('hset /instrument/dummy_motor 2', 'general')
    sics.execute('hset /instrument/dummy_motor 3', 'scan')
    
    # Wait 1 sec to make the setting settle
    time.sleep(2)
    
    # Synchronously run scan
    scanController.syncExecute()

    sics.execute('hset /instrument/dummy_motor 4', 'general')
    sics.execute('hset /instrument/dummy_motor 5', 'scan')
    
    # Get output filename
    filenameController = sicsController.findDeviceController('datafilename')
    savedFilename = filenameController.getValue().getStringData()
    log('Saved to ' +  savedFilename)
    return savedFilename
예제 #9
0
def driveHistmem(hmMode, preset):
    sicsController = sics.getSicsController()
    histmemController = sicsController.findComponentController(
        '/commands/histogram/histmem')
    sics.hset(histmemController, '/mode', hmMode.key)
    sics.hset(histmemController, '/preset', preset)
    sics.hset(histmemController, '/cmd', 'start')
    log('Start histmem ...')
    histmemController.syncExecute()
    time.sleep(0.8)
    log('Histmem stopped')
예제 #10
0
파일: quokka.py 프로젝트: calltl/gumtree
def selBsxz(beamstop, bx, bz):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController('/commands/beamstops/selbsxz')
    
    # Configuring command properties
    sics.hset(commandController, '/bs', beamstop)
    sics.hset(commandController, '/bx', bx)
    sics.hset(commandController, '/bz', bz)
    
    # Synchronously run command
    commandController.syncExecute()
예제 #11
0
def selBsxz(beamstop, bx, bz):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController(
        '/commands/beamstops/selbsxz')

    # Configuring command properties
    sics.hset(commandController, '/bs', beamstop)
    sics.hset(commandController, '/bx', bx)
    sics.hset(commandController, '/bz', bz)

    # Synchronously run command
    commandController.syncExecute()
예제 #12
0
파일: quokka.py 프로젝트: Gumtree/gumtree
def selBsHelper(beamstop, bx, bz, controller):
    # get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController(controller)

    # configuring command properties
    if bx is not None:
        sics.hset(commandController, '/bx', bx)
    if bz is not None:
        sics.hset(commandController, '/bz', bz)

    sics.hset(commandController, '/bs', beamstop)

    count = 0
    while getIntData(controller + '/bs') != beamstop:
        time.sleep(0.1)
        count += 1
        if count > 100:
            raise Exception('Time out on receiving feedback on beam stop selection')

    count = 0
    while True:
        try:
            count += 1
            slog('run beamstop selecting command ...')
            commandController.syncExecute()
            break

        except (Exception, SicsExecutionException) as e:
            if isInterruptException(e) or (count >= 20):
                raise

            slog('Retry selecting beam stop %s' % beamstop)
            time.sleep(1)
            waitUntilSicsIs(ServerStatus.EAGER_TO_EXECUTE)

    slog('beam stop is %s' % beamstop)
예제 #13
0
def selBsHelper(beamstop, bx, bz, controller):
    # get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController(controller)

    # configuring command properties
    if bx is not None:
        sics.hset(commandController, '/bx', bx)
    if bz is not None:
        sics.hset(commandController, '/bz', bz)

    sics.hset(commandController, '/bs', beamstop)

    count = 0
    while getIntData(controller + '/bs') != beamstop:
        time.sleep(0.1)
        count += 1
        if count > 100:
            raise Exception(
                'Time out on receiving feedback on beam stop selection')

    count = 0
    while True:
        try:
            count += 1
            commandController.syncExecute()
            break

        except (Exception, SicsExecutionException) as e:
            if isInterruptException(e) or (count >= 20):
                raise

            slog('Retry selecting beam stop %s' % beamstop)
            time.sleep(1)
            waitUntilSicsIs(ServerStatus.EAGER_TO_EXECUTE)

    slog('beam stop is %s' % beamstop)
예제 #14
0
파일: quokka.py 프로젝트: dailypips/gumtree
def selBsxz(beamstop, bx, bz):
    # Get command controller
    sicsController = sics.getSicsController()
    commandController = sicsController.findComponentController('/commands/beamstops/selbsxz')
    
    # Configuring command properties
    sics.hset(commandController, '/bs', beamstop)
    sics.hset(commandController, '/bx', bx)
    sics.hset(commandController, '/bz', bz)
    
    cnt = 0
    while cnt < 20:
        try:
            commandController.syncExecute();
            break
        except SicsExecutionException, e:
            em = str(e.getMessage())
            if em.__contains__('Interrupted'):
                raise e
            log('retry selecting beam stop ' + str(beamstop))
            time.sleep(1)
            while not sicsController.getServerStatus().equals(ServerStatus.EAGER_TO_EXECUTE):
                time.sleep(0.3)
            cnt += 1