Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Julia and Python in Astronomy: Better Together

Julia and Python in Astronomy: Better Together

Talk at "Python in Astronomy" workshop

Avatar for Kyle Barbary

Kyle Barbary

March 22, 2016

Other Decks in Science

Transcript

  1. • Some things are impossible to “vectorize,” or just very

    awkward. • Possible to drop down to C but not easy • As library writers, having to write “array- oriented” APIs can be constraining. But...
  2. The “two language” problem High-level dynamic language for rapid development

    (e.g., Python, R, Matlab, ...) Compiled language for performance-sensitive code (e.g., C, C++, Fortran) Interface code
  3. • Call C and Fortran directly with zero overhead, no

    wrappers • Zero-overhead quantities are possible: • Automatic differentiation is possible: A few more enticements:
  4. Example: SkyCoords 10 0 10 1 10 2 10 3

    10 4 10 5 10 6 jl_galactic jl_fk5j2000 jl_fk5j1975 py_galactic py_fk5j2000 py_fk5j1975 10 -8 10 -6 10 -4 10 -2 10 0
  5. Rewriting all that Python? Typing is not the hard part.

    The hard part is figuring out what the code is supposed to do.
  6. “SciPy… really was a distribution masquerading as a library. “...

    I made a mistake with SciPy because there was not good packaging in Python at the time.” Takeaways from Julia: Modules – Travis Oliphant
  7. GitHub: @kbarbary Twitter: @kylebarbary Try it: juliabox.org More talking: julialang.org/learning

    Steven Johnson’s keynote at EuroSciPy 2014: “Crossing Language Barriers with Julia, SciPy, and IPython” • What's bad about Julia? • How can Python benefit from Julia? • Is anyone actually using Julia for astronomy? Sample Questions: