ó
‚™xTc           @   sŠ   d  d l  m Z d  d l m Z d  d l m Z d  d l Z d  d l Z d Z	 e j
 d „ Z d „  Z e d k r† e e j d	 ƒ n  d S(
   iÿÿÿÿ(   t   division(   t   Sorry(   t   AutoNs   
file_name = None
  .type = path
data_labels = None
  .type = str
space_group = None
  .type = space_group
ignore_merged = False
  .type = bool
batch_label = None
  .type = str
ignore_batch = False
  .type = bool
output {
  prefix = None
    .type = str
}
c      	   C   s„  d d  l  } | j j d |  d t d d d d ƒ } | j j ƒ  } t | ƒ | j | j ƒ } | j	 j
 d t ƒ } d  } | j	 j ƒ  d	 k r¯ | j s¯ | j	 j ƒ  j } q¯ n  g  } xa| D]Y}	 |	 j ƒ  j ƒ  }
 |	 j ƒ  d  k r+| j d  k rt d
 ƒ ‚ qL|	 j d | j ƒ j |	 j ƒ  ƒ }	 n! | j d  k rL|	 j ƒ  | _ n  |	 j ƒ  r–|	 j ƒ  r–| j d  k sƒ|
 | j k r| j |	 ƒ qq¼ |	 j ƒ  r¼ | d  k r¼ | j r| j d  k	 r|
 | j k rß|	 } q| j t k rd |	 j ƒ  j ƒ  k r|	 } qqq¼ q¼ Wt  | ƒ d k r:t d ƒ ‚ n | j d  k rXt d
 ƒ ‚ n  x( | D]  } | d | j ƒ  j ƒ  IJq_W| d  k	 rÎt! | ƒ j" d k rÁ| d | j ƒ  j ƒ  IJqÎ| d IJn  | j# j$ d  k rt% j& j' t% j& j( | j ƒ ƒ d | j# _$ n  g  } xi| D]a} | j ƒ  j) }
 d  } d  } xt |
 D]l } | j* d ƒ r|| j+ d ƒ \ } } t, | ƒ } n  | j* d ƒ rC| j+ d ƒ \ } } t, | ƒ } qCqCW| j# j$ } | d  k	 rÜ| d | 7} n  | d  k	 rù| d | 7} n  | d } d } x2 | | k r=| d t- | ƒ d } | d 7} qW| j | ƒ | j ƒ  d  k ru| j d | j ƒ } n  | } | d  k	 rXt } t! | ƒ j" d k rÌt  | ƒ t  | j. ƒ  ƒ k rðt/ } qðn$ | j. ƒ  j0 | j. ƒ  ƒ rðt/ } n  | rXd d | j ƒ  j ƒ  | j ƒ  j ƒ  f } | j s>t | d ƒ ‚ qU| | d IJd  } qXn  | j1 d | d | ƒ | d  | IJqW| S(!   Niÿÿÿÿt   argst   master_phil_stringt   reflection_file_deft	   file_namet   space_group_deft   space_groupt   merge_equivalentst!   scalepack_no_merge_original_indexs-   Space group needs to be explicitly specified.t   space_group_infot   BATCHi    s   No unmerged intensities found.s   Using intensities in %st   arrays#   Batch numbers will be taken from %ss'   Batch numbers taken from raw input files   wavelength_id=t   =s   crystal_id=s   _c%ds   _w%ds   _unmerged.scai   t   -s2   The h,k,l indices for the batch number array (%s) s<   do not match the h,k,l indices for the intensity array %s.  s>   You can suppress this warning by specifying ignore_batch=True.s%   The batch numbers will not be output.t   batch_numberss   Wrote %s(2   t
   iotbx.philt   philt   process_command_line_with_filest   master_phil_strt   workt   extractt   validate_paramst   get_fileR   t   file_objectt   as_miller_arrayst   Falset   Nonet	   file_typet   ignore_batcht   file_contentR   t   infot   label_stringR   R   t   customized_copyt   set_infoR   t   is_xray_intensity_arrayt   is_unique_set_under_symmetryt   data_labelst   appendt   is_integer_arrayt   batch_labelR   t   labels_stringt   lent   typet   __name__t   outputt   prefixt   ost   patht   splitextt   basenamet   labelst
   startswitht   splitt   intt   strt   indicest   Truet   all_eqt   export_as_scalepack_unmerged(   R   t   outt   iotbxt   cmdlinet   paramst   hkl_int   miller_arraysR   t   outputsR   R4   t   i_obst   output_file_namest   wavelength_idt
   crystal_idt   labelt   label2t   w_id_strt   c_id_strt	   file_baseR   t   nt   tmp_batch_numberst   mismatcht   msg(    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/export_scalepack_unmerged.pyt   run   sÄ    	
					%
			c         C   s"   |  j  d  k r t d ƒ ‚ n  d  S(   Ns   Input file name not specified.(   R   R   R   (   R@   (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/export_scalepack_unmerged.pyR   ‚   s    t   __main__i   (   t
   __future__R    t   libtbx.utilsR   t   libtbxR   t   os.pathR0   t   sysR   t   stdoutRQ   R   R-   t   argv(    (    (    sZ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/command_line/export_scalepack_unmerged.pyt   <module>   s   g	