ó
C™xTc           @   sy   d  Z  d d l m Z d d l m Z d d l Z d d l Z d Z d „  Z d „  Z	 d „  Z
 e d	 k ru e
 ƒ  n  d S(
   s\   Check if sgtbx Hermann-Mauguin vs. Hall symbol table is fully
   consistent with ITVB 2001.
iÿÿÿÿ(   t   division(   t   sgtbxNs'   itvb_2001_table_a1427_hall_symbols.htmlc           C   s1   y t  j d t t ƒ Wn t k
 r, t SXt S(   Ns   http://cci.lbl.gov/sginfo/%s(   t   urllibt   urlretrievet	   html_filet   IOErrort   Falset   True(    (    (    se   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_itvb_2001_table_a1427_hall_symbols.pyt   get_test_files   s
    c          C   sÇ  t  ƒ  sD t j j t ƒ sD t t ƒ j ƒ  j ƒ  j d ƒ d k rM d GHd  St t ƒ j ƒ  j	 ƒ  d d !}  t
 |  ƒ d k s„ t ‚ t j ƒ  } x0|  D](} | j ƒ  } t
 | ƒ d k sÁ t ‚ | \ } } } | j ƒ  | k sè t ‚ t j d | ƒ } | j ƒ  j d	 d
 ƒ j d d ƒ j d d ƒ j d d ƒ } | j ƒ  j ƒ  j d	 d
 ƒ }	 |	 d d
 k rq|	 d }	 n  | | k sƒt ‚ |	 | k s•t ‚ | j ƒ  }
 |
 j ƒ  | j ƒ  k s— t ‚ q— Wd  S(   Ns	   not foundi    s-   Skipping exercise(): input file not availablei   iüÿÿÿi  i   t   symbolt    t   _s   _:t   :s   :Hs   :hs   :Rs   :ri   (   R   t   ost   patht   isfileR   t   opent   readt   lowert   findt
   splitlinest   lent   AssertionErrorR   t   space_group_symbol_iteratort   splitt   space_group_symbolst   universal_hermann_mauguint   replacet   hallt   next(   t   table_linesR   t   linet   fldst   nct   hmR   t   symbolst   hm_sgtbxt
   hall_sgtbxt	   symbols_i(    (    se   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_itvb_2001_table_a1427_hall_symbols.pyt   get_and_check_file   s4    
' 	c           C   s   t  ƒ  d GHd  S(   Nt   OK(   R'   (    (    (    se   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_itvb_2001_table_a1427_hall_symbols.pyt   exercise-   s    t   __main__(   t   __doc__t
   __future__R    t   cctbxR   R   R   R   R   R'   R)   t   __name__(    (    (    se   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_itvb_2001_table_a1427_hall_symbols.pyt   <module>   s   			