Plotting Support Requirements for SEAL

Authors:
Greg White, Stanford Linear Accelerator Center
Chris Larrieu, Plotting Support Inc.
$Id: seal_plotting.html,v 1.3 2007/06/13 03:00:21 greg Exp $:
http://www.slac.stanford.edu/grp/lcls/controls/docs/requirements/seal_plotting.html

Abstract

This document describes a required feature of the SLAC Eclipse Applications Lab (SEAL). The purpose of this feature is to help interactive applications make graphs of data. That is, it will be used to make such plots as scatter-plots (1d), surface plots (2d), histograms, feather plots, parametric plots, stair-step plots etc. It's emphasis is not in drawing graphical widgets as might be done by a "graphics package", but rather in data analysis.

Status of this Document

This section describes the status of this document at the time of its publication.

This draft has been reviewed and edited by Chris Larrieu, the implementer. It is not expected that this requirements document will be formally reviewed by the group, though comments are welcome.


Terms of Reference

It is required that a very broad range of data plot styles is supported, including 1-d point and line, including fitted functions and error bars, 2-d (3-d surface plots), histograms, contour plots etc (see Functionality below). Therefore, it seems reasonable to expect that this facility will be built on top of an existing established scientific plotting system such as Matlab or Gnuplot.

Ideally the plotting mechanism to be used would be the one presently used for scripted applications - Matlab. However, matlab is expensive. Therefore, part of this project is to evaluate the cost and benefit of using Matlab, for instance using the Matlab Java compiler, which makes matlab commands available from Java programs. The matlab java compiler is described in [MATJAVA].

A relatively cheap Matlab solution would be preferable to a free GNUPlot one, in order to keep consistency with Matlab apps. This will increase user confidence and allow concentration of expertise.

Global and Non-Functional Requirements

Speed. It should be possible to generate and display a scatter plot (no fitting) of 1000 pts in 0.25s. This may require that a plot object has already been created with no data, and then populated with the data. Certainly the re-display of some plot with new data (for instance when cycling through the list of acquired device value arrays when you want to look at all 100 of them against the same time range, should be very quick, ~.25s. Some more time may be given for a new unique plot.

A single plotting package should be used to fulfill this functionality requirement, not a collection of 3rd party utilities.

Required Functionality

Plot Types
Plot types should include, though not confined to the following. These examples are taken from GNUplot, but Matlab or other implementation may be used.
  1. scatter plots, and 1-d line plots (ie x-y graphs)
  2. filled curves. This is an "area" plot in Matlab
  3. 3-d line plots
  4. plotyy - y axes on both sides of the plot
  5. histograms and bar charts
  6. 2-d surface plots
  7. contour plots
Plot Annotation
The following annotations must be possible
  1. Must be able to label x,y,z axes and add title to plots
  2. Date/Time axes must be labeled with textual date/time formatted tic marks
  3. Print arbitrary text over plot. This will be used for fit parameters etc
Plot manipulation
A user must be able to zoom at least 1-d plots; and rotate 2-d plots
Fitting
It must be very easy to plot the fit of the plotted data points very easily. This may may be most easily achieved by overlaying a line of the results of a fit function Eg http://web.cecs.pdx.edu/~gerry/MATLAB/plotting/ - which then requires that the same plot can contain two sets of plotted data, one plotted discretely (the data), the second as a line (the fitted function). However, note the requirement for error bars below.
Error bars
It must be possible to plot fitted data with error bars
API
The API to the plotting system must be available from Java. It is not necessary for all functions and options of the plotting system to be available as individual API calls; that is, it is acceptable for the API accept the text of a script, or a named script file, with arguments, for plotting.

Scope and Goals

It is not necessary, though would be marginally preferred, for the plotting window to be manageable as an Eclipse View (and thereby "inside" the application window and dockable/undockable. Creating an external window for each plot is fine.

However, if an external window is used, it should manage window proliferation. That is, previously used windows should be deleted automatically in some stack, say 3 deep (the 4th most previously generated window deleted).

Out of Scope

Drawing graphical shapes or widgets such as dials, or constructing graphical pictures, is not in scope.

Drag and drop data is not in scope. There is no need to support selection of a graph object and dropping it into a spreadsheet or other application.

Success Criteria

The programmer of an application in the SEAL system must be able to find the programmers guide and javadoc for scientific plotting, and use the API within the context of a SEAL application development. Any user of that application (within SEAL) must get a plot. If the application requires a 3rd party package to be installed on a users desktop, it must be very clear in the SEAL documentation where to get that package and how to install it.

Deliverables and Duration

Matlab cost/benefit evaluation
An evaluation of the cost of providing all scientific plotting using Matlab, for all running instances of SEAL. It can probably be assumed that the lowest cost mechanism for this is to use the matlab java compiler [matjava], though some time might be spent verifying that there is not a matlab server system to which small jobs such as plotting can be submitted efficiently.
Time estimate: 2 - 8 days, depending on the amount of custom coding needed to experiment and conduct the evaluation
Prototype or proof of principle
Create a proof of principle plot using at least one plotting system (Matlab, GNUPlot or another). Matlab may offer more than one solution type, for instance one might be to use the matlab java compiler and another would be to wrap matlab plotting methods in matlab scripts which are then compiled with the matlab C compiler and accessed via JNI. It is not necessary to investigate all of these if there is a clearly simple and effective solution.
Time estimate: 1-10 days, depending on extent and success of preceeding evalutaion
Write very short design proposal
Write a one or two page design proposal. This can be as simple as the assertion that we should use the matlab java compiler and an outline of the steps a programmer would take when using it in the context of developing a physics application in SEAL.
Time estimate: 1-2 days
Create and release implementation API
Create a java API for the plotting package. If the matlab java compiler avenue is chosen, this deliverable consists only of installing the matlab java compiler in such a way that it is easily invoked in the SEAL development system.
Time estimate: 3-15 days
Create the appropriate SEAL integration, such as plugin and maybe feature.
Time estimate: 1 day
Write and publish a programmers guide and javadoc
  1. Write programmers guide as web or wiki documentation
  2. Publish javadoc.
Time estimate: 1-2 days

Total time: 9-42 days, assuming 8 hour days minus 2 hours overhead. The range is broad owing to significant uncertainty about which technologies will prove most apt. For example, it may take some extensive evalutation to discover that MATLAB is not a viable solution. Having spent time on that, we'll be back at phase 1 with Octave or Gnuplot, or whatever other tools might also prove viable. We should revise the time estimate as we progress, more accurately to reflect lessons learned.

Coordination of Activities

Deliver the matlab cost/benefit analysis to Greg, Ron and Hamid.

Deliver design proposal to the software group.

References

matjava
http://www.mathworks.com/products/javabuilder/