python-based high-level applications development for ... › icap2015 › talks ›...
TRANSCRIPT
Python-based High-level Applications Development for
Shanghai So� X-ray Free-electron Laser
Tong Zhang (张彤)
on behalf of FEL physis group
Shanghai Institute of Applied Physics (SINAP),
Chinese Academy of Sciences, China
October 12, 2015
The 12nd International Computational Accelerator Physics Conference, Shanghai, China
Introduction High-level Applications Development for SXFEL Conclusions
Outline
1 Introduction
Shanghai So� X-ray Free-electron Laser
High-level Applications for FEL Facilities
2 High-level Applications Development for SXFEL
So�ware Framework of felapps
Building Python ecosystem for felapps
3 Conclusions
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 1 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Outline
1 Introduction
Shanghai So� X-ray Free-electron Laser
High-level Applications for FEL Facilities
2 High-level Applications Development for SXFEL
3 Conclusions
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 2 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Overview of Shanghai So� X-ray Free-electron Laser
Designed to be a two-staged seeded FEL, Shanghai so� x-ray free-electron laser
(SXFEL) is now being constructed at SSRF, SINAP; the 2nd HGHG is expected to
lase at the end of 2017.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 2 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Overview of Shanghai So� X-ray Free-electron Laser
Designed to be a two-staged seeded FEL, Shanghai so� x-ray free-electron laser
(SXFEL) is now being constructed at SSRF, SINAP; the 2nd HGHG is expected to
lase at the end of 2017.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 2 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Overview of Shanghai So� X-ray Free-electron Laser
Designed to be a two-staged seeded FEL, Shanghai so� x-ray free-electron laser
(SXFEL) is now being constructed at SSRF, SINAP; the 2nd HGHG is expected to
lase at the end of 2017.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 2 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Python-based High-level Applications for FEL Facilities
WHAT is high-level applications?
WHY choose Python as the developping language?
WHAT will do with Python?
HOW to do it?
WHAT is the picture like?
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 3 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Python-based High-level Applications for FEL Facilities
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 3 / 21
Q: WHAT is high-level applications?
A: Bridge from complicated to simple.
Introduction High-level Applications Development for SXFEL Conclusions
Python-based High-level Applications for FEL Facilities
WHAT is high-level applications?
WHY choose Python as the developing language?
WHAT will do with Python?
HOW to do it?
WHAT is the picture like?
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 3 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Outline
1 Introduction
2 High-level Applications Development for SXFEL
So�ware Framework of felapps
Building Python ecosystem for felapps
3 Conclusions
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 4 / 21
Introduction High-level Applications Development for SXFEL Conclusions
General diagram for the application development
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 4 / 21
Introduction High-level Applications Development for SXFEL Conclusions
WHY choose Python as the developing language?
Python is a beautiful language, indentation, easy to learn and read;
Python is fully object-oriented designed;
Python is open-sourced, easy to obtain and use, save a lot money;
Excellent community, easy to communicate and seek for help;
Excellent third-party packages to extend the core Python;
Excellent integration with other lower-level languages, e.g. C/C++;
Python is under active development;
Agile development for native-look graphical user interfaces.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 5 / 21
Introduction High-level Applications Development for SXFEL Conclusions
So�ware Development Environment
LINUX: cross-platform;
Python: wx, numpy, scipy, matplotlib, . . .C/C++: build numerical intense Python modules;
GUI: wxPython, PyQt/PySide;
git: version control, team collaboration;
EPICS: so� IOC implementation;
PyEPICS: interface between EPICS and Python;
Linac/FEL: Genesis: FEL radiation,MAD/Elegant: la�ice/tracking.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 6 / 21
Introduction High-level Applications Development for SXFEL Conclusions
So�ware Framework of felapps (I)
felapps: FEL high-level applications, green box: folder, red box: file.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 7 / 21
Introduction High-level Applications Development for SXFEL Conclusions
So�ware Framework of felapps (I)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 8 / 21
Introduction High-level Applications Development for SXFEL Conclusions
So�ware Framework of felapps (II)
App Name Full Name Functionality
Appdrawer Apps Drawer Main launcher panel for all apps of felapps
Cornalyzer Correlation Analyzer Analysis parameters correlation, scan parameters
Dataworkshop Data Workshop Post-processing app for data produced from felapps
Felformula FEL Formula Analytical FEL calculations and numerical simulations
Imageviewer Image Viewer General image viewer and DAQ app for EPICS environment
Matchwizard Match Wizard Beamline matching for accelerators and FEL facilities
Module Name Design Intentions and Descriptions
datautils data processing functions and classes
felutils facility specified features and classes/functions handle FEL physics
imageutils image processing functions and classes
matchutils beamline matching functions and classes
miscutils miscellaneous, e.g. classes for managing app versions
parseutils functions/classes to handle configuration file parsing
pltutils functions/classes to draw GUIs
resutils resource functions to support other utilities
scanutils main functions/classes to handle parameter scan features
funutils useful functinons
felbase classes/functions about fundamental FEL physics
felcalc GUIs about FEL physics, e.g. felformula
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 9 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem for felapps
One of the most significance intention of felapps is trying to build the Python
so�ware ecosystem to support agile and extensible application development.
Build general purpose Python modules/packages to serving as infrastructure;
Well define the interfaces between these modules/packages to versatile apps,
desktop/mobile/web, etc.;
Take full advantage of Python’s dynamic gluiness feature, link everything
together.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 10 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (I)
The portal of felapps: appdrawer, execute ‘appdrawer’ or ‘runfelapps’ in terminal.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 11 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (I)
The portal of felapps: integrate into system menu bar, e.g. in category FEL Apps.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 11 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (II)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 12 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (III)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 13 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (III)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 13 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (III)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 13 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (III)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 13 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (III)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 13 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (IV)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 14 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (IV)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 14 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (V)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 15 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (V)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 15 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (V)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 15 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (V)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 15 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (VI)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 16 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (VI)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 16 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (VI)
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 16 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Building Python ecosystem — Recent progress (VI)
Python package beamline: accelerator la�ice visulization.
deploy: pip install beamlineFramework:
blparser: Python module to parse la�ice, e.g. MAD la�ice by madParser();elements: Python module contains classes to model magnetic elements;
pltutils: Python module to make visulization, e.g. embed into matchwizard app.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 16 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Deployment and Usage of felapps
Approaches to make use of felapps:
1 Use felapps-1.5.0-py2.py3-none-any.whl ready-built Python
package;
2 Build from source by python setup.py bdist wheel to get .whl
package;
3 Install from PyPI by pip install felapps [--upgrade];
Usage example (default Python shell):
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 17 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Outline
1 Introduction
2 High-level Applications Development for SXFEL
3 Conclusions
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 18 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Summary
Development of Python-based FEL high-level applications is under going at
SINAP;
Python package named felapps has been created, several apps are
implemented;
Easy and free to deploy felapps;
The so�ware ecosystem for Python development progresses steadily.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 18 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Perspective of felapps
felapps/apps
beamline
felapps/utils
felapps/physics
felapps/facilities
......
webApps
......
datawarehouse
infrastructure
Facility CloudPython
C/C++
Java
Fortran
Ruby
shell
....
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 19 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Perspective of felapps
felapps repo address: h�ps://github.com/Archman/felapps
beamline repo address: h�ps://github.com/Archman/beamline
PyPI index name: felapps, beamline
felapps beamline
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 19 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Acknowledgments
1 h�ps://docs.python.org/2.7/
2 h�p://docs.scipy.org/doc/
3 h�p://matplotlib.org/
4 h�p://cars9.uchicago.edu/so�ware/python/pyepics/
5 h�p://www.wxpython.org/Phoenix/docs/html/main.html
6 h�p://docs.h5py.org/en/latest/
7 h�ps://www.hdfgroup.org/HDF5/
8 h�ps://pypi.python.org/
9 h�p://www.aps.anl.gov/epics/tech-talk/
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 20 / 21
Introduction High-level Applications Development for SXFEL Conclusions
Acknowledgments
Jianhui Chen, Baixing Zhang, Bo Liu, Huan Zhao, Wending Fang, Jianguo Ding,
Yingbing Yan, Duan Gu, Chaofan Xue, Chao Feng, Haixiao Deng, Dong Wang,
Zhentao Zhao (SINAP), Thomas A Caswell (BNL), Bart Faatz (DESY), Simone Di
Mitri, Enrico Allaria (Ele�ra Sincrotrone Trieste), and many other people.
Tong ZHANG ([email protected]) felapps development for SXFEL ICAP 2015, Oct. 12-16 21 / 21
Thank you for your a�ention!