540 likes | 706 Views
Contributing to GumTree (Version 1.1). Presenter: Tony Lam (Gumnix Lab). Tutorial Prerequisite. GumTree Development Environment should be correctly setup on your machine Check out the latest “ GumTree Platform ” and “ GumTree Common Library ” from Sourceforge
E N D
Contributing to GumTree(Version 1.1) Presenter: Tony Lam (Gumnix Lab)
Tutorial Prerequisite • GumTree Development Environment should be correctly setup on your machine • Check out the latest “GumTree Platform” and “GumTree Common Library” from Sourceforge • Run Gumzilla demo instrument to check your GumTree installation • Have the tutorial note & source ready in your Eclipse workspace • Basic J2SE 5.0 Programming Skill • Some ideas on using Java Development Tool (JDT) and under Eclipse
Tutorial Outcomes • What can you expect: • Be able to write simple plug-in for GumTree and Eclipse • Understand the design philosophy of GumTree • Contribute to GumTree by using the GumTree Platform API • An instrument plug-in (Gumnut) for you to take home
Tutorial Outline • Basic GumTree Concept • Say “Hello World” to GumTree • Data Handling • Experiment Modelling • Data Acquisition • Instrument Adaptation
What is GumTree? • Official GUI for NBIP instruments • A highly Integrated Scientific Experiment Environment ISEE!! • An Eclipse based Rich Client Platform (RCP) application • An open source GUI framework for collaboration • ANSTO’s secret software weapon for total world domination (just kidding) • http://gumtree.sourceforge.net
GumTree Architecture Instrument Specific Component Instrument Plugin Instrument Specific Instrument Control System Bridge Data Acquisition (DAQ) device Data Reduction and Analysis (DRA) common cs GumTree Platform experiment Workbench Modelling core ui vis data Platform Infrastructure RCP Eclipse Ecosystem Open Source Technology Leveraged Technology Java 5 VM
GumTree Platform GumNIX Games HIPD Simulation Device HRPD Clock UI TAS Environment Control Device (Ancillary) SANS Other Eclipse Plug-ins VIS DRA REFL REST Core Data Data Analysis Algorithm MRPD Your Plug-ins Device ACC Instrument Operation Procedure CS Multimedia Eclipse RCP Runtime Their Plug-ins Accessaries SDK Testing Framework GumTree Project Contributing to GumTree • What can be extended in GumTree? • Control System adaptation • Visualisation Rendering Engine • Data Format Support… and more • When? • Integrating new features to existing instrument • Writing new instrument front end • Where? • In a new GumTree plug-in • How? • Using Eclipse IDE and GumTree Framework API
Contribution Rules • Everything is a contribution • Add, do not modify • Contribution code is only loaded when it is needed. • Lazy loading mechanism • Separate core functionality from UI functionality. • Keep non-API codes to internal packages • Do not risk your plug-in
Eclipse Plugin Architecture • Plug-in – set of contributions • Example: Instrument specific data reduction & analysis (DRA) module • Extension point - named entity for collecting contributions • Example: Data format support • Extension - a contribution • Example: customised data format reader
Eclipse Plugin Architecture • Plug-in details spelled out in the plug-in manifest • Manifest declares contributions • Code implements contributions and provides API • plugin.xml file in root of plug-in subdirectory
Tutorial Outline • Basic GumTree Concept • Say “Hello World” to GumTree • Data Handling • Experiment Modelling • Data Acquisition • Instrument Adaptation
Tutorial 1.1 • Learning Objectives • Writing plug-in and simple Eclipse UI extension for GumTree • First touch with the GumTree Visualisation API • Performance Indicators • A new plug-in with view to be displayed in the GumTree Workbench • Group view into a view category • Display “Hello World” in 1D Graph • Two buttons to control display on/off
Tutorial 1.2 • Learning Objectives • Grouping UI contribution to a single screen • Using existing GumTree UI component • Performance Indicators • A perspective with Hello World view and GumTree device navigator
Tutorial Outline • Basic GumTree Concept • Say “Hello World” to GumTree • Experiment Modelling • Data Acquisition • Data Handling • Instrument Adaptation
Experiment Framework • Experiments are modelled as objects • users can operate GumTree in their familiar scientific domain • Essential elements are modelled as experiment components • eg, user metadata, instrument operations • GumTree manages experiment lifecycle • Only one experiment to be activated at a time
Login Hardware Setup (Expert Only) Experiment Setup Batch Run (Automated Data Collection / Scheduled Scan) Scan (Single Run) Visualise / Process / Analyse Result Export Data Experiment Lifecycle Typical lifecycle
Modelling Gumnut Experiment • For this tutorial, we will create a simple experiment which is capable of: • Storing user metadata (name, address and email) • Performing a simple scan without driving any device • Collecting 2 monitor counts for each scan point • Importing and exporting experiment data with customised HDF5 reader and writer
Tutorial 2.1 • Learning Objectives • Using experiment extension point • Using dummy SICS extension point • Performance Indicators • Create a new experiment object • Create dummy SICS objects • Four different SICS variables • Two dummy SICS monitors • A dummy SICS scan object
Experiment Component Library • Each experiment object has a group of experiment components • Components are grouped in an experiment component library • Components are stored in a tree structure • Each component has an unique path, eg, /user/name, /sample/sampleInfo/NaCl, /acquisition/scan/centerScan • Experiment should provide the structure of the component library via a component library advisor • Advisor provides basic tree structure and hooks for further expansion
Tutorial 2.2 • Learning Objectives • Experiment component and component library • Tasting the adaptor design pattern • Using experiment component extension point • Basic device proxy concept (more on Data Acquisition section) • Performance Indicators • Setup a new component library • Create user metadata objects (experiment components) • Create a experiment browser UI adaptor for user metadata objects • Customise the appearance of component group • Create an instrument info object and hook to the component library
Adaptor Pattern • Experiment Browser wants User Metadata class to provide the functionalities which are specified in IBrowserUIPart • If User Metadata object cannot provide this, the Experiment Browser will use the adaptor factory to resolve this • Adaptor Factory returns an object that implements IBrowserUIPart. This object knows how to communicate with User Metadata • Advantages: • Customisable and reusable • All User Metadata share only a single instance of IBrowserUIPart AdaptorFactory (IAdapterFactory) Client: Experiment Browser UserMetadataBrowserPart (IBrowserUIPart) UserMetadata (IUserMetadata)
Tutorial Outline • Basic GumTree Concept • Say “Hello World” to GumTree • Experiment Modelling • Data Acquisition • Data Handling • Instrument Adaptation
Data Acquisition • Data acquisition (DAQ) in GumTree is a set of sequential (and possibly combinational) logic for controlling and sampling datafrom hardware. • DAQ module in GumTree stores data in the experiment data object for data export and further data analysis • DAQ module can be a scan, batch or any other possible method • GumTree controls hardware via device proxy • Control system adaptor in GumTree is responsible to provide the handle of device proxy
Working with Device Proxy • Device Proxy is a thin wrapper for objects in control system • SICS object: sics variable, monitor, virtual motor, etc • TANGO object: device proxy • EPICS object: process variable or artificial device object • Device proxy interface is consist regardless which control system GumTree connects to • Device Proxy supports • Execute commands synchronously / asynchronously • Read attributes synchronously / asynchronously • Write attributes synchronously / asynchronously • Generate events and deliver them to event listeners • Writing device proxy for GumTree will NOT be covered in this tutorial
Device Proxy API DeviceData data = monitor1.syncReadAttribute( ISicsGenericMonitor.Attribute.COUNT, DeviceSource.EXTERNAL); int value = ((Integer)data.getData()).intValue();
Scan Template • GumTree support generic scan routine via the scan template pattern • Scan template is an object for • Controlling control system to perform scan • Visualising live data during the scan process • Storing data to centralised data object during an experiment lifecycle • Current GumTree scan framework requires scan template to supply UI for scan control and visualisation
Scan Template in Gumnut SimpleExperiment GumnutScanTemplate (IScanTemplate) GumnutScanController (IScanControlUIPart) CountCollector Data (GTD) SICS Scan object SICS monitor1 SICS monitor2 = SICS object = Java class = GumTree Data Object GumnutScanVisualiser (IScanVisUIPart) 1D Plot
Data Visualisation • GumTree is capable of displaying 1D, 2D and 3D data with various rendering engine 1D 2D 3D
Tutorial 3.1 • Learning Objectives • Understanding scan template design pattern • Performance Indicators • Create a scan template for collecting 2 monitor counts at each scan point • Display live scan data
Tutorial Outline • Basic GumTree Concept • Say “Hello World” to GumTree • Experiment Modelling • Data Acquisition • Data Handling • Instrument Adaptation
GumTree Data Object • GumTree Data (GTD) Object is a data container for internal application data • GTD has hierarchy data structure • GTDItem (data set container) • GTDGroup (GTDItem container) • GTDAttribute (attrbitute for GTDItem and GTDGroup)
Data Exchange • GTD can be used for • Changing data format • Storing experiment data GumTree XML GTD NeXus GumTree Histogram Device GTD NeXus Device Data
Tutorial 4.1 • Learning Objectives • Using GTD Object • Write data to experiment data object • Performance Indicators • Make experiment object to handle data from scan
Data Format • A GTD object can be import from and export to different data format if adaptors exist. GumTree supports: • HDF, NeXus, CSV, XML, etc. • Data reader (importing) and data writer (exporting) can be customised to preserve the structure of GTD
Tutorial 4.2 • Learning Objectives • Using file format • Customise file format reader and writer • Performance Indicators • A new HDF5 reader and writer for the Gumnut experiment • Be able to export data from experiment
Tutorial Outline • Basic GumTree Concept • Say “Hello World” to GumTree • Experiment Modelling • Data Acquisition • Data Handling • Instrument Adaptation
Instrument Support • GumTree supports one (or zero) instrument at runtime • Each instrument in GumTree needs to map to a control system adaptor • Instrument feature plug-in defines plug-in set for an instrument
Product, Feature and Plug-in • Product • Basic unit of an application • Eclipse (RCP) support 0 or 1 product definition • Feature • Defining a group of plug-ins • Disabling a feature will disable all its declared plug-ins • Plug-in • Set of contributions wrapped in a single unit • Instrument Plug-in • A plug-in with a single instrument extension declared • Instrument Feature • Feature which contains an instrument plug-in • Feature should have id identical to its instrument id
Final Goal • Toward the end of this tutorial: • Create a GUI for out imaginary instrument, Gumnut • Pass all our contributions to Gumnut • Run GumTree with Gumnut, not Gumzilla • We do not want any contribution from Gumzilla!
Product, Feature and Plug-in #Instrument Plug-in: 1 Plug-in … Plug-in … Plug-in …
Product, Feature and Plug-in #Instrument Plug-in: 2 -> Bad Plug-in … Plug-in … Plug-in …