# Presentation: 327123

## Enhancements to ElVis Scientific Graphics Software 

- Tarun Pondicherry
- Ben Phillips
- PPPL Science Education Summer Interns
- Eliot Feibush – Mentor
- August 14, 2007

## ElVis Overview

- Java based visualization software, graphs outputs of experiments, analysis, & simulation programs.
- Accepts input from
- 	Data Files
-     Sockets - API
- 	GUI
- Presentation Styles Animated, Surface, Contour, +
- Reads data & displays graphs over Internet.

## Monitor & Display Results

_**DOE SciDac Fusion Simulations**__ - _*under development*
- 	CPES
- 	SWIM
- 	FACETS
_**Web Services**_
- 	Reflectometer Simulation (ElFresco) – *w3.pppl.gov/fwr*
- 	TRANSP – RPLOT – *beta test / alpha users*
- 	GTC – *available*
*	*Shaped GTC – *under development*
- 	Nova-K – *under development*
**MSE**
**TSC**
**SCOPE**

## Summer ‘07

- Improvements to visualizing 2-D data sets.
- Interactive log plotting.
- User requests from applications.

## Tarun Pondicherry – my work

- Develop New Presentation Styles
- 	*f*(x,i) with color gradients
- 	*f*(x,y) Continuous color plots (color map)
- 	*f*(x,y,t) Indexed color plots
- Implement User Application Requests
- 	Aspect Ratio Resize
- 	ElVis File Convention Additions
- 	Animation Controls

## Gradient Datasets

- Shows multiple time steps in order in a single view.
- Creates a linear gradient from first to last index.
- Useful to see how data changes over time.

**Animated Presentation Style**

**New Gradient *****f*****(x,i)**

## Continuous Color Plot

- Displays a color profile of 2D data.
- Similar to contour, but shows all data points.

**Existing Contour Plot**

**New Color Map Plot**

## Data Exploration

- Displays value as user moves the cursor.

## Other Interactions

- Inherits ElVis interactions (zoom, pan, whiteboard, labels) for exploring and annotating data.

## Log Scalable

- X, Y, and color axes independently scale logarithmically or linearly.

## New Color Scale Chooser

- Allows users to specify color ranges.
- Add, delete or change a color point.
- Useful to draw attention to particular values.
- Color scale saved in ElVis convention.

- Useful for simulations & analysis programs to color-code plasma cross sections.

## Indexed Color Map

- Plots *f*(x,y,t)
- During animation, moves through time dimension
- Creates images during animation
- Can be made from NetCDF Panel
- Supports Templates
- Supports NetCDF File Monitoring

- psiRZ for NSTX shot 121137.  Data from Rob Andre.
_**Click on image to play movie.**_

## Animated  Images

- Saves steps in animated plots as a series of images.
- Can copy and paste all images into PowerPoint at once in order.
- Can easily be made into a wmv file using Windows Movie Maker.

- psiRZ over time .01 – .54 seconds

## Aspect Ratio Resize

- Initial aspect ratio limited to 4:3 paper size graphs.
- Java AffineTransform used for resize --> Distortion
- Users requested gaining resolution and maintaining line width and aspect ratio.
- Now recalculates placement and increases resolution.
- Text aspect ratio also preserved.  No distortion.

**Before:**

**After:**

## ElVis Convention Additions

- ElVis convention allows users to save and open plots with presentation attributes (color, size, labels, etc.)
- Added functionality to save Contour, Surface, Color Plot, 2D Presentation Styles

## Animation Controls

- Previously ElVis ran animations at the rate they loaded.
- 		_My __**Additional Controls**_
- Runs at user defined frame rate.
- Dynamically sets frame rate based on server speed.
- Allows users to drop frames to maintain time base.
- CPES Sim. Vis.
- GTC Web Service

## Animation Measurements

- Image Download Times for PC cppg-win2:
- PPPL ~ 30ms
- Rutgers ~ 50ms
- Oak Ridge ~ 80ms
- Download rate for images stored as URLs
- on web servers.

## Ben Phillips – my work

- Logarithmic plotting – graphical interaction.
- Improved surface plots of 2-D data sets.
- Application-driven features.

## Challenges of Log Plotting Providing an interactive model

_**ElVis Requirements**_
- Allow user to fine tune the viewing region
- Resize the graph window.
- Adjust the scales on the axes.
- Prevent user from “getting lost.”
- Enable the user to get a digital read out of specific values in a plot.
- Cleanly handle plots with values <= 0
- Cannot take log  of  0 or less.

## Improvements to Log Plotting

- New features I implemented
- Extended interactions of linear plots to logarithmic plots
- Tick marks
- Zooming
- Cursor
- Created methods to handle the limitations of log plotting

## Major and Minor Tick Marks

- Major tick marks specify decades
- 	(10x, 10x+1, 10x+2, ...)
- Minor tick marks specify points within a decade
- 	(2*10x, 3*10x, 4*10x, ..., 9*10x)
- 	Algorithm translated from rplot sglib
- 		Considers resolution to avoid crowding

## Zooming – Allows users to examine areas of a log plot

- Click and drag region to zoom in.

- ElVis zooms in on the region and adjusts the axes appropriately.

## Zooming – Graph must be at least one decade wide and tall

- I enforced minimum zooming region shown by red rectangle.
- This is the actual region that ElVis will display if the user lets go of the mouse.

## Zooming – Axes limitations

- Users cannot zoom into a region that is less wide or less tall than a decade.
- Floating point precision bounds axes to the interval [10-44, 1038]

## Cursor – Digital Read Out

- Displays data values for each curve.

## Challenges of Surface Plotting  

- No 3-D graphics hardware acceleration.
- No third party libraries such as Java3D.
- Heavyweight 3D components do not mix with Lightweight Swing components that support overlapping windows.
- ElVis must use 100% pure Java implementation in software.
- Portable but slower than graphics hardware.
- Must run in a browser.
- ElVis cannot take advantage of the built-in memory and processing power present on many graphics cards.

## My Surface Plot Improvements

- Logarithmic scales for axes
- Display Optimizations -
- 	Surface plots now display faster.
- 	Wireframe display during zoom, rotate, or resize.
- 	User can customize how much data is displayed dynamically.
- Memory Management

## Log surfaces – Usefulness of log plots brought to three dimensions

- All three axes can be set independently to linear or logarithmic scales.

## Wireframe Display OptimizationFaster to rotate, resize, & zoom

- Makes rotating, resizing, and zooming smoother on surface plots.

## Data Reduction Slider  Even faster to rotate, resize, and zoom

- 	Users can control how much data to display while 	manipulating the surface.			Demo

## Surface graphs can take up a lot of memory!

- Problem is especially acute in Applets where memory is very limited.
- OutOfMemoryErrors crash ElVis
- Unacceptable

## Challenges of Handling Limited Memory

- Java’s garbage collector cannot be run on command.
- Java has a lot of behind-the-scenes implementation details dealing with runtime reflection that make estimating the size of classes difficult.
- OutOfMemoryErrors cannot be caught programmatically.

## Consquences of Java’s Memory Handling Limitations

- ElVis must make an educated guess at the memory requirement for a Surface plot.
- In practice it appears to be accurate to within 10% most of the time (20% off is the worst observed)
- Java memory handling features can still be broken in certain cases.

## Surface plots are partially displayed when memory is low.

- Surface plots are only displayed with some of their polygons in low memory situations.
- If available memory becomes extremely low then ElVis does not allow any more Surface plots to be opened.

## Java Memory Allocation

- Click on Run the ElVis Applet:      w3.pppl.gov/elvis
- 	Browser applet limited to 64 MB.
- Run as application outside of brower = 200 MB
- 	click on Run ElVis
- Type in a command line:
- java -Xms200000000 -Xmx900000000 elviscdf.jar
- 	= 900 MB

## Adding more memory to Applets (On Windows + Java 1.5 or 1.6)

- Start -> Control Panel -> Java Plug-in -> Java Tab -> View Java Applet Runtime Settings
- Add a Java Runtime Parameter
- –Xmx[heapsize]m
- Example:   -Xmx500m makes heap size 500 megabytes for Applets
- Java 1.5 can increase to 1⁄4 system memory.

## Points Editor Edit numerical values

- Fix spurious data.
- Created for fixing input profiles for the Nova-K web service.

## Layout Manager Adjust the number of rows and columns

- Allows for easy manipulation of a large number of graphs.
- Collect & retain all graphs from an rplot session for comparisons.

## Acknowledgements

- Thanks to
- Eliot Feibush  - Mentor, Slidesmith
- PPPL Science Education Program:
- 	   Christine Ritter, Andrew Zwicker & James Morgan
- Princeton Plasma Physics Lab

## Summary

- Improvements to ElVis foundation classes benefit display programs & web services that include ElVis.
- I want to thank Ben & Tarun for all the excellent work they have accomplished this summer.