
ʽXc           @  s   d  d l  m Z d  d l Z d  d l Z d  d l m Z m Z m Z m	 Z	 m
 Z
 d  d l m Z m Z d  d l m Z d e f d     YZ d e f d	     YZ d
 e f d     YZ d S(   i(   t   print_functionN(   t   TestCaset   assert_equalt   assert_almost_equalt   assert_array_equalt   assert_array_almost_equal(   t   SphericalVoronoit   distance(   t   _spherical_voronoit   TestCircumcentersc           B  s   e  Z d    Z RS(   c         C  s   t  j d d d g d d d g d d d	 g d
 d d g g d d d g d d d g d d d g d d d g g g  } t j |  } d d d g d d d g g } t | |  d  S(   Ni   i   i   gg gg333333g@g	@ggffffffgffffff
@i
   i   i   g333333$g4g>gffffff$g3333334@g333333>@g$gL4gL>@gj-g<Ng4̥3?g։gD¿gE#^?(   t   npt   arrayt   spherical_voronoit   calc_circumcentersR   (   t   selft   tetrahedronst   resultt   expected(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_circumcenters   s    (   t   __name__t
   __module__R   (    (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyR	      s   t   TestProjectToSpherec           B  s#   e  Z d    Z d   Z d   Z RS(   c         C  sw   t  j d d d g d d d g d d d g g  } t  j d d d g  } d } t j | | |  } t | |  d  S(   Ni   i    (   R
   R   R   t   project_to_sphereR   (   R   t   pointst   centert   radiust	   projected(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_unit_sphere'   s
    3c         C  s   t  j d d d g d d d g d d d g g  } t  j d d d g  } d } | d } t j | | |  } t | |  d  S(   Ni   i    i   (   R
   R   R   R   R   (   R   R   R   R   t   scaledR   (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_scaled_points.   s    3
c         C  s   t  j d d d g d d d g d d d g g  } t  j d d d g  } | | } d } t j | | |  } t | |  d  S(   Ni   i    i   i   (   R
   R   R   R   R   (   R   R   R   t
   translatedR   R   (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_translated_sphere6   s    3
	(   R   R   R   R   R   (    (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyR   %   s   		t   TestSphericalVoronoic           B  sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C  sv   t  j d d d g d d d g d d d	 g d
 d d g d d d g d d d g d d d g d d d g g  |  _ d  S(   Ng7Ag4QĿgM%?gavcgtu?gc?gX&p?g|gZ
Bɿg-NgQtag;[/ۿg|-S?gl̲?gp?gwg4g?g݆Xf¿gCk?gl
=r1̿gt8A@g9K?g͡w4u?g?(   R
   R   R   (   R   (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   setUpB   s    c         C  s  t  j d d d g  } d } t |  j  } t |  j |  } t |  j d  |  } t |  j | |  } t | j t  j d d d g   |  j | j d  t | j t  j d d d g   |  j | j d  t | j |  |  j | j d  t | j |  |  j | j |  d  S(   Ni   i   i   i    (	   R
   R   R   R   t   NoneR   R   t   assertEqualR   (   R   R   R   t   s1t   s2t   s3t   s4(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_constructorN   s    ""c         C  sn   t  |  j  } t j d d d g  } t  |  j | d  |  } t | j | j  t | j | | j  d  S(   Ni   (	   R   R   R
   R   R"   R   t   regionsR   t   vertices(   R   t	   sv_originR   t   sv_translated(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt,   test_vertices_regions_translation_invariance^   s    c         C  sS   t  |  j  } t  |  j d d  } t | j | j  t | j d | j  d  S(   Ni   (   R   R   R   R)   R   R*   (   R   t   sv_unitt	   sv_scaled(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt(   test_vertices_regions_scaling_invariancef   s
    c         C  sB   t  |  j  } | j } | j   t t | j  t |   d  S(   N(   R   R   R)   t   sort_vertices_of_regionsR   t   sorted(   R   t   svt   unsorted_regions(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_sort_vertices_of_regionsm   s    	
c         C  s   t  d d d d d g d d d d d d	 g d d d
 d g d
 d d	 d d g d d d g d d	 d g d d
 d d d g d d d d d g g  } t t j t  |     } t |  j  } | j   t t j t  | j     } t | |  d  S(   Ni    i   i   i   i   i
   i   i   i   i   i   i	   (	   R2   t   listt	   itertoolst   chainR   R   R1   R)   R   (   R   R   R3   t   actual(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt'   test_sort_vertices_of_regions_flatteneds   s    ?B
c         C  sH   t  |  j  } |  j j d d d } | j j d } t | |  d  S(   Ni    i   i   (   R   R   t   shapeR*   R   (   R   R3   R   R9   (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_num_vertices}   s    c         C  s   t  j |  j  } x | j D] } t j | j t j | g   } t j t |  d d ! } t	 | d | d d t
 |   t	 | d | d d t
 |   q Wd  S(   Ni    i   i   i   i   (   R   R   R   R*   R   t   cdistR
   R   R2   R   t   str(   R   R3   t   vertext	   distancest   closest(    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   test_voronoi_circles   s    !!(
   R   R   R!   R(   R-   R0   R5   R:   R<   RB   (    (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyR    @   s   						
	(   t
   __future__R    t   numpyR
   R7   t   numpy.testingR   R   R   R   R   t   scipy.spatialR   R   R   R   R	   R   R    (    (    (    sI   /tmp/pip-build-7oUkmx/scipy/scipy/spatial/tests/test_spherical_voronoi.pyt   <module>   s   (