ó
î&]\c           @` sŽ   d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 m
 Z
 d  d l Z d  d l Z d e f d „  ƒ  YZ d S(   i    (   t   divisiont   print_functiont   absolute_importN(   t   assert_equalt   TestGILc           B` sS   e  Z d  Z d „  Z d „  Z d „  Z e j j e j j	 d d ƒ d „  ƒ ƒ Z
 RS(   sE   Check if the GIL is properly released by scipy.interpolate functions.c         C` s   g  |  _  d  S(   N(   t   messages(   t   self(    (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   setup_method   s    c         C` s   |  j  j | ƒ d  S(   N(   R   t   append(   R   t   message(    (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   log   s    c         ` s5   |  j  ‰ d t j f ‡  ‡ ‡ f d †  ƒ  Y} | ƒ  S(   Nt   WorkerThreadc           ` s   e  Z ‡  ‡ ‡ f d  †  Z RS(   c         ` s"   ˆ d ƒ ˆ ˆ  Œ  ˆ d ƒ d  S(   Ns   interpolation starteds   interpolation complete(    (   R   (   t   argsR
   t   target(    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   run   s    

(   t   __name__t
   __module__R   (    (   R   R
   R   (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyR      s   (   R
   t	   threadingt   Thread(   R   R   R   R   (    (   R   R
   R   s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   make_worker_thread   s    	%t   reasons*   race conditions, may depend on system loadc         ` s­   d „  ‰  ‡  ‡ f d †  } d „  ‰ | d d ƒ } |  j  ˆ | ƒ } | j ƒ  x. t d ƒ D]  } t j d ƒ |  j d ƒ q\ W| j ƒ  t |  j d d d d d	 g ƒ d  S(
   Nc         S` sH   t  j d d |  ƒ } } t  j | | ƒ \ } } | | } | | | f S(   Ni    iè  (   t   npt   linspacet   meshgrid(   t   n_pointst   xt   yt   x_gridt   y_gridt   z(    (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   generate_params$   s    
c         ` s]   xV t  j d d ƒ D]B } ˆ  | ƒ } t j ƒ  } ˆ | Œ  t j ƒ  | |  k r | Sq Wd  S(   Niˆ  iè  (   t	   itertoolst   countt   time(   t   requested_timeR   R   t   time_started(   R   t   interpolate(    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   calibrate_delay*   s    
c         S` s   t  j j |  | | ƒ d  S(   N(   t   scipyR$   t   RectBivariateSpline(   R   R   R   (    (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyR$   2   s    R"   i   g      à?t   workings   interpolation starteds   interpolation complete(	   R   t   startt   rangeR!   t   sleepR
   t   joinR   R   (   R   R%   R   t   worker_threadt   i(    (   R   R$   s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   test_rectbivariatespline!   s     		

	(   R   R   t   __doc__R   R
   R   t   pytestt   markt   slowt   xfailR/   (    (    (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyR      s   				(   t
   __future__R    R   R   R   R   R!   t   numpyR   t   numpy.testingR   R1   t   scipy.interpolateR&   t   objectR   (    (    (    s?   lib/python2.7/site-packages/scipy/interpolate/tests/test_gil.pyt   <module>   s   