Xmds And Pyscript Talk06

1,046 views

Published on

Talk given at the Albert Einstein Institute in Hannover, Germany. Introduces the scientific software packages xmds and PyScript. Includes a diversion discussing the difference between kiwis and kiwifruit.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,046
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Xmds And Pyscript Talk06

  1. 1. Software spanners for scientists Paul Cochrane Max-Planck-Institut f¨r Gravitationsphysik u (Albert-Einstein-Institut) Callinstraße 38 Created with PyScript. http://pyscript.sourceforge.net Hannover PyScript Software spanners for scientists - Paul Cochrane
  2. 2. Kiwifruit Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  3. 3. This is a kiwi Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  4. 4. Definitely different Created with PyScript. http://pyscript.sourceforge.net • small • small • brown • brown • furry • furry • endangered • at supermarket • moves • doesn’t Software spanners for scientists - Paul Cochrane
  5. 5. Software spanners for scientists - Paul Cochrane Created with PyScript. http://pyscript.sourceforge.net
  6. 6. The world Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  7. 7. NZ and DE compared ∼1000km Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  8. 8. Where the hell is Reporoa? Created with PyScript. http://pyscript.sourceforge.net Rotorua Reporoa Taupo Software spanners for scientists - Paul Cochrane
  9. 9. Spanners Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  10. 10. A standard toolbox Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  11. 11. Software Spanners 00001111000011110000100111111001100000110101010100110010011000011000000000110 01110101100011011010011101010000101100000011111001011011010010000011010111101 00110001011101000010011010110011011100110001011010001100101101101110001101100 00101111011101011010010110110111100011111001110001011010110000001000000010001 01001011001101000111111010101001101001100101001111000011101011001101110110111 10001011111111000111110000100101101011111111010011010100110110101110110010001 10101111100001000111010001110010010101001010101101110100100101101100011100110 00111000011100110000101110000010101101001110100001010011101000100111010011111 01101001110000001100101011000110100010010010000101111101000100010110000100000 11110100001011010110011101000011010011110010011100100111110001101010011101001 01111110111000000011111100100100100010101101011000100010101010110011110111000 00001001101111011110001010100100111011110010101001011000001001000011110011101 00101100110110010001110101111011011101100111000010010101000001011010001100101 00011001001011001101101100110001001001001001100100101101110011010010110100010 00110110101100001101001010110101100101111101111101001101111110001111001001011 11111000110101111000001011010000100100011110111001001110000011000111011101011 Created with PyScript. http://pyscript.sourceforge.net 00110100001010011010110011101001011111001011101100110110111010100100110000100 00110111000100101101011010100010100111111110000111011110010100111011011001001 01111001100000000001100010101001111111011010010011001010100000011000000011110 01001100100001100010011010011010010101100111001010100000010010011011110010111 11100001000110011011110000101001001000101100111110010010000101110001111110010 00111000100101100101000000000001111000101001101101111001100110101111110100001 01010011111011011111011110011011000101001011111110100001011110111010101101100 01100111001010100101111111100111101111010011001010000001001101111111000110010 10011011001001111011100010101101011110011100000000000000011001000010110110101 00010111110101011010000101100100100000001110111000011111101110000000001000001 01010011001001101001000001111011001111000001101001000001100110101100010111000 01101111001111011000100001100001011011010100010010011011100001110001101110000 10111111000000110000110000111110001111110111010100010110111100001010101000111 00010010000110010101000010010110010101101100000011101110000100110100011010101 10011101100011001101110101111101001111101000000111011111110011101000001000010 11000011011011110001111110010111001010001110111101010111101100010111111101010 01000101101011011001001000110110101111110001101010001010010000110110111000110 01110001111101000001001001011101101010110100100010011010110101110111100001011 11000001110101101101111110110101101011010110101101110000110001100100111101011 00011011100011111100010011110010111011010011100100100101000111001100000010101 01100100100110110100010001001110111101101001100000000100100011110111110101010 11111011110110101111011110111101010110111110000001100111000001100110111111110 00100101000101111010011100110111010111000000111010110111000100001100000010100 00111010001000110111011101001001111001111100011011111011000111000010010001011 Software spanners for scientists - Paul Cochrane
  12. 12. A software toolbox PyScript Created with PyScript. http://pyscript.sourceforge.net G.R.O.B. nlcs Software spanners for scientists - Paul Cochrane
  13. 13. Three tool categories Those to . . . 1) do the work and get results C, Fortran, Matlab, Python, Finesse, nlcs, G.R.O.B., . . . 2) interpret and visualise the data Matlab, Scilab, Gnuplot, PyVisi, vtk, OpenDX, plplot, Povray. . . Created with PyScript. http://pyscript.sourceforge.net 3) present the results and interpretation LTEX, PowerPoint, . . . A TM A broad toolset is a Good Thing Software spanners for scientists - Paul Cochrane
  14. 14. Three tool categories Those to . . . 1) do the work and get results C, Fortran, Matlab, Python, Finesse, nlcs, G.R.O.B., . . . 2) interpret and visualise the data Matlab, Scilab, Gnuplot, PyVisi, vtk, OpenDX, plplot, Povray. . . Created with PyScript. http://pyscript.sourceforge.net 3) present the results and interpretation LTEX, PowerPoint, . . . A TM A broad toolset is a Good Thing Here are two more: PyScript Software spanners for scientists - Paul Cochrane
  15. 15. Just a reminder... Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane Kiwifruit
  16. 16. Software spanners for scientists - Paul Cochrane Created with PyScript. http://pyscript.sourceforge.net
  17. 17. What is xmds? eXtensible Multi-Dimensional Simulator any number of components any number of dimensions any number of random variables A system for integrating differential equations: Created with PyScript. http://pyscript.sourceforge.net one writes a high-level description of simulation in XML xmds converts the XML into C language code the C code is compiled into a binary executable, which runs about as fast as code hand-written by an expert xmds provides a way of both performing and documenting a simulation Software spanners for scientists - Paul Cochrane
  18. 18. xmds: who uses it? Anyone who models systems via differential equations This includes: physicists geophysicists and earth scientists chemists Created with PyScript. http://pyscript.sourceforge.net biologists weather forecasters economists risk analysts ... Software spanners for scientists - Paul Cochrane
  19. 19. Why use xmds? fast development time and fast execution time reduces user-introduced bugs solves ODEs, PDEs, and stochastic ODEs and PDEs automatic parallelisation of stochastic and deterministic problems allows simple and transparent comparison of simulations with other Created with PyScript. http://pyscript.sourceforge.net researchers simulation script (and therefore parameters) are output with the simulation data, so the data and the variables that generated it are kept together for future reference open source and documentation, see http://www.xmds.org/ Software spanners for scientists - Paul Cochrane
  20. 20. xmds details xmds is designed to integrate PDEs of the general form: ∂ 0 a(x) = N (x, a(x), p(x), b(x), ξ(x)) , ∂x pi (x) = F −1 Σj Lij x0 , k⊥ F aj (x) , ∂ c b(x) = H (x, a(x), b(x)) Created with PyScript. http://pyscript.sourceforge.net ∂x x : spatial dimension a(x) : main field b(x) : cross-propagating field p(x) : field defined in Fourier space ξ(x) : noise terms Software spanners for scientists - Paul Cochrane
  21. 21. xmds processes Begin Simulation Initialise segments 1..n Process segment i Input script Sample segment i XML parser Post-process xmds kernel N Created with PyScript. http://pyscript.sourceforge.net Finished? i++ C/C++ code Y Compute means & std dev Compile Run simulation Y Do 1 step? 2 Output N Compute step error Write output Software spanners for scientists - Paul Cochrane End Simulation
  22. 22. xmds examples Nonlinear Schr¨dinger Equation o ∂φ 1 ∂2φ =i + |φ|2 φ + iΓ(t)φ ∂z 2 ∂t2 where φ is the field, z is the spatial dimension, t is time and Γ(t) is a damping term. Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  23. 23. xmds demonstration Nonlinear Schr¨dinger Equation o You’ve seen the equation, you’ve seen the results, now see xmds in action Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  24. 24. xmds examples (cont.) Fibre Optic Laser Field ∂φ ∂2φ β = −i 2 − γφ + √ [ξ1 (x, t) + iξ2 (x, t)] ∂t ∂x 2 this is a stochastic simulation Created with PyScript. http://pyscript.sourceforge.net single path 1024 path mean Software spanners for scientists - Paul Cochrane
  25. 25. Bestiary of xmds features Automatic numerical error checking Automatic parallelisation of stochastic and deterministic problems Handles cross-propagating fields Calculates trajectory means and variances of stochastic simulations Three main algorithms: Created with PyScript. http://pyscript.sourceforge.net Fourth order Runge-Kutta Semi-Implicit Method Adaptive fourth order Runge-Kutta Two algorithm pictures: Explicit picture—all linear and nonlinear operators calculated Interaction picture—linear and nonlinear terms treated separately ASCII and binary output Software spanners for scientists - Paul Cochrane
  26. 26. xmds features continued. . . Benchmarking of simulations xmds script template output Field initialisation from file Command line arguments to simulations handy for parameter space searches Created with PyScript. http://pyscript.sourceforge.net Can now use OpenMP for parallel simulations threads the FFTs and the simulation Fourth order adaptive Runge-Kutta FFTW versions 2 and 3 Adaptive scheduling of stochastic problems Breakpoints: can stop and restart simulations User-defined preferences (for custom compiler flags etc.) Software spanners for scientists - Paul Cochrane
  27. 27. Another reminder... Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane This is a Kiwi
  28. 28. PyScript Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  29. 29. What is PyScript? Generate Postscript figures/diagrams/documents using the Python programming language Instead of using a mouse to draw objects, write code to draw objects Have full use of the Python language and modules Created with PyScript. http://pyscript.sourceforge.net Produces small file-size, high-quality Postscript output Uses LTEX to produce high quality fonts A Free software, released under the GPL http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  30. 30. Uses and features of PyScript PyScript uses: figures and diagrams in journal articles posters and seminars for conferences amaze your colleauges with the size of your Postscript files PyScript features: Created with PyScript. http://pyscript.sourceforge.net scaling, rotating, translating, any affine transformation embed EPS graphics embed LTEX graphics and symbols A properly kerned text objects scriptable and accurate control of object location expanding suite of libraries for common objects and tasks Software spanners for scientists - Paul Cochrane
  31. 31. PyScript examples |ψ 0 0 |ψ t/h t/h ¯ ¯ e −iH H −i e = = from pyscript import * |ψ t t |ψ tex=TeX(r’$|psi_trangle=e^{-iHt/hbar}|psi_0rangle$’,w=P(.5,0)) Created with PyScript. http://pyscript.sourceforge.net |ψt = e−iHt/¯ |ψ0 h g=Group() h |ψt = e−iHt/¯ |ψ0 for ii in range(0,360,60): g.append(tex.copy().rotate(ii,P(0,0))) |ψ |ψ t t render(g,file=...) = = e −iH e −i H t/h t/h ¯ ¯ |ψ |ψ 0 0 Software spanners for scientists - Paul Cochrane
  32. 32. PyScript examples (cont.) from pyscript import * p0=P(2,1) p1=P(4,2) c1=R(4,2) c2=R(-4,-2)/2. Created with PyScript. http://pyscript.sourceforge.net p2=P(4,4) p3=P(6,5) path=Path(p0,p1,C(c1,c2),p2,p3,fg=Color(’red’),linewidth=.8) g=Group() delta=1/20. for p in range(21): g.append(Dot(path.P(p*delta))) render(path,g,file=...) Software spanners for scientists - Paul Cochrane
  33. 33. PyScript examples (cont.) offline=Rectangle(height=4,width=5.5,e=P(3.5,1.5), dash=’[3 ] 0’,bg=Color(.85)) render( offline, TeX(’offline’,nw=offline.nw+P(.1,-.1)), Path(P(5,0),P(-.3,0),P(-.6,.5),P(-.3,1),P(2,1)), Path(P(2,2),P(-.3,2),P(-.6,2.5),P(-.3,3),P(3.7,3)), É Path(P(-1,4),P(3.7,4)), Dot(P(-.6,.5)), Dot(P(-.6,2.5)), Ó¯ Ò classicalpath(Path(P(2.1,1.5),P(4.5,1.5),P(4.5,0)), ¼¼   ¡ Created with PyScript. http://pyscript.sourceforge.net Path(P(3,1.5),P(3,0)), ¾«¾ Path(P(3.8,3.5),P(4.5,3.5),P(4.5,1.5)), ), BellDet(P(2,1.5)), BellDet(P(3.7,3.5)), Boxed(TeX(r’$Dleft(frac{itheta}{2alpha^2}right)$’), c=P(1,2),bg=green), ¼¼ Boxed(TeX(’$X$’),c=P(3,0),bg=green), Boxed(TeX(’$Z$’),c=P(4.5,0),bg=green), TeX(r’$ket{B_{00}}$’,e=P(-.7,.5)), TeX(r’$ket{B_{00}}$’,e=P(-.7,2.5)), TeX(r’$ket{Q}$’,e=P(-1.1,4)), file=..., ) Software spanners for scientists - Paul Cochrane
  34. 34. PyScript in the AEI |d |a Coupling δ{ g Couplin Created with PyScript. http://pyscript.sourceforge.net Pr γ ob e |b |c Courtesy of Luca Spani Molella Software spanners for scientists - Paul Cochrane
  35. 35. PyScript logo PyScript Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane
  36. 36. Summary You now know . . . where New Zealand is where Reporoa is what a Kiwi is what a Kiwifruit is Created with PyScript. http://pyscript.sourceforge.net that xmds will makes simulations easy and fast that PyScript will make your results look good Software spanners for scientists - Paul Cochrane
  37. 37. Created with PyScript. http://pyscript.sourceforge.net Thanks! :-) Software spanners for scientists - Paul Cochrane
  38. 38. Acknowledgements xmds (http://www.xmds.org) Greg Collecutt, Peter Drummond, Joe Hope PyScript (http://pyscript.sourceforge.net) Alexei Gilchrist Created with PyScript. http://pyscript.sourceforge.net Software spanners for scientists - Paul Cochrane

×