ó
F™xTc           @   s  d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 m Z d  d l m Z d  d l Z d  d l Z d  d l Z e j d	 ƒ e j d	 ƒ d
 d d „ Z d „  Z d „  Z e d k re ƒ  e j e j d e ƒ n  d S(   iÿÿÿÿ(   t   division(   t   random_structure(   t   debug_utils(   t   space_group_info(   t   flex(   t   approx_equalt   Exception_expected(   t   SorryNi    id   g      ø?c      	   C   sÓ  t  j d |  d d | d d |  d d	 d
 d ƒ } t | j d | ƒ j ƒ  ƒ } xx t | j ƒ  | j ƒ  j ƒ  ƒ D]U \ } } t	 j
 | j ƒ  j | ƒ ƒ } t | d t j | j | ƒ ƒ ƒ st t ‚ qt W| j ƒ  GHt	 j | j ƒ  j ƒ  ƒ t	 j | j ƒ  ƒ d } | j d | j ƒ  d | j ƒ  | ƒ }	 d G|	 j ƒ  j ƒ  GH|	 j d d ƒ }
 d G|
 j ƒ  j ƒ  GH|
 j d d d t ƒ |
 j d d d t ƒ | j d d d t ƒ | j d d d t ƒ d d GHd  S(   NR   t   elementst   Ot   Nt   Ci   i   t   volume_per_atomi2   t   min_distanceg      ø?t   d_ming      ð?i
   t   datat   sigmass	   datat in:t   sigma_cutoffs
   data left:t	   file_names   indices1.pdbt   expand_to_p1s   indices2.pdbs   indices3.pdbs   indices4.pdbt   *i   (   R	   R
   R   (   R   t   xray_structuret   abst   structure_factorst   f_calct   zipt   indicest
   d_spacingsR   R   t   doublet	   unit_cellt   reciprocal_space_vectorR   t   matht   sqrtt   dott   AssertionErrort   random_doublet   sizet   meant   customized_copyt   ellipsoidal_truncation_by_sigmat   miller_indices_as_pdb_filet   Falset   True(   R   t   n_sitesR   t   xrst   f_obst   mit   dt   rsvt   ft   f_obs1t   r(    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_miller_data_manipulation.pyt   exercise_ellipsoidal_truncation   s(    		./2(c         C   s   t  | ƒ d  S(   N(   R4   (   t   flagsR   (    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_miller_data_manipulation.pyt   run_call_back+   s    c    	   	   C   sP  t  j d d d d d d d d	 ƒ }  t |  j d
 d ƒ j ƒ  ƒ } | j ƒ  } | j d d ƒ } | j ƒ  } | j d d ƒ j ƒ  } | j	 ƒ  j
 | j	 ƒ  ƒ s¥ t ‚ | j d | ƒ \ } } | j	 ƒ  j | j	 ƒ  ƒ sß t ‚ y | j d d ƒ } Wn t k
 r
} n Xt ‚ | j d d ƒ } | j d | ƒ \ } } | j	 ƒ  j | j	 ƒ  ƒ s\t ‚ t  j d d d d d d d d	 ƒ }  t |  j d
 d ƒ j ƒ  ƒ } | j ƒ  } | j d d ƒ } | j ƒ  } | j d d ƒ j ƒ  } | j	 ƒ  j
 | j	 ƒ  ƒ st ‚ | j d d ƒ } | j d | ƒ \ } } | j	 ƒ  j | j	 ƒ  ƒ sLt ‚ d  S(   NR   i   i   iZ   t   space_group_symbolt   P1t   n_scatterersR   t   randomR   g      ø?s   l,-k,hg333333Ó?t   others   k,h,lg      à?gòÒMb8L@g=
×£pc@g¢E¶óýŒR@g     €V@g
×£p=W@t   P21id   s   h,-k,-l(   i   i   i   iZ   iZ   iZ   (   gòÒMb8L@g=
×£pc@g¢E¶óýŒR@g     €V@g
×£p=W@g     €V@(   R   R   R   R   R   t#   set_observation_type_xray_amplitudet	   twin_datat	   f_as_f_sqt	   f_sq_as_fR   t   all_eqR"   t   common_setst   all_approx_equalR   R   t   detwin_data(	   R,   t   fct   fc_twint   ict	   fc_twin_2t   fc_tmpt   fc_twin_tmpt   st	   fc_detwin(    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_miller_data_manipulation.pyt   exercise_twinning0   sF    		!"!		!t   __main__i   (   t
   __future__R    t   cctbx.developmentR   R   t   cctbx.sgtbxR   t   scitbx.array_familyR   t   libtbx.test_utilsR   R   t   libtbx.utilsR   R:   R   t   syst   seedt   set_random_seedR4   R6   RM   t   __name__t   parse_options_loop_space_groupst   argv(    (    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/regression/tst_miller_data_manipulation.pyt   <module>   s"   		+