ó
õxTc           @   s~   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d   Z d   Z d   Z d   Z	 e
 d	 k rz e	   n  d
 S(   i’’’’(   t   division(   t   is_angle_in_range(   t   get_range_of_mod2pi_angles(   t   get_mod2pi_angles_in_rangec             sD  d d l  m   d       f d   }   f d   } d } x½t |  D]Æ} |   |   f } | d | d k  r9x9 t d | d  D]$ } t | | t  t k s t  q WxA t | d | d d  D]$ } t | | t  t k sĪ t  qĪ Wx t | d d d	  D]$ } t | | t  t k st  qWqJ x= t d | d d  D]$ } t | | t  t k sQt  qQWxA t | d d | d  D]$ } t | | t  t k st  qWx9 t | d d	  D]$ } t | | t  t k sŃt  qŃWqJ Wd } x5 t d d	  D]$ } t | | t  t k st  qWd GHd S(   s   Test that for a range of angles and angular ranges, the
  is_angle_in_range function correctly calculates if the angle
  is in the range.

  i’’’’(   t   randomc         S   s   |  d t  |  d  S(   Ng     v@(   t   floor(   t   x(    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyt   <lambda>   s    c            s     |  d    |  d  f S(   Ni    i   (    (   R   (   t   mod_360(    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyR      s    c              s   t      d  S(   Ng     v@(   t   int(    (   R   (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyR      s    id   i    i   ih  iö’’’ir  t   OKN(   iö’’’ir  (   R   t   rangeR   t   Truet   Falset   AssertionError(   t   mod_360_ranget   random_0_360t	   num_ranget   nt   angular_ranget   angle(    (   R   R   sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyt   tst_is_angle_in_range   s0    	"""%"""&"c          C   sį   t  d d d t \ }  } |  d k r3 | d k s9 t  t  d d d t \ }  } |  | k sf t  t  d d d t \ }  } |  d k r | d k s t  t  d d d t \ }  } |  d	 k rŅ | d k sŲ t  d
 GHd S(   s=   Get the range of equivalent within a given angular range.

  i    ih  i“   t   degiµ   iŠ  i  iž’’iL’’’R
   N(   i    ih  (   iµ   ih  (   i    iŠ  (   iž’’iŠ  (   R   R   R   (   t   a0t   a1(    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyt   tst_get_range_of_mod2pi_angles;   s    c          C   s  t  d d d t }  t |   d k r7 |  d d k s= t  t  d d d t }  t |   d k sj t  t  d d d t }  t |   d k r± |  d d k r± |  d d	 k s· t  t  d d d t }  t |   d k r|  d d k r|  d d k r|  d d	 k st  d GHd S(   s<   Get the list of equivalent within a given angular range.

  i    ih  i“   R   i   iµ   iŠ  i   i  iž’’i   iL’’’R
   N(   i    ih  (   iµ   ih  (   i    iŠ  (   iž’’iŠ  (   R   R   t   lenR   (   t   a(    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyt   tst_get_mod2pi_angles_in_rangeR   s    (8Hc           C   s   t    t   t   d S(   s(   Run tests for the scan_helpers.h module.N(   R   R   R   (    (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyt   runi   s    t   __main__N(   t
   __future__R    t   dxtbx.modelR   R   R   R   R   R   R   t   __name__(    (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/model/tst_scan_helpers.pyt   <module>   s   	5			