In [1]:
import numpy as np

In [18]:
points = {'1': (0.5, 0.5),
          '2': (0.7, 0.7),
          '3': (0.6, 0.6)}

In [19]:
test = points.values()

In [20]:
xy = tuple(zip(*test))

In [23]:
susi = np.polynomial.legendre.legvander2d(*xy, (2, 2))

In [25]:
tuple(susi)


Out[25]:
(array([ 1.      ,  0.5     , -0.125   ,  0.5     ,  0.25    , -0.0625  ,
        -0.125   , -0.0625  ,  0.015625]),
 array([ 1.      ,  0.7     ,  0.235   ,  0.7     ,  0.49    ,  0.1645  ,
         0.235   ,  0.1645  ,  0.055225]),
 array([ 1.    ,  0.6   ,  0.04  ,  0.6   ,  0.36  ,  0.024 ,  0.04  ,
         0.024 ,  0.0016]))

In [26]:
tuple(np.array([1, 2]))


Out[26]:
(1, 2)

In [27]:
ValuesView


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-27-b209cf8f9ac6> in <module>()
----> 1 ValuesView

NameError: name 'ValuesView' is not defined

In [99]:
from multiprocessing import Pipe

In [112]:
pipe_out, pipe_in = Pipe(duplex=False)

In [125]:
for i in range(4000):
    pipe_in.send('hello')


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-125-1c0c986489f9> in <module>()
      1 for i in range(4000):
----> 2     pipe_in.send('hello')

~/anaconda3/envs/lpde/lib/python3.6/multiprocessing/connection.py in send(self, obj)
    204         self._check_closed()
    205         self._check_writable()
--> 206         self._send_bytes(_ForkingPickler.dumps(obj))
    207 
    208     def recv_bytes(self, maxlength=None):

~/anaconda3/envs/lpde/lib/python3.6/multiprocessing/connection.py in _send_bytes(self, buf)
    402             # Also note we want to avoid sending a 0-length buffer separately,
    403             # to avoid "broken pipe" errors if the other end closed the pipe.
--> 404             self._send(header + buf)
    405 
    406     def _recv_bytes(self, maxsize=None):

~/anaconda3/envs/lpde/lib/python3.6/multiprocessing/connection.py in _send(self, buf, write)
    366         remaining = len(buf)
    367         while True:
--> 368             n = write(self._handle, buf)
    369             remaining -= n
    370             if remaining == 0:

KeyboardInterrupt: 

In [123]:
n = 0
while pipe_out.poll():
    pipe_out.recv()
    n += 1

In [124]:
n


Out[124]:
3000

In [98]:
pipe_in.writable


Out[98]:
True

In [80]:
pipe_out.poll(timeout=1.)


Out[80]:
True

In [70]:
if pipe_out.poll(timeout=1.):
    try:
        pipe_out.recv()
    except EOFError:
        print('hello')


hello

In [95]:
pipe_out.recv()


---------------------------------------------------------------------------
EOFError                                  Traceback (most recent call last)
<ipython-input-95-e19c9ab12dfb> in <module>()
----> 1 pipe_out.recv()

~/anaconda3/envs/lpde/lib/python3.6/multiprocessing/connection.py in recv(self)
    248         self._check_closed()
    249         self._check_readable()
--> 250         buf = self._recv_bytes()
    251         return _ForkingPickler.loads(buf.getbuffer())
    252 

~/anaconda3/envs/lpde/lib/python3.6/multiprocessing/connection.py in _recv_bytes(self, maxsize)
    405 
    406     def _recv_bytes(self, maxsize=None):
--> 407         buf = self._recv(4)
    408         size, = struct.unpack("!i", buf.getvalue())
    409         if maxsize is not None and size > maxsize:

~/anaconda3/envs/lpde/lib/python3.6/multiprocessing/connection.py in _recv(self, size, read)
    381             if n == 0:
    382                 if remaining == size:
--> 383                     raise EOFError
    384                 else:
    385                     raise OSError("got end of file during message")

EOFError: 

In [148]:
from time import monotonic, perf_counter, clock_getres, get_clock_info, CLOCK_MONOTONIC

In [149]:
clock_getres(CLOCK_MONOTONIC)


Out[149]:
1e-09

In [147]:
get_clock_info('monotonic')


Out[147]:
namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, resolution=1e-09)

In [ ]: