ó
ô™xTc           @   s˜   d  d l  m Z d  d l 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 r” e ƒ  e	 ƒ  e
 ƒ  n  d S(   iÿÿÿÿ(   t   divisionN(   t   scan_factory(   t   scan_helper_image_files(   t   scan_helper_image_formatsc          C   s:  t  ƒ  }  d d l } t j j t j j | j ƒ d d ƒ } d } t t  j | | ƒ ƒ d k sg t	 ‚ t  j
 | | d ƒ t j j | d ƒ k s— t	 ‚ t  j | d ƒ d k sµ t	 ‚ t  j t j j | d ƒ ƒ | | f k så t	 ‚ t  j d ƒ d k s t	 ‚ t  j d ƒ d k st	 ‚ t  j d	 ƒ d k s6t	 ‚ d S(
   s3   Test the static methods in scan_helper_image_files.iÿÿÿÿNi    t   testss   image_###.dati   i   s   image_001.dats   image_6.8kev_1_001.cbf(   R   t   dxtbxt   ost   patht   joint   splitt   __file__t   lent   template_directory_to_indicest   AssertionErrort!   template_directory_index_to_imaget   template_index_to_imaget   image_to_template_directoryt   image_to_indext   image_to_template(   t   helperR   t	   directoryt   template(    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/test_scan.pyt   work_helper_image_files   s"    	(	**c           C   s   t  j t  j ƒ s t ‚ d S(   sD   Test the static methods and properties in scan_helper_image_formats.N(   R   t   check_formatt
   FORMAT_CBFR   (    (    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/test_scan.pyt   work_helper_image_formats0   s    c    
   	   C   sŠ  d d l  }  t j j t j j |  j ƒ d d ƒ } d } g  t d ƒ D]B } t j t	 j
 | | | d ƒ t j d d	 d
 | d
 | ƒ ^ qG } | j ƒ  y t | d | d ƒ GHd GHWn t k
 rÍ } n X| j ƒ  t | d | d ƒ t j | d  ƒ } t j | d ƒ } | | t	 j
 | | d ƒ } t t j | ƒ ƒ d k sQt ‚ | | d d !| | d  t j j | d ƒ }	 d GHd S(   s   Test out the scan_factory.iÿÿÿÿNi    R   s   image_###.dati   i   g      ð?i   g      à?s   I should not see this messagei
   i   s   phi_scan_001.cbft   OK(   R   R   R   R   R	   R
   t   rangeR   t   singleR   R   R   R   t   reverset   sumt   RuntimeErrort   sortt   addR   t   searchR   (
   R   R   R   t   jt   xscanst   et   at   bt   filenamet   cbf(    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/test_scan.pyt   work_xscan_factory8   s.    (R
	
!c           C   s   t  ƒ  t ƒ  t ƒ  d  S(   N(   R   R   R*   (    (    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/test_scan.pyt	   test_scanb   s    t   __main__(   t
   __future__R    R   t   dxtbx.model.scanR   t   dxtbx.model.scan_helpersR   R   R   R   R*   R+   t   __name__(    (    (    sC   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/tests/test_scan.pyt   <module>   s   
			*	