Skip to content
Snippets Groups Projects
Select Git revision
  • 6e39c8dd30f1940e4a677fdeb9abb4d162ab8c61
  • main default protected
  • pixel-fitter
  • remove-pybind11
  • multiscale_cuda
  • profiling
  • wavelet-deconvolution
  • ast-1102-nanobind
  • temp-fix-for-local-rms-multiscale-crash
  • ast-943-use-central-frequency-only
  • add-sphinx
  • test-radler-as-static
12 results

image_set.cc

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    startup.py 1.68 KiB
    #! /usr/bin/env python3
    import tango
    import logging
    
    logger = logging.getLogger()
    
    def startup(device: str, force_restart: bool) -> tango.DeviceProxy:
        '''
        Start a LOFAR Tango device:
        pcc = startup(device = 'LTS/PCC/1', force_restart = False)
        '''
        proxy = tango.DeviceProxy(device)
        state = proxy.state()
    
        # go to OFF, but only if force_restart is True
        if force_restart is True:
            logger.warning(f"Forcing device {device} restart.")
            proxy.off()
            state = proxy.state()
            if state is not tango._tango.DevState.OFF:
                logger.error(f"Device {device} cannot perform off although restart has been enforced, state = {state}.  Please investigate.")
                return proxy
    
        if state is not tango._tango.DevState.OFF:
            logger.error(f"Device {device} is not in OFF state, cannot start it.  state = {state}")
            return proxy
    
        # Initialise device
        logger.info(f"Device {device} is in OFF, performing initialisation.")
        proxy.initialise()
        state = proxy.state()
        if state is not tango._tango.DevState.STANDBY:
            logger.error(f"Device {device} cannot perform initialise, state = {state}.  Please investigate.")
            return proxy
    
        # Set default values
        logger.info(f"Device {device} is in STANDBY, setting default values.")
        proxy.set_defaults()
    
        # Turn on device
        logger.info(f"Device {device} is in STANDBY, performing on.")
        proxy.on()
        state = proxy.state()
        if state is not tango._tango.DevState.ON:
            logger.error(f"Device {device} cannot perform on, state = {state}.  Please investigate.")
        else:
            logger.info(f"Device {device} has successfully reached ON state.")
    
        return proxy