ó
,™xTc           @   s³   d  d l  m Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l	 m
 Z
 d  d l m Z e j j d ƒ Z d „  Z e d	 k r¯ d  d l Z e e j d
 ƒ n  d S(   iÿÿÿÿ(   t   divisionN(   t   command_line(   t   sgtbx(   t   flex(   t   any_reflection_filesÂ   
asymmetric = 3
  .type = int(value_min=0, value_max=3)
nproc = 1
  .type = int(value_min=1)
show_plot = True
  .type = bool
save_plot = False
  .type = bool
suffix = "_reindexed"
  .type = str
c      
   C   s|  t  j d t ƒ } | j d |  d d ƒ \ } } | j ƒ  | j ƒ  } d  } d  } d  } i  } d }	 x\| D]T}
 |	 d 7}	 t |
 ƒ } | j d t	 ƒ } g  | D]' } | j
 ƒ  j d d	 g k r  | ^ q  d
 } | j d t ƒ j | j
 ƒ  ƒ } | j ƒ  | d  k r| j ƒ  } n | j ƒ  | k s/t ‚ | j ƒ  d k sGt ‚ |
 | |	 <| j d t j | j ƒ  |	 ƒ d d  ƒ } | j ƒ  | j ƒ  k s™t ‚ | d  k r´| } | } nŸ | j d | j ƒ  j | j ƒ  ƒ d | j ƒ  j | j ƒ  ƒ d | j ƒ  j | j ƒ  ƒ ƒ } | j d | j ƒ  j | j ƒ  ƒ d | j ƒ  j | j ƒ  ƒ ƒ } | j ƒ  | j ƒ  k sqt ‚ | j ƒ  } | j d t ƒ } | j ƒ  j ƒ  j ƒ  } | j d | j ƒ  ƒ } qk W| | f } | d
 j ƒ  j ƒ  d d l  m! } | j" d k r5| j# | d | j$ d d d | j% d | j& ƒ} n3 | j' | d | j$ d | j" d | j% d | j& ƒ} t( d d ƒ } xþ | j) ƒ  D]ð \ } } t* j+ | ƒ } xÒ | D]Ê } | | }
 | d  k	 rÛ| |
 I| j, ƒ  IJn  t- j. j/ |
 ƒ } t- j. j0 | ƒ d
 | j1 d } t |
 ƒ } | j ƒ  d k s2t ‚ | j2 ƒ  } | j3 ƒ  scd |
 GH| j4 | ƒ n  | j5 | ƒ q¦Wq„Wd  S(   Nt   master_paramst   argst   custom_processort   collect_remainingiÿÿÿÿi   t   merge_equivalentst   It   SIGIi    t   anomalous_flagt   ccp4_mtzt   datat   sigmast   indicest   crystal_symmetry(   t   brehm_diederichst
   asymmetrict   nproct	   show_plott	   save_plots   reindex.txtt   wbs   .mtzs   reindexing %s(6   R   t   argument_interpretert   master_phil_scopet   process_and_fetcht   showt   extractt   NoneR   t   as_miller_arrayst   Falset   infot   labelst   customized_copyt   Truet   set_infot#   set_observation_type_xray_intensityt   space_groupt   AssertionErrort	   file_typeR   t   doublet   sizeR   t   concatenateR   R   t
   map_to_asut   expand_to_p1R	   t   arrayR   t   show_summaryt   cctbx.mergingR   R   t   runR   R   R   t   run_multiprocesst   opent	   iteritemsR   t   change_of_basis_opt   as_hklt   ost   patht   basenamet   splitextt   suffixt   file_contentt   is_identity_opt   change_basis_in_placet   write(   R   t   cmd_linet   working_philt   filest   paramst   miller_array_allt   lattice_idsR&   t   file_name_dictt
   lattice_idt	   file_namet   readerR   t   mat   intensitiest   idst   intensities_p1t   LR   t   result_setst   out_filet   reindexing_opt   wedgest   cb_opt   wedgeR9   t   out_namet
   mtz_object(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/command_line/brehm_diederichs.pyR1   %   sŠ    	

+

	!				
!	t   __main__i   (   t
   __future__R    R7   t
   iotbx.philt   iotbxt   libtbx.philR   t   cctbxR   t   cctbx.array_familyR   t   iotbx.reflection_file_readerR   t   philt   parseR   R1   t   __name__t   syst   argv(    (    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/cctbx/command_line/brehm_diederichs.pyt   <module>   s   			X