In [1]:
import time
from numpy import pi, cos, sin, linspace, roll, zeros_like
from bokeh.plotting import *
from bokeh.objects import Glyph, Range1d

In [2]:
N = 50 + 1
r_base = 8
theta = linspace(0, 2*pi, N)
r_x = linspace(0, 6*pi, N-1)
rmin = r_base - cos(r_x) - 1
rmax = r_base + sin(r_x) + 1
colors = ["FFFFCC", "#C7E9B4", "#7FCDBB", "#41B6C4", "#2C7FB8", "#253494", "#2C7FB8", "#41B6C4", "#7FCDBB", "#C7E9B4"] * 5
cx = cy = zeros_like(rmin)

In [3]:
output_notebook(url="default")


found config for http://localhost:5006/
{}
loading it!
if you don't wish to load this config, please pass load_from_config=False

In [4]:
annular_wedge(
    cx, cy, rmin, rmax, theta[:-1], theta[1:],
    x_range = Range1d(start=-11, end=11),
    y_range = Range1d(start=-11, end=11),
    inner_radius_units="data",
    outer_radius_units="data",
    fill_color = colors,
    line_color="black",
    tools="pan,wheel_zoom,box_zoom,reset,resize"
)
show()



In [6]:
renderer = [r for r in curplot().renderers if isinstance(r, Glyph)][0]
ds = renderer.data_source
show()
while True:
    for i in linspace(-2*pi, 2*pi, 50):
        
        rmin = ds.data["inner_radius"]
        rmin = roll(rmin, 1)
        ds.data["inner_radius"] = rmin
        
        rmax = ds.data["outer_radius"]
        rmax = roll(rmax, -1)
        ds.data["outer_radius"] = rmax
        
        cursession().store_objects(ds)
        time.sleep(.10)


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-6-bef15925c54e> in <module>()
     10         rmax = roll(rmax, -1)
     11         ds.data["outer_radius"] = rmax
---> 12         cursession().store_objects(ds)
     13         time.sleep(.10)

/Users/bryan/work/bokeh/bokeh/session.pyc in store_objects(self, *objs, **kwargs)
    393 
    394         json_objs = utils.dump(models, self.docid)
--> 395         self.push(*json_objs)
    396         for model in models:
    397             model._dirty = False

/Users/bryan/work/bokeh/bokeh/session.pyc in push(self, *jsonobjs)
    350         data = protocol.serialize_json(jsonobjs)
    351         url = utils.urljoin(self.base_url, self.docid + "/", "bulkupsert")
--> 352         self.post_json(url, data=data)
    353 
    354     # convenience functions to use a session and store/fetch from server

/Users/bryan/work/bokeh/bokeh/session.pyc in post_json(self, url, headers, **kwargs)
    248 
    249     def post_json(self, url, headers=None, **kwargs):
--> 250         return self.execute_json('post', url, headers=headers, **kwargs)
    251 
    252     @property

/Users/bryan/work/bokeh/bokeh/session.pyc in execute_json(self, method, url, headers, **kwargs)
    237             headers={'content-type':'application/json'}
    238         func = getattr(self.http_session, method)
--> 239         resp = func(url, headers=headers, **kwargs)
    240         if resp.status_code == 409:
    241             raise DataIntegrityException

/Users/bryan/anaconda/lib/python2.7/site-packages/requests/sessions.pyc in post(self, url, data, **kwargs)
    423         """
    424 
--> 425         return self.request('POST', url, data=data, **kwargs)
    426 
    427     def put(self, url, data=None, **kwargs):

/Users/bryan/anaconda/lib/python2.7/site-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert)
    381             'allow_redirects': allow_redirects,
    382         }
--> 383         resp = self.send(prep, **send_kwargs)
    384 
    385         return resp

/Users/bryan/anaconda/lib/python2.7/site-packages/requests/sessions.pyc in send(self, request, **kwargs)
    484         start = datetime.utcnow()
    485         # Send the request
--> 486         r = adapter.send(request, **kwargs)
    487         # Total elapsed time of the request (approximately)
    488         r.elapsed = datetime.utcnow() - start

/Users/bryan/anaconda/lib/python2.7/site-packages/requests/adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies)
    328                     decode_content=False,
    329                     retries=self.max_retries,
--> 330                     timeout=timeout
    331                 )
    332 

/Users/bryan/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.pyc in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, **response_kw)
    478             httplib_response = self._make_request(conn, method, url,
    479                                                   timeout=timeout,
--> 480                                                   body=body, headers=headers)
    481 
    482             # If we're going to release the connection in ``finally:``, then

/Users/bryan/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.pyc in _make_request(self, conn, method, url, timeout, **httplib_request_kw)
    311         try:
    312             try: # Python 2.7+, use buffering of HTTP responses
--> 313                 httplib_response = conn.getresponse(buffering=True)
    314             except TypeError: # Python 2.6 and older
    315                 httplib_response = conn.getresponse()

/Users/bryan/anaconda/lib/python2.7/httplib.pyc in getresponse(self, buffering)
   1043         response = self.response_class(*args, **kwds)
   1044 
-> 1045         response.begin()
   1046         assert response.will_close != _UNKNOWN
   1047         self.__state = _CS_IDLE

/Users/bryan/anaconda/lib/python2.7/httplib.pyc in begin(self)
    407         # read until we get a non-100 response
    408         while True:
--> 409             version, status, reason = self._read_status()
    410             if status != CONTINUE:
    411                 break

/Users/bryan/anaconda/lib/python2.7/httplib.pyc in _read_status(self)
    363     def _read_status(self):
    364         # Initialize with Simple-Response defaults
--> 365         line = self.fp.readline(_MAXLINE + 1)
    366         if len(line) > _MAXLINE:
    367             raise LineTooLong("header line")

/Users/bryan/anaconda/lib/python2.7/socket.pyc in readline(self, size)
    474             while True:
    475                 try:
--> 476                     data = self._sock.recv(self._rbufsize)
    477                 except error, e:
    478                     if e.args[0] == EINTR:

KeyboardInterrupt: 

In [ ]: