Main Bullet #1
Main Bullet #2
Main Bullet #3
: a bag of chips or “all that?”
:A
highlevelcrossplatformpowerfullyfunapplication
andorsmallusefultooldevelopmentlanguage
Main Bullet #1
Main Bullet #2
Main Bullet #3
Vas ist das Reasoning?
Why?
Motif C/C++ on UnixWare
My road, started out C/C++ and Motif for GUI’s, no free GUI design editor
(UnixWare), X-Designer == $$$
verbose ! many lines to create something simple which promoted hasty
copy/paste/modify code that was not very reusable
Not cross platform and after all that, it still looked bad
C++ Builder
Was familiar with C++ Builder (Borland) that I had used for a
4th year design project, fairly cheap for license
Pallete of reuseable components (VCL), C++, good
documentation, Great!
You could use other peoples VCL’s but there were issues with
Builder versions supporting VCL’s from other versions
Build environment required the VCL library installed on each
computer, so not straightforward having others “checkout
and compile the project”
History
– C++ Builder
Kylix - C++ Builder for Linux
same cheap license, same IDE but Builder Windows VCL code
had to be modified to support Linux libraries, so not really tidy as hoped
Same issues as C++ Builder on Windows
• future stability /support of product?
• build environment (not a big deal but still a hassle) • committing to VCL development meant we would be
making a long term commitment
Prototyped first CMCF data collection app
History - Kylix
But in the end, it didn’t solve the cross platform problem, nor did it look like Borland was going to be supporting it for long.
Matlab
Introduced to Matlab/AT as the main tool for
commissioning (SSRL)
Found it quick to deliver “tools” for AOD, conditioning
vacuum, scan injection angle. Achieving more with less
Quickly create GUI’s using “Guide” development tool IDE offered integrated editing and debugging, very well
documented,
Built in:
• Importing and manipulating data/matrices was trivial
• Built in data visualization using figures, 2D, 3D
• Built in support for manipulating all common forms of data, images, video, 1D and 2D arrays, XML, on and on
• Copy and paste code straight from the help and it worked, seamless
History - Matlab
It “is” cross platform, once Matlab is installed, scripts (.mat
files) can be executed on any supported platform Spring 2006 – on CMCF 1 had most base control finished
(EPICS) and there was a need for automated scans to accelerate commissioning of the beam line.
Need to deliver quickly
Use Matlab with labCa to create a simple framework to
quickly create/modify scans and visualize data
Compiled .mat files into executables for deployment and
regular use
The good:
Scripts were cross platform
Easy to write reusable code, if it was in Matlab’s
path, it found and executed the code. New projects didn’t require a completely new build environment
Simplified development environment for
“Checkout project and run”
Very well documented
Use of common data types (images, multi
dimensional arrays ,etc) meant access to code written by developers in many different
disciplines via Matlab website “File Exchange”. Your problem might already have a solution
Used my many in the scientific community
The bad:
Need Matlab license to run $$
Extra “Toolbox’s” cost money, someone might have written
a solution for your problem which might depend on a toolbox that we don’t have or don’t want to purchase
No native callback mechanism, made one using timers and
flags
Single threaded
• Also prototyped CMCF data collection app and found that monitoring disk file updates and handling GUI data collection status updates gave impression to the user that the software was confused due to lag
Compiling .mat files into executables required the same
version of gcc that Matlab had been compiled with
1.
Given a project where current state is:
1. Runs on Windows XP 2. MS Visual Studio 2008
3. Uses locally installed NI PCI cards, and 2 ISA cards (8 bit)
4. Existing code is un-managed C and C++ , total mix, extremely easy to break while
trying to add another feature, or just trying to fix something
5. Developed at a time when “Active X Controls” were how things were done
(ATL/MFC), now its all .Net “Windows Presentation Foundation” which does not support Active X controls natively
6. Measurement Studio used for some data visualization (plotting, buttons) which are
active X controls, desirable to remove “Measurement Studio” visual components
7. Many vender dll’s including NI Measurement Studio, for some, support ended years
ago
8. Need to write this software so that it can be co-developed and maintained at another
lab
Needs to be open source, easy to get and free
Well supported, lots of users so no fear of wasted effort and
resources moving forward, leverage knowledge to other projects Easy to develop in, less code, make use of existing code and libraries
wherever possible
Cross platform, not maintaining multiple OS versions of new software
No restrictions on GUI development or visualizing data, 2D, 3D, video
Reduce amount of time and energy devoted to the development environment by getting off the MS dependency train (don’t get me started)
Eclipse - IDE
Free and cross platform (Win, Mac, Linux) Well documented and supported IDE
Integrated editing and debugging with pyDev
Well known, use with Java, Python, C, C++, no fear of wasted time or resources
Python – High Level Programming language
Free and cross platform (Win, Mac, Linux) Well documented and supported,
Like GCC python is a standard component that ships with the OS (except windows) Adding modules is done once , once installed all executions of that python
interpreter have access to the modules, 100’s /1000’s of modules out there
Signal/Slot event processing (like callbacks)
Same power as Matlab in terms of data manipulation and visualization because of
modules such as numpy, pil, matplotlib, qwtplot, pyOpenGl.
Quick to develop in, less code easy to read, test at the prompt and add it to the file New projects require very little setup (no real build environment)
www.lightsource.ca
Many built in convenience functions for manipulating data and variables Its fun
Qt4 – Application and UI Framework
Free and cross platform (Win, Mac, Linux) Very well documented
Looks the same on all platforms (I think)
Same language bindings as C++ (if you can do it in C++ you can do it in python) We like it and it has become CLS standard for C++ and now python
It’s interpreted the first time you run the .py file, it is
then compiled into byte code (.pyc) file, if no changes it
runs the byte code file next time round
Once python distro installed all modules that are
copied to <pythondist>/Lib/site-packages directory are
now available to be “imported”
Modules can be run stand alone for testing or
called/created by other classes
Projects:
•
checkDB:
– Verifies EPICS db files against your dbd files
•
loadParams:
– Reads a text file of multi column values and writes them out to a serial port. The command format for the string sent out the serial port is defined in the same text file, easy then to configure for any device.
•
adlToJson:
– Convert MEDM files into json objects for Glen’s pyEdm
•
STXM drivers:
– 8 dlls, motors, servo control via 8 bit Agilent card (now that’s legacy!) – NI DAQmx , several people had already created python bindings for it
•
STXM raster scanning and data visualization
– Built on base classes written by Michel for CMCF (mxdc), converted from GTK to QT4
– Plots/2D images through QWT (demo)
•
SYLMAND wire scan data viewer
– Reused plotting module created for stxm stuff, tweaked a little and gave it to Venkat on the beam line (written and tested on Windows and deployed to Linux)
Best way to find out why is to give it a try,
checkout examples etc
Linux: /home/beamline/bin/python2.6