[CentralOH] 2012-12-03 Scribbles
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Sun Feb 17 19:16:16 CET 2013
Brandon Rhodes presented about astronomy using IPython Notebook.
He had some really good examples of numpy's pythonic coolness,
such as using numpy arrays in simple expressions that yield yet
other numpy arrays.
http://rhodesmill.org/brandon/
https://twitter.com/brandon_rhodes
https://github.com/brandon-rhodes/
https://bitbucket.org/brandon
http://lanyrd.com/profile/brandon_rhodes/
John Hunter, matplotlib guy, died http://numfocus.org/johnhunter/
matplotlib.org
Fernando Pérez, IPython guy, talked at PyCon CA about it (see below)
November 9 – 13, 2012 • Toronto
Pycon 2014 and 2015 in downtown Montreal
https://picasaweb.google.com/lh/photo/d_OoWf7EH_SSLwHPp7fRf9MTjNZETYmyPJy0liipFm0
https://picasaweb.google.com/lh/photo/xB96qo8pA_fYq2RbD1zxadMTjNZETYmyPJy0liipFm0
PyLab vision of numpy + scipy + matplotlib + ipython www.scipy.org/PyLab
Which things belong in which package? messy
numpy.scipy.org
arrays of number stored efficiently for fast processing
IPython Notebook (i = interactive)
knows to ignore leading ">>> " on python commands (copied from elsewhere)
rather new, about two years old
radarmatic.com animated rain RADAR
adjust URLs for other locations
http://radar.weather.gov/Conus/Loop/NatLoop.gif
http://radar.weather.gov/Conus/Loop/centgrtlakes_loop.gif
http://radblast.wunderground.com/cgi-bin/radar/WUNIDS?station=ILN&brand=wui&num=6&delay=15&type=N0R&frame=0&scale=1&noclutter=0&t=1085706505&lat=40.10094070&lon=-83.01473999&label=Columbus,+OH&showstorms=0
http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=ILN&brand=wui&num=6&delay=15&type=N0R&frame=0&scale=1.000&noclutter=0&t=1294241235&lat=40.00462723&lon=-83.021102&label=you&showstorms=0&map.x=400&map.y=240¢erx=400¢ery=240&transx=0&transy=0&showlabels=1&severe=0&rainsnow=0&lightning=0&smooth=0
http://radblast-mi.wunderground.com/cgi-bin/radar/WUNIDS_map?station=CMH&brand=wui&num=6&delay=15&type=TR0&frame=0&scale=1.000&noclutter=0&t=1283201928&lat=0&lon=0&label=you&showstorms=0&map.x=400&map.y=240¢erx=400¢ery=240&transx=0&transy=0&showlabels=1&severe=0&rainsnow=0&lightning=0&smooth=0
http://forecast.weather.gov/MapClick.php?w0=t&w1=td&w3=sfcwind&w3u=1&w4=sky&w5=pop&w6=rh&w8=rain&w9=snow&w10=fzg&w11=sleet&AheadHour=0&Submit=Submit&FcstType=graphical&textField1=39.98890&textField2=-82.98740&site=all&unit=0&dd=0&bw=0&menu=1
http://forecast.weather.gov/MapClick.php?CityName=Columbus&state=OH&site=ILN&lat=39.9889&lon=-82.9874
def f(x):
return 3 * x * x - 1
# x * x is the fastest way to square a number in python?
import numpy as np # this is the standard way of importing numpy
# It avoids naming conflicts that 'from numpy import *' would cause,
# and reduces typing.
x = np.array([-3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0])
f(x) # numpy pythonic coolness!!!
import matplotlib
Compare import pylab as pl versus from pylab import * (per scipy.org/PyLab)
a*x*x + b*x + c is per PEP 8
Axis-Wobble
Basics
Fluevog (shoes for the "stars"???)
Hertzsprung-Russell
Stars
Stars-Thick
Stellar-Color-Index
http://weatherspark.com/ visualization of local climate
Tau τ=2π
http://en.wikipedia.org/wiki/Tau#Mathematics
http://en.wikipedia.org/wiki/Pi
http://stackoverflow.com/questions/5147112/matplotlib-how-to-put-individual-tags-for-a-scatter-plot
http://pypi.python.org/pypi/markdown2Mathjax/
http://en.wikipedia.org/wiki/Magnitude_(astronomy)
http://en.wikipedia.org/wiki/Gamma_correction
https://en.wikipedia.org/wiki/Hertzsprung–Russell_diagram
https://en.wikipedia.org/wiki/Star_catalog
more cool magic: color_index[color < 1.0]
many shortcuts are vi inspired
<Ctrl>+M h to show keyboard shortcuts
picloud.com
https://github.com/brandon-rhodes/astronomy-notebooks
https://github.com/brandon-rhodes/pyzmq-static
2012-12-03 version
https://github.com/brandon-rhodes/astronomy-notebooks/tree/06d6cf3eb3e1855ffc1fc239a5ca76bb79d82fd1
See recipe[1] below for running.
Considering http://en.wikipedia.org/wiki/Vagrant_(software)
Cleaned up presentation:
http://rhodesmill.org/brandon/2013/codemash-astronomy/
http://rhodesmill.org/brandon/slides/2013-01-codemash/slides.html
https://github.com/brandon-rhodes/astronomy-notebooks
Fernando Pérez talks about science and IPython Notebook
http://pyvideo.org/video/1605/science-and-python-retrospective-of-a-mostly-s
What is URL for notebook he worked from?
He said it was taken from dox.
Scipy wraps Python around decades of legacy Fortran libraries
23:16 annotate with markdown
25:15 do shell stuff with '!' command
27:15 %qtconsole
GUI IPython
feels like terminal, but can show plots
2d line editing
29:45 MathJax: Latex rendering algorithms and fonts for browser
(implemented in Javascript?)
30:11 if a browser can show it, we can show it
wrappers ala __str__
videos
whole steenking web pages
32:29 load remote code
33:36 plays nice with SymPy coolness
34:59 plays nice with R (or Octave)
%%R -i ldjlsdajlasdj -o alsdjladsj
37:13 works with Cython for smoking speed
39:19 interact with javascript libraries
import networkx as nx
40:10 serious eye candy d3graph
40:58 publish to PDF for paper book
42:08 viewer for anyone with browser
nbviewer.ipython.org give URL or gist number (github pastebin)
42:34 eye candy: xkcd style plots
43:15 blog, book, scientific journals, and code are all the same
45:11 there is some parallel computing stuff
collaboration
reproducible
49:32 pillar 1: generalized command line IPython to GUI and sharing
pillar 2: open format for sharing, publishing, archiving
machine readable/hand fixable format
50:52 use ipython from with vim
https://github.com/ivanov/vim-ipython
51:40 amazon cluster stuff
53:58 speed matters julialang.org encroaching on python scientific use
numba
54:37 packaging is big problem (e.g. the need for jep's recipes)
55:47 John D. Hunter
asymptomatic until late July (during SciPy conference),
dead 4 weeeks later
58:20 online ipython tutor
60:03 support damn near any language e.g., %%bash %%ruby %%perl
500px.com ?
Alan Gilbert of CoverMyMeds
Will be hosting CohPy meeting in January.
CoverMyMeds helps with preauthorization from insurance companies for
various drugs. Customers are drug companies who benefit by selling drugs.
Service is free to doctors and pharmacies.
Brazenhead http://www.hdrestaurants.com/brazenhead/5thavenue/
(env)jep at blue:~/play$ python
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from python import podcast.com
http://www.thewebsiteisdown.com/
Mechanize v Selenium
https://en.wikipedia.org/wiki/Selenium_(software)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
password strength
http://xkcd.com/936/
https://github.com/beala/xkcd-password
http://preshing.com/20110811/xkcd-password-generator
emacs or vim with ipython:
https://blueprints.launchpad.net/python-mode/+spec/emacs-ipython-notebook
https://github.com/ivanov/vim-ipython
standard Knoppix boot command:
boot: knoppix no3d noswap
no3d disables cool animations that become annoying after a few minutes.
noswap avoids mounting swap partitions.
this is good for mucking about with raw drives
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[1] recipe for running 2012-12-03 presentation
# 2013-02-17
# Installing IPython Notebook on
# Xubuntu 12.10 Desktop i386 (used as live CD)
# for Brandon Rhodes' (bcr)
# astronomy on ipython notebook presentation
# 2012-12-03 cohpy
# system wide stuff
start_time=`date`
sudo apt-get update
# sudo apt-get upgrade
yes | sudo apt-get install git
yes | sudo apt-get install python-virtualenv
yes | sudo apt-get install python-dev
yes | sudo apt-get install libfreetype6-dev ;# for matplotlib
yes | sudo apt-get install libpng12-dev ;# for matplotlib
yes | sudo apt-get install libatlas-base-dev ;# for scipy
yes | sudo apt-get install gfortran ;# for scipy
git clone https://github.com/brandon-rhodes/astronomy-notebooks/
cd astronomy-notebooks
git checkout 06d6cf3eb3e1855ffc1fc239a5ca76bb79d82fd1
./setup.sh
source venv/bin/activate
pip install numpy
pip install matplotlib ;# includes pylab
pip install scipy
# mathjax is not necessary, but cool
echo 'from IPython.external import mathjax; mathjax.install_mathjax();' \
| ipython
echo $start_time
date
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Use the newly installed ipython notebook.
cd astronomy-notebooks
source venv/bin/activate
# ipython notebook can be invoked several ways
ipython notebook --pylab inline
BROWSER=firefox ipython notebook --pylab inline
ipython notebook --pylab inline --browser=firefox
# when all done
deactivate
More information about the CentralOH
mailing list