ó
MxTc           @   s<   d  d l  m Z d   Z d   Z e d k r8 e   n  d S(   i˙˙˙˙(   t   divisionc         C   s  |  j    j   s d Sg  d d d d d d d d d	 d
 d d d d d d d d d d d d d d g D] } | j   ^ qe } |  j   j   j d d  } xr | D]j } y | j |  } Wn' t k
 rŃ   n t	 k
 rä q˘ n Xt
 |  d k rű d S| d k  rd Sd SWd S(    s#  Determine the level of confidence in a given space group symbol. Often
data are scaled and merged in a space group that is different from the
crystal space group. For example, if the crystal space group is P212121
the data are sometimes processed in space group P222. Therefore this
function returns 0 for these two symbols. For some space groups this
kind of ambiguity is not possible, e.g. space group P1. The
corresponding return value is 2. Some symbols could be ambiguous,
but are typically not used as "default" symbols by data processing
programs, e.g. P3212. It is therefore more likely that these symbols
are chosen on purpose. The corresponding return value is 1.
This function returns None for all non-chiral space groups.
The return value for chiral space groups with unusual symbols is -1.
s   P23 P213s   P432 P4132 P4232 P4332s   I23 I213s
   I432 I4132t   F23s
   F432 F4132s   R3:Hs   R32:Hs
   P3 P31 P32s   P312 P3112 P3212s   P321 P3121 P3221s   P6 P61 P65 P62 P64 P63s"   P622 P6122 P6522 P6222 P6422 P6322s   P4 P41 P42 P43s1   P422 P41212 P4212 P4122 P4322 P4222 P42212 P43212s   I4 I41s
   I422 I4122s   P222 P212121 P2221 P21212s
   C2221 C222s   I222 I212121t   F222s
   P121 P1211t   C121t   P1t    t    i   i   i    i˙˙˙˙N(   t   groupt	   is_chiralt   Nonet   splitt   typet   lookup_symbolt   replacet   indext   KeyboardInterruptt	   Exceptiont   len(   t   space_group_infot   linet   symbol_groupst   symbolt   symbol_groupt   i(    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/symbol_confidence.pyt   level   sR         c          C   s0  d d l  m }  t |  j d   d  k s1 t  t |  j d   d k sR t  t |  j d   d k ss t  t |  j d   d	 k s t  t |  j d
   d k sľ t  d	 } xW t d d  D]F } t |  j |   } | d  k	 rË | d k st  | d 7} qË qË W| d k s't  d GHd  S(   Ni˙˙˙˙(   t   sgtbxs   P -1s   P 1i   s   P 2 2 21i   s   P 2i    s	   Hall: C 1iç   iA   t   OK(   i    i   i   (   t   cctbxR   R   R   R	   t   AssertionErrort   xrange(   R   t   nR   t   c(    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/symbol_confidence.pyt   _test8   s    !!!!!t   __main__N(   t
   __future__R    R   R    t   __name__(    (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/sgtbx/symbol_confidence.pyt   <module>   s   	6	