コード例 #1
0
def run_command(cmd, use_full_feedback=False):
    call_back = __SICS_Callback__(use_full_feedback)
    SicsCore.getDefaultProxy().send(cmd, call_back)
    acc_time = 0
    #    while call_back.__status__ is None and acc_time < 20:
    while call_back.__status__ is None:
        time.sleep(0.2)
        acc_time += 0.2
    if call_back.__status__ is None:
        raise Exception, 'time out in running the command'
    return call_back.__status__
コード例 #2
0
ファイル: sics.py プロジェクト: dailypips/gumtree
def run_command(cmd, use_full_feedback = False):
    call_back = __SICS_Callback__(use_full_feedback)
    SicsCore.getDefaultProxy().send(cmd, call_back)
    acc_time = 0
#    while call_back.__status__ is None and acc_time < 2:
    while call_back.__status__ is None:
        time.sleep(0.2)
        acc_time += 0.2
    if call_back.__status__ is None:
        raise Exception, 'time out in running the command'
    return call_back.__status__
コード例 #3
0
ファイル: sics.py プロジェクト: calltl/gumtree
def run_command(cmd):
    global __status__
    __status__ = None
    call_back = __SICS_Callback__()
    SicsCore.getDefaultProxy().send(cmd, call_back)
    acc_time = 0
    while __status__ is None and acc_time < 2:
        time.sleep(0.2)
        acc_time += 0.2
    if __status__ is None:
        raise Exception, 'time out in running the command'
    return __status__
コード例 #4
0
def run_command_timeout(cmd, use_full_feedback=False, timeout=None):
    logger.log('using timeout command')
    call_back = __SICS_Callback__(use_full_feedback)
    SicsCore.getDefaultProxy().send(cmd, call_back)
    acc_time = 0
    while call_back.__status__ is None and (timeout is None
                                            or acc_time < timeout):
        #    while call_back.__status__ is None:
        time.sleep(0.2)
        acc_time += 0.2
    if call_back.__status__ is None:
        raise Exception, 'time out in running the command'
    return call_back.__status__
コード例 #5
0
ファイル: quokkaConfig.py プロジェクト: nxi/gumtree
def driveGuide(guideConfig):
    # Set configuration
    if hasattr(guideConfig, 'key'):
        guideConfig = guideConfig.key
    sics.set('/commands/optics/guide/configuration', guideConfig)
    log('Moving guide to ' + guideConfig)
    sicsController = SicsCore.getSicsController()
    commandController = sicsController.findComponentController('/commands/optics/guide')
    # Setting of configuration and starting a command are committed to SICS via different communication channels
    # In order to make those in sync, we need to wait for the configuration to be settled.
    time.sleep(0.1)
    
    # Start command now
    cnt = 0
    while cnt < 20:
        try:
            commandController.syncExecute();
            break
        except SicsExecutionException, e:
            em = str(e.getMessage())
            if em.__contains__('Interrupted'):
                raise e
            log('retry moving guide to ' + str(guideConfig))
            time.sleep(1)
            while not sicsController.getServerStatus().equals(ServerStatus.EAGER_TO_EXECUTE):
                time.sleep(0.3)
            cnt += 1
コード例 #6
0
def count(mode, preset):
    # Initialisation
    sicsController = SicsCore.getSicsController()
    countController = sicsController.findComponentController(
        '/commands/monitor/count')
    hset(countController, '/mode', mode)
    hset(countController, '/preset', preset)

    # Monitor status
    while (countController.getCommandStatus().equals(CommandStatus.BUSY)):
        # Don't do anything before counter is ready
        time.sleep(0.1)

    # Run scan
    logger.log('Count started')
    countController.asyncExecute()

    # Monitor initial status change
    timeOut = False
    counter = 0
    while (countController.getStatusDirtyFlag() == False):
        time.sleep(0.1)
        counter += 0.1
        if (counter >= 1):
            timeOut = True
            logger.log('Time out on running count')
            break

    # Enter into normal sequence
    if (timeOut == False):
        while (countController.getCommandStatus().equals(CommandStatus.BUSY)):
            time.sleep(0.1)
    handleInterrupt()
    logger.log('Count completed')
コード例 #7
0
ファイル: sics.py プロジェクト: calltl/gumtree
def count(mode, preset):
    # Initialisation
    sicsController = SicsCore.getSicsController()
    countController = sicsController.findComponentController('/commands/monitor/count')
    hset(countController, '/mode', mode)
    hset(countController, '/preset', preset)
    
    # Monitor status
    while(countController.getCommandStatus().equals(CommandStatus.BUSY)):
        # Don't do anything before counter is ready
        time.sleep(0.1)
        
    # Run scan
    logger.log('Count started')
    countController.asyncExecute()
    
    # Monitor initial status change
    timeOut = False
    counter = 0
    while(countController.getStatusDirtyFlag() == False):
        time.sleep(0.1)
        counter += 0.1
        if (counter >= 1):
            timeOut = True
            logger.log('Time out on running count')
            break
            
    # Enter into normal sequence
    if (timeOut == False):
        while (countController.getCommandStatus().equals(CommandStatus.BUSY)):
            time.sleep(0.1)
    handleInterrupt()
    logger.log('Count completed')
コード例 #8
0
ファイル: quokka.py プロジェクト: dailypips/gumtree
def driveGuide(guideConfig):
    # Set configuration
    sics.set('/commands/optics/guide/configuration', guideConfig.key)
    log('Moving guide to ' + guideConfig.key)
    sicsController = SicsCore.getSicsController()
    commandController = sicsController.findComponentController('/commands/optics/guide')
    # Setting of configuration and starting a command are committed to SICS via different communication channels
    # In order to make those in sync, we need to wait for the configuration to be settled.
    time.sleep(0.1)
    
    # Start command now
    cnt = 0
    while cnt < 20:
        try:
            commandController.syncExecute();
            break
        except SicsExecutionException, e:
            em = str(e.getMessage())
            if em.__contains__('Interrupted'):
                raise e
            log('retry moving guide to ' + str(guideConfig.key))
            time.sleep(1)
            while not sicsController.getServerStatus().equals(ServerStatus.EAGER_TO_EXECUTE):
                time.sleep(0.3)
            cnt += 1
コード例 #9
0
ファイル: sics.py プロジェクト: calltl/gumtree
def histmem(cmd, mode, preset):
    sicsController = SicsCore.getSicsController()
    histmemController = sicsController.findComponentController('/commands/histogram/histmem')
    hset(histmemController, '/cmd', cmd)
    hset(histmemController, '/mode', mode)
    hset(histmemController, '/preset', preset)
    # give time for hset to finish
    time.sleep(0.2)
    # start histmem command
    logger.log(cmd + ' histogram acquisition') 
    histmemController.asyncExecute()
    
    # Monitor initial status change
    timeOut = False
    counter = 0;
    while(histmemController.getStatusDirtyFlag() == False):
        time.sleep(0.1)
        counter += 0.1
        if (counter >= 1):
            timeOut = True
            logger.log('Time out on running count')
            break
            
    # Enter into normal sequence
    if (timeOut == False):
        while (histmemController.getCommandStatus().equals(CommandStatus.BUSY) or histmemController.getCommandStatus().equals(CommandStatus.STARTING)):
            time.sleep(0.1)
    handleInterrupt()
    logger.log('Count completed')
コード例 #10
0
def histmem(cmd, mode, preset):
    sicsController = SicsCore.getSicsController()
    histmemController = sicsController.findComponentController(
        '/commands/histogram/histmem')
    hset(histmemController, '/cmd', cmd)
    hset(histmemController, '/mode', mode)
    hset(histmemController, '/preset', preset)
    # give time for hset to finish
    time.sleep(0.2)
    # start histmem command
    logger.log(cmd + ' histogram acquisition')
    histmemController.asyncExecute()

    # Monitor initial status change
    timeOut = False
    counter = 0
    while (histmemController.getStatusDirtyFlag() == False):
        time.sleep(0.1)
        counter += 0.1
        if (counter >= 1):
            timeOut = True
            logger.log('Time out on running count')
            break

    # Enter into normal sequence
    if (timeOut == False):
        while (histmemController.getCommandStatus().equals(CommandStatus.BUSY)
               or histmemController.getCommandStatus().equals(
                   CommandStatus.STARTING)):
            time.sleep(0.1)
    handleInterrupt()
    logger.log('Count completed')
コード例 #11
0
ファイル: quokka.py プロジェクト: calltl/gumtree
def driveGuide(guideConfig):
    # Set configuration
    sics.set('/commands/optics/guide/configuration', guideConfig.key)
    log('Moving guide to ' + guideConfig.key)
    sicsController = SicsCore.getSicsController()
    commandController = sicsController.findComponentController('/commands/optics/guide')
    # Setting of configuration and starting a command are committed to SICS via different communication channels
    # In order to make those in sync, we need to wait for the configuration to be settled.
    time.sleep(0.1)
    # Start command now
    commandController.syncExecute();
    log('Guide is moved to ' + getGuideConfig())
コード例 #12
0
def driveGuide(guideConfig):
    # Set configuration
    sics.set('/commands/optics/guide/configuration', guideConfig.key)
    log('Moving guide to ' + guideConfig.key)
    sicsController = SicsCore.getSicsController()
    commandController = sicsController.findComponentController(
        '/commands/optics/guide')
    # Setting of configuration and starting a command are committed to SICS via different communication channels
    # In order to make those in sync, we need to wait for the configuration to be settled.
    time.sleep(0.1)
    # Start command now
    commandController.syncExecute()
    log('Guide is moved to ' + getGuideConfig())
コード例 #13
0
def clearInterrupt():
    SicsCore.getSicsController().clearInterrupt()
コード例 #14
0
def isInterrupt():
    return SicsCore.getSicsController().isInterrupted()
コード例 #15
0
def interrupt(channel=None):
    if channel == None:
        SicsCore.getSicsController().interrupt()
    else:
        SicsCore.getDefaultProxy().send('INT1712 3', None, channel)
    logger.log("Sent SICS interrupt")
コード例 #16
0
def getSicsController():
    return SicsCore.getSicsController()
コード例 #17
0
ファイル: sics.py プロジェクト: calltl/gumtree
def isInterrupt():
    return SicsCore.getSicsController().isInterrupted()
コード例 #18
0
ファイル: sics.py プロジェクト: calltl/gumtree
def getSicsController():
    return SicsCore.getSicsController()
コード例 #19
0
ファイル: sics.py プロジェクト: calltl/gumtree
def execute(command, channel_id = 'general'):
    SicsCore.getDefaultProxy().send(command, None, channel_id)
    handleInterrupt()
コード例 #20
0
ファイル: sics.py プロジェクト: calltl/gumtree
def clearInterrupt():
    SicsCore.getSicsController().clearInterrupt()
コード例 #21
0
def execute(command, channel_id='general'):
    SicsCore.getDefaultProxy().send(command, None, channel_id)
    handleInterrupt()
コード例 #22
0
ファイル: quokka.py プロジェクト: calltl/gumtree
def getSampleHolderPosition():
    sicsController = SicsCore.getSicsController()
    samx = sicsController.findDeviceController(DEVICE_SAMX)
    return samx.getValue().getFloatData()
コード例 #23
0
ファイル: quokkaConfig.py プロジェクト: nxi/gumtree
def getSampleHolderPosition():
    sicsController = SicsCore.getSicsController()
    samx = sicsController.findDeviceController(DEVICE_SAMX)
    return samx.getValue().getFloatData()
コード例 #24
0
ファイル: sics.py プロジェクト: calltl/gumtree
def interrupt():
    SicsCore.getSicsController().interrupt()
    logger.log("Sent SICS interrupt")