E-motion

Status & Future

SB Day Out, 15th of September 2015, Château de la Beaume, Seyssins - France

Matias Guijarro

Software Engineer @ Beamline Control Unit

European Synchrotron Radiation Facility

Grenoble, France

Foreword

E-motion = new beamline control software replacing spec

E-motion is only part of the system

E-motion is a motor controllers library

"A new sequencer for the beamlines will be developed to replace SPEC.

[...] The new sequencer will be based on Python. [...]

The new sequencer will rewrite the experiment macros so that

they are easier to maintain.

To use the long shutdown optimally, the new system has to be developed and

tested on as many different kinds of experiments as early as possible beforehand.

This means starting the development of the new system as soon as possible.

Extra resources will be hired to help with the development and installation during the long shutdown."

(New Experiment Sequencer (CP1), page 174)

MASSIF beamlines are the first ESRF beamlines without spec

Why?

Why ?

Standards

  • industrial beamlines, limited set of devices to control
  • well-known data collection protocols

Strong will to move away from spec

  • MXCuBE already covered the path

Long time investment in SW development

  • Trust
  • Commissioning days
  • Teamwork and mutual understanding

UPBL10

  • Motivation to be at the front end of technologies

How?

How ?

Latest BCU developments

  • Beacon, configuration tool
  • E-motion, motor control library
  • Juyo, continuous scan framework

production ready

beta version

in development

"Rogue" BCU development

  • Khoros, sequencer + command line tool
  • First step for full beamline control without spec

Ideas coming from the study made for FP7 WP 10.2,

and DAQ systems evaluations (ended in June, 2010)

... and highly motivated developers

Configuring with Beacon

T. Coutinho, M. Guijarro, S. Petitdemange

Beacon, brilliant Beamline Configuration

  • Client / server architecture
  • Set of YAML files (.yml) containing objects configuration
  • Services built on top of
  • Web application : user interface for configuration editing

Beacon, brilliant Beamline Configuration

Positioning with the ESRF Motion (Emotion) library

C. Guilloud, M. Guijarro, M. Perez

Emotion features

  • 4 well-defined base classes: Controller, Axis, Group & Encoder
  • powered by gevent
  • Virtual (pseudo) axes
  • State of the art control: software limits, user positions, backlash handling, smooth stopping, stepper motors under-resolution move compensation
  • Events
  • Easy configuration, multiple back-ends support
  • Mockup object for simulation / testing
  • Unit tests suite, 70% code coverage
  • Comes with a generic Tango server

Default back-end is XML

 

Beacon back-end

  • integration with full beamline configuration
  • Beacon plugin to get Emotion objects from Beacon

Emotion configuration with Beacon

controller:
    class: IcePAP
    host: iceid306
    axes:
         -
            name: DtoX
            address: 26
            steps_per_unit: 80
            velocity: 125
            acceleration: 500
>>> from beacon import static
>>> cfg = static.get_config()
>>> dtox = cfg.get("DtoX")
>>> dtox
<emotion.axis.Axis object at 0x2729190>
>>> dtox.position()
700.0
>>> dtox.acceleration()
500.0
>>> dtox.velocity()
250.0
bacon:~/local/beamline_control/configuration % tree
.
├── calibrated_diodes.dat
├── eh
│   ├── bpms.yml
│   ├── detector_cover.yml
│   ├── fshutter.yml
│   ├── i0i1.yml
│   ├── __init__.yml
│   ├── MD2S.yml
│   ├── motors
│   │   ├── DtoX.yml
│   │   ├── ehtable.yml
│   │   ├── fshut.yml
│   │   ├── __init__.yml
│   │   ├── mirror.yml
│   │   ├── slitbox.yml
│   │   └── ss2lits.yml
│   ├── musst.yml
│   ├── tango_shutters.yml
│   ├── transmission.yml
│   └── wagos.yml
├── __init__.yml
├── oh
│   ├── bpms.yml
│   ├── frontend.yml
│   ├── __init__.yml
│   ├── mbv1_diode.yml
│   ├── monocal_diode.yml
│   ├── motors
│   │   ├── energy_wl.yml
│   │   ├── __init__.yml
│   │   ├── mono.yml
│   │   ├── pslits.yml
│   │   ├── ss1lits.yml
│   │   ├── transfocator.yml
│   │   └── undulators.yml
│   ├── transfocator.yml
│   └── wagos.yml
├── percent.arr
└── undulators.dat
plugin: emotion

Supported motor controllers

Hardware

PI E517, PI E712, PI E753

Galil DMC 213

PMD 206

NewFocus 8753

FlexDC

IcePAP

Virtual

Slits

KB mirror

2-leg table

3-leg table

Energy

 

Software

Tango Undulator

MD2 Exporter (for MD2 motors)

PiezoJack

Introducing

Khoros

 

 

 

A. Beteva,

M. Guijarro,

S. Petitdemange

Khoros, MASSIF sequencer and beamline control software

Beamline components

Scanning

Sequences

  • Python functions
  • Helpers: cleanup context manager, Task abstraction
  • Step by step: timescan, "ascan", "dscan", "a2scan", "d2scan"
  • basic Data Manager, can write different file formats
  • High-level objects (actuator, shutter, diffractometer, pixel detector, etc.)
  • Configuration with Beacon
  • Counters & measurement groups
  • Motors via Emotion

Khoros Sequences

from khoros import *
from khoros.setup_globals import *
import logging
import sys
import numpy as np

def quick_realign(slits={s1v:0.2}, cnt=i0, mot=thgt, npts=40, start=-0.2, stop=0.2):    
    def restore_slits(motor_pos = [(m, m.position()) for m in slits.iterkeys()):
        for m, pos in motor_pos:
            logging.info("Restoring '%s` to %f", m.name, pos)
            m.move(pos)

    def quick_realign_cleanup(transmission = attenuators.get_transmission()):
        fast_shutter.close()   
        safshut.close()
        attenuators.set_transmission(transmission)
       
    with cleanup(quick_realign_cleanup):
        with cleanup(restore_slits):
            for m, pos in slits.iteritems():
               m.move(pos, wait=False)        
        
            safshut.open()
            fast_shutter.open()
            attenuators.set_transmission(100)
            flux = cnt.read()
            logging.info("Flux before quick realign: %f", flux)
                
            dscan(mot, start, stop, npts, 0.1, cnt)
            data = last_scan_data()
            max_pos = data[np.argmax(data[:,1]),0]

            mot.move(max_pos)
        centrebeam()
        flux = cnt.read()
        logging.info("Flux after quick realign: %f", flux)
        

Khoros Shell

Web application, a la IPython Notebook (Jupyter)

Khoros intregration within MXCuBE 2

Used as a Python library, no need to start another process

 

A specific hardware object is used as a "footbridge" for others to get access to exported Khoros objects within MXCuBE

from HardwareRepository.BaseHardwareObjects import HardwareObject
import os
import sys
import khoros

class Khoros(HardwareObject):
  def __init__(self, *args):
    HardwareObject.__init__(self, *args)

  def init(self, *args):
     setup_file = self.getProperty("setup_file")

     khoros.setup(setup_file, self.__dict__)

Structural Biology Software Status

MXCuBE

  • latest version 2.1 installed on ID29, ID30A-1, ID30A-3, ID30B, (BM14)
  • upgrade to 2.1 is foreseen on ID23-1, ID23-2 asap
  • bugs to fix, little merges to be done
  • version 3 - web application development is about to start... at MAX IV (MXCuBE collaboration)

Khoros

  • front-end is for beamline scientists, not users
  • works ok, but usability issues
  • need more care - then can be installed on ID29, ID23

BsxCuBE

  • I'm sorry

Challenges for the Future

From desktop applications to web applications

  • many advantages
  • for now, lack of manpower to produce quality UI
  • MXCuBE 3 : ESRF developer needed

Python-based data acquisition

  • training needed at all levels (BCU and users)
  • problem has to be tackled in the perspective of Phase II
  • which command line tool ? Khoros is not officially supported

BM29 software (BsxCuBE)

  • HPLC to be integrated, new types of experiments
  • Need a rewrite, full time job for a developer for 2 years

Thanks for your attention

 

Questions ?

Emotion: Status & Future

By Matias Guijarro

Emotion: Status & Future

SB Day Out

  • 1,098