1 What’s Under the Hood? Michael McLennan HUBzero® Platform for Scientific Collaboration Purdue University This work licensed under Creative Commons See license online: by-nc-sa/3.0
2 Example: Fermi function tool number curve How does it work?
3 Tool Definition File Builder tool.xml Press Simulate to … … Press Simulate to … … Info about the tool, how to run it Input objects Output objects skeleton program
4 Running produces a driver file Builder Runner tool.xml driver1827.xml
5 Running produces a driver file tool.xml driver1827.xml … K 0K 500K 300K eV 0eV … … K 0K 500K 300K eV 0eV … … K 0K 500K 300K 77K eV 0eV 200meV … … K 0K 500K 300K 77K eV 0eV 200meV …
6 run xml Your Program Running your program Builder Runner tool.xml driver1827.xml
7 Program produces a run file driver1827.xml run xml … … 77K … 200meV … … … 77K … 200meV … … … 77K … 200meV … … … … 77K … 200meV … …
8 Tool Definition File Runner tool.xml ~/data/results/$SESSION Results are moved out of the current working directory to the “results” directory run xml Your Program driver1827.xml
9 All Together Builder Runner tool.xml driver1827.xml run xml Your Program
10 Run file is a complete record of the run run xml Tool DefnInput ValsOutput Vals tool.xml driver.xml run.xml reload old results rerun an old tool
11 How does your program get invoked? Runner tool.xml run xml Your Program driver1827.xml Rappture Your Code Rappture Library
12 How your program gets invoked Rappture import Rappture import sys from math import * io = Rappture.library(sys.argv[1]) Tstr = io.get('input.number(temperature).current') Efstr = io.get('input.number(Ef).current') … io.put('output.curve(f12).component.xy', xydata) Rappture.result(io) sys.exit() tool.xml Press Simulate to view … Press Simulate to view … python /apps/yourtool/current/fermi.py driver327.xml
13 Object names in tool.xml and in your program tool.xml … 300K … … … 300K … … Rappture Your Program … Tstr = io.get('input.number(temperature).current') Efstr = io.get('input.number(Ef).current') io.put('output.curve(f12).component.xy', xydata) … Tstr = io.get('input.number(temperature).current') Efstr = io.get('input.number(Ef).current') io.put('output.curve(f12).component.xy', xydata) … input.number(temperature).current output.curve(f12).component.xy
14 Exercise #2: Spriograph tool Spirograph equation: z(t) = e i2 n 1 t + e i2 n 2 t + e i2 n 3 t Where t has 1,000 points along [0,1] Plot: real(z) x imag(z) y See theory at t = linspace(0, 1, 1000); z = exp(i*2*pi*n1*t) + exp(i*2*pi*n2*t) + exp(i*2*pi*n3*t); plot(real(z),imag(z)); In MATLAB/Octave:
15 Exercise #2: Build a simple Addition tool Spirograph equation n1 number z curve n2 number n3 number t = linspace(0, 1, 1000); z = exp(i*2*pi*n1*t) + exp(i*2*pi*n2*t) + exp(i*2*pi*n3*t); plot(real(z),imag(z)); In MATLAB/Octave: