Ipynb idioms

From DISI
Revision as of 17:03, 23 October 2014 by Frodo (talk | contribs)
Jump to navigation Jump to search

These are idioms for iPython Notebooks, also generally python.


top of every ipynb

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import requests
import urllib

set up variables for webapi

(hint ask john for credentials)

urlroot = 'http://x.ucsf.bkslab.org:y'
format = 'txt'

execute a command, with optional limits

R = requests.get(cmd + '?count=10000')
lines = list(R.iter_lines())
print len(lines)
print R.text