예제 #1
0
파일: signals.py 프로젝트: mguijarr/mxcube3
def motor_event_callback(*args, **kwargs):
    # logging.getLogger('HWR').debug('[MOTOR CALLBACK]')
    # logging.getLogger("HWR").debug(kwargs)
    # logging.getLogger("HWR").debug(args)
    signal = kwargs['signal']
    sender = str(kwargs['sender'].__class__).split('.')[0]

    motors_info = Utils.get_centring_motors_info() 

    motors_info.update(Utils.get_light_state_and_intensity())

    motors_info['pixelsPerMm'] = mxcube.diffractometer.get_pixels_per_mm()

    aux = {}
    for pos in mxcube.diffractometer.savedCentredPos:
            aux.update({pos['posId']: pos})

    #  sending all motors position/status, and the current centred positions
    msg = {'Signal': signal,
           'Message': signal,
           'Motors': motors_info,
           'CentredPositions': aux,
           'Data': args[0] if len(args) == 1 else args}
    # logging.getLogger('HWR').debug('[MOTOR CALLBACK]   ' + str(msg))

    try:
        socketio.emit('Motors', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: %s' + str(msg))
예제 #2
0
파일: signals.py 프로젝트: bolmsten/mxcube3
def motor_event_callback(*args, **kwargs):
    # logging.getLogger('HWR').debug('[MOTOR CALLBACK]')
    # logging.getLogger("HWR").debug(kwargs)
    # logging.getLogger("HWR").debug(args)
    signal = kwargs['signal']
    sender = str(kwargs['sender'].__class__).split('.')[0]

    motors_info = Utils.get_centring_motors_info() 

    motors_info.update(Utils.get_light_state_and_intensity())

    motors_info['pixelsPerMm'] = mxcube.diffractometer.get_pixels_per_mm()

    aux = {}
    for pos in mxcube.diffractometer.savedCentredPos:
            aux.update({pos['posId']: pos})

    #  sending all motors position/status, and the current centred positions
    msg = {'Signal': signal,
           'Message': signal,
           'Motors': motors_info,
           'CentredPositions': aux,
           'Data': args[0] if len(args) == 1 else args}
    # logging.getLogger('HWR').debug('[MOTOR CALLBACK]   ' + str(msg))

    try:
        socketio.emit('Motors', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: %s' + str(msg))
예제 #3
0
def get_movables_state():
    ret = Utils.get_centring_motors_info()

    ret.update(Utils.get_light_state_and_intensity())

    resp = jsonify(ret)
    resp.status_code = 200
    return resp
예제 #4
0
def get_movables_state():
    ret = Utils.get_centring_motors_info()

    ret.update(Utils.get_light_state_and_intensity())

    resp = jsonify(ret)
    resp.status_code = 200
    return resp