ó
†™xTc           @   sÓ  d  d l  m Z d  d l Z d  d l Z e j j d ƒ Z d  d l	 Td  d l	 Z d  d l
 m Z d  d l m Z d  d l Z d  d l m 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 m Z m Z d  d l m Z d  d l m Z m Z d  d l Z d  d l Z d  d l Z d  d l  Z  d  d l! Z! d d d d d d f d d d d d d f d d d d d d f d d d d d d f d d d d d d f d d d d d d f f Z" e# e j$ ƒ  ƒ e" k r e j% d  e& e# e j$ ƒ  ƒ ƒ e! j' e  j( e j j) f ƒ n  d! Z* i d" d# 6d$ d% 6d& d' 6d( d) 6d* d+ 6d, d- 6d* d. 6d/ d0 6d* d1 6d2 d3 6d4 d5 6d6 d7 6d8 d9 6d: d; 6d< d= 6d> d? 6d@ dA 6Z+ i dB d# 6d$ d% 6d& d' 6dC d) 6dD d+ 6d& d- 6dD d. 6d$ d0 6dD d1 6dE d3 6dF d5 6dG d7 6dH d9 6dI d; 6dJ d= 6d> d? 6d@ dA 6Z, e- e, j. ƒ  ƒ e- e+ j. ƒ  ƒ k sJt/ ‚ dK „  Z0 i dL dM f dL 6dN dO f dN 6Z1 dP „  Z2 dQ „  Z3 dR e4 dS f dT „  ƒ  YZ5 dU e5 f dV „  ƒ  YZ6 dW „  Z7 dX dY dZ g Z8 d[ „  Z9 d\ e j j: e j; f d] „  ƒ  YZ< d^ „  Z= d_ „  Z> d\ e j j: e j? f d` „  ƒ  YZ< d\ e j j: e j@ f da „  ƒ  YZ< db e f dc „  ƒ  YZA d\ e j j: e jB f dd „  ƒ  YZ< eC eC eC de df dg dh di „ ZD d\ e j j: e jE f dj „  ƒ  YZ< dk „  ZF d S(l   iÿÿÿÿ(   t   divisionNt   iotbx_mtz_ext(   t   *(   t   extract_from_symmetry_lib(   t   xray(   t   miller(   t   sgtbx(   t   uctbx(   t   flex(   t   show_stringt   overwrite_att   contains_one_of(   t   Sorry(   t   adopt_init_argst   slots_getstate_setstatei8   iT   i°   iô  i00  iÈ0  i@   iX   i¸   iø  ið0  i40  iÌ0  iø0  iˆ   iØ0  i�   i1  s  Unexpected iotbx.mtz.cmtz_struct_sizes(): %s

os.name: %s
sys.platform: %s
boost.python.platform_info: %s

The iotbx.mtz module makes certain assumptions about the C structs in
the CMtz library. This warning appears if the sizes of the C structs
are not in a table of expected sizes. It may appear on platforms
where the iotbx.mtz module was not tested before, or if the CMtz
library structs have changed. If you see this warning, please send
the complete output to cctbx@cci.lbl.gov to give us the opportunity
to investigate.
Thank you!
s   ccp4/doc/mtzformat.docs   index h,k,lt   Ht	   intensityt   Jt	   amplitudet   Fs   anomalous differencet   Ds   standard deviationt   Qs   F(+) or F(-)t   Gt   Ls   I(+) or I(-)t   Kt   Ms   normalized amplitudet   Es   phase angle in degreest   Ps   weight (of some sort)t   Ws4   phase probability coefficients (Hendrickson/Lattman)t   As   BATCH numbert   Bs6   M/ISYM, packed partial/reject flag and symmetry numbert   Yt   integert   It   realt   Rt   miller_indext   anomalous_differencet   standard_deviationt   normalized_amplitudet   phase_degreest   weightt   hendrickson_lattmant   batch_numbert   m_isymc         C   sì  d  } |  j ƒ  rU |  j ƒ  d  k rU |  j ƒ  s7 t ‚ |  j ƒ  rL d } qèd } n“|  j ƒ  rˆ |  j ƒ  rˆ |  j ƒ  d  k	 rˆ d } n`|  j ƒ  s  |  j ƒ  r» |  j ƒ  d  k r» d } n-|  j ƒ  r#|  j ƒ  rû d } |  j ƒ  d  k	 r | d 7} q qèd } |  j ƒ  d  k	 rè| d 7} qènÅ |  j	 ƒ  sM|  j
 ƒ  r©|  j ƒ  d  k	 r©|  j ƒ  r�d	 } |  j ƒ  d  k	 r¦| d
 7} q¦qèd } |  j ƒ  d  k	 rè| d 7} qèn? |  j
 ƒ  rÓ|  j ƒ  rÊd	 } qèd } n |  j ƒ  rèd } n  | S(   Nt   GPt   FPt   FQDQYR!   R   R   R   R   R   R   R   t   AAAA(   t   Nonet   is_complex_arrayt   sigmast   is_xray_intensity_arrayt   AssertionErrort   anomalous_flagt%   is_xray_reconstructed_amplitude_arrayt   is_bool_arrayt   is_integer_arrayt   is_xray_amplitude_arrayt   is_real_arrayt   is_hendrickson_lattman_array(   t   miller_arrayt   result(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   default_column_typesg   sN    							t   +t   PLUSt   -t   MINUc         C   s   t  | j ƒ  t |  ƒ S(   N(   R   t   uppert   anomalous_label_patterns(   t   signt   label(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   is_anomalous_label™   s    c         C   s(   x! | D] } t  |  | ƒ s t Sq Wt S(   N(   RH   t   Falset   True(   RF   t   labelsRG   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   are_anomalous_labelsœ   s     t   label_decoratort   objectc           B   s‰   e  Z d  d d d d d d d d d d d d	 d
 g d „ Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d d „ Z	 d d „ Z
 RS(   s   (+)s   (-)t   SIGt    t   DANOt   ISYMt   PHIR   R   t   CR   c         C   s,   t  | ƒ d k s t ‚ t |  t ƒ  ƒ d  S(   Ni   (   t   lenR5   R   t   locals(   t   selft   anomalous_plus_suffixt   anomalous_minus_suffixt   sigmas_prefixt   sigmas_suffixt   delta_anomalous_prefixt   delta_anomalous_suffixt   delta_anomalous_isym_prefixt   delta_anomalous_isym_suffixt   phases_prefixt   phases_suffixt   hendrickson_lattman_suffix_list(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   __init__£   s    c         C   sD   | d k s t ‚ | d  k r" | S| d k r9 | |  j S| |  j S(   NR@   RB   (   NR@   RB   (   R1   R5   RX   RY   (   RW   t
   root_labelRF   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt	   anomalous²   s      c         C   s   |  j  |  j | |  j | ƒ S(   N(   Re   RZ   R[   (   RW   Rd   t   anomalous_sign(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR3   ¸   s    c         C   s   |  j  | |  j S(   N(   R\   R]   (   RW   Rd   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   delta_anomalous½   s    c         C   s   |  j  |  j | ƒ ƒ S(   N(   R3   Rg   (   RW   Rd   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   delta_anomalous_sigmasÁ   s    c         C   s   |  j  | |  j S(   N(   R^   R_   (   RW   Rd   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   delta_anomalous_isymÄ   s    c         C   s   |  j  |  j | |  j | ƒ S(   N(   Re   R`   Ra   (   RW   Rd   Rf   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   phasesÈ   s    c         C   s=   d | k o d k  n s" t  ‚ |  j | |  j | | ƒ S(   Ni    i   (   R5   Re   Rb   (   RW   Rd   t   i_coeffRf   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR*   Í   s    "N(   t   __name__t
   __module__Rc   R1   Re   R3   Rg   Rh   Ri   Rj   R*   (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRM   ¡   s$   			t   ccp4_label_decoratorc           B   s   e  Z d d  „ Z RS(   c         C   sB   | d k s t  ‚ t j d d | ƒ } |  j d | |  j | ƒ S(   Nt   FWTt   DELFWTR   RP   t   PH(   Ro   Rp   (   R5   t   ret   subRe   Ra   (   RW   Rd   Rf   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRj   Ö   s
    N(   Rl   Rm   R1   Rj   (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRn   Õ   s   c         C   sO   t  | ƒ d k r d S|  | ƒ } d | } t  | ƒ d k rK d | } n  | S(   Ni    R1   s   %.2fi   s   %12.4E(   RU   (   t   funct   valuest   valueR>   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   format_min_maxÝ   s     
 t   human_readablet   machine_readablet   spreadsheetc         C   ss   |  d  k r t d S|  j ƒ  }  x% t D] } |  j | d ƒ r' | Sq' Wt d t |  ƒ d d j t ƒ ƒ ‚ d  S(   Ni    s.   Column data format keyword not recognized: %s
s     Valid keywords are: %ss   , (   R1   t    show_column_data_format_keywordst   lowert
   startswithR   R	   t   join(   t   inputt   k(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt$   tidy_show_column_data_format_keywordé   s      t   _c           B   sé   e  Z d  „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 e
 d „ Z d d d	 „ Z d
 „  Z d d „ Z d d „ Z d d „ Z d d d „ Z d e
 d „ Z d e
 e d d „ Z d e
 e d d „ Z e e d „ Z RS(   c         C   s   t  j d |  j ƒ  ƒ S(   Nt   group(   R   t   space_group_infot   space_group(   RW   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR„   ô   s    c         C   sï   | d  k rL t j d | d d ƒ } | d  k rL d | j ƒ  j ƒ  } qL n  | j ƒ  } |  j d | ƒ |  j d | j ƒ  j ƒ  ƒ |  j d | j	 ƒ  ƒ |  j
 d | j ƒ  ƒ |  j ƒ  d k rÕ |  j
 d d	 ƒ n  |  j d
 | j ƒ  ƒ |  S(   NR„   t   lib_names	   symop.libs   No.%dt   namet   numbert   symbolt    t   ?R…   (   R1   R   t   ccp4_symbolt   typeRˆ   Rƒ   t   set_space_group_namet   set_space_group_numbert   set_point_group_namet   point_group_typet   set_lattice_centring_typet!   conventional_centring_type_symbolt   lattice_centring_typet   set_space_group(   RW   R„   R‰   Rƒ   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   set_space_group_info÷   s     			c         C   s^   |  j  ƒ  d k s t ‚ |  j d d d d d | ƒ j d d ƒ j d d d d ƒ j d d ƒ S(   Ni    R‡   t   HKL_baset   project_namet	   unit_cellt   idt
   wavelength(   t
   n_crystalsR5   t   add_crystalt   set_idt   add_dataset(   RW   R™   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   set_hkl_base	  s    	c         C   sH   d } x; |  j  ƒ  D]- } x$ | j ƒ  D] } | | j ƒ  7} q& Wq W| S(   Ni    (   t   crystalst   datasetst	   n_columns(   RW   R>   t   crystalt   dataset(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR£     s
    c         c   sN   xG |  j  ƒ  D]9 } x0 | j ƒ  D]" } x | j ƒ  D] } | Vq3 Wq  Wq Wd  S(   N(   R¡   R¢   t   columns(   RW   R¤   R¥   t   column(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR¦     s    c         C   s#   g  |  j  ƒ  D] } | j ƒ  ^ q S(   N(   R¦   RG   (   RW   R§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   column_labels  s    c         C   s#   g  |  j  ƒ  D] } | j ƒ  ^ q S(   N(   R¦   R�   (   RW   R§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   column_types"  s    c         C   s_   xX t  |  j ƒ  ƒ D]D \ } } | | k  r1 q n  | j ƒ  d k r | rS | j ƒ  S| Sq Wd  S(   NR   (   t	   enumerateR¦   R�   RG   R1   (   RW   t   i_columnt   return_labelt   iR§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   next_isym_column_starting_at%  s     
RP   c      	   C   s  | d  k r t j } n  | } | | d I|  j ƒ  IJ| | d I|  j ƒ  IJ| | d I|  j ƒ  IJ|  j ƒ  j d | d | d ƒ | | d I|  j ƒ  IJ|  j	 ƒ  d k rÕ | | d	 I|  j	 ƒ  IJn  | | d
 I|  j
 ƒ  IJ| | d I|  j ƒ  IJ|  j
 ƒ  d k rH|  j ƒ  d k rH| | d |  j ƒ  IJn  | | d IJx. |  j ƒ  D]  } | | d I| j ƒ  IJqcWx‚t |  j ƒ  ƒ D]n\ } } | | d | d IJ| | d I| j ƒ  IJ| | d I| j ƒ  IJ| | d I| j ƒ  IJ| j ƒ  j d | d | d ƒ | | d I| j ƒ  IJxÁt | j ƒ  ƒ D]­\ } } | | d | d IJ| | d I| j ƒ  IJ| | d I| j ƒ  IJ| | d | j ƒ  IJ| | d I| j ƒ  IJ| j ƒ  d k rWd d d d d d  d! g g }	 g  |	 d D] }
 t |
 ƒ ^ q} d | d" <x t | j ƒ  ƒ D]k \ } } | j d# |  j ƒ  ƒ } |	 j | ƒ x7 t | ƒ D]) \ } }
 t | | t |
 ƒ ƒ | | <q�WqOWd$ t | d%  ƒ } x/ |	 D]$ } | | | t | ƒ j ƒ  IJqÙWqWqWWqšW|  S(&   Ns   Title:s   Space group symbol from file:s   Space group number from file:t   ft   prefixs   Space group from matrices: s   Point group symbol from file:i    s   Number of batches:s   Number of crystals:s   Number of Miller indices:s   Resolution range: %.6g %.6gs   History:t    s   Crystal %d:i   s     Name:s
     Project:s     Id:s     Unit cell: s     Number of datasets:s     Dataset %d:s	       Name:s       Id:s       Wavelength: %.6gs       Number of columns:RG   s   #valids   %validt   mint   maxR�   RP   iþÿÿÿt   n_refls,       %%-%ds %%%ds %%%ds %%%ds %%%ds %%%ds %%si   (    R1   t   syst   stdoutt   titlet   space_group_namet   space_group_numberR„   t   show_summaryt   point_group_namet	   n_batchesRœ   t   n_reflectionst   max_min_resolutiont   historyt   rstripRª   R¡   R‡   R˜   Rš   R™   t   show_parameterst
   n_datasetsR¢   R›   R£   RU   R¦   t   format_fields_for_mtz_dumpt   appendR³   t   tuple(   RW   t   outR°   t   pt   linet	   i_crystalR¤   t	   i_datasetR¥   t   fields_listt   fieldt   max_field_lengthsR«   R§   t   fieldsR­   t   format(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRº   .  s\     $ #
	%-c         C   s†   |  j  ƒ  } g  } g  } x^ |  j ƒ  D]P } | j ƒ  d k rC q% n  | j | j ƒ  ƒ | j | j ƒ  | j ƒ  f ƒ q% W| | | f S(   NR   R   R   (   R   R   R   (   t   extract_miller_indicesR¦   RG   RÄ   t   extract_valuest   selection_valid(   RW   t   miller_indicesRK   t   pairsR§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   _show_column_data_preparation^  s     #c            sÔ  ˆ d  k r t j ‰ n  |  j ƒ  \ } ‰ } | j ƒ  d k rH d } n8 t d t t j t j	 | j
 ƒ  j ƒ  ƒ ƒ d ƒ ƒ } d j d | g d ƒ } d | d d ‰  ‡  ‡ ‡ f d	 †  } d } ˆ d
 IJˆ d d IJ| ƒ  xÙ t | ƒ D]Ë \ } }	 | d k rˆ J| ƒ  d } n  | |	 }
 ˆ |
 Ixz t | ƒ D]l \ } \ } } | rƒ| d d k rƒˆ J| d 7} ˆ ˆ  In  | | r¢ˆ d | | Iq@ˆ d Iq@Wˆ J| d 7} qó Wˆ d d IJ|  S(   Ni    i   s   -%dg      à?R±   s   %%%ddi   i   c             sh   ˆ ˆ  IxO t  ˆ ƒ D]A \ }  } |  rJ |  d d k rJ ˆ Jˆ ˆ  In  ˆ d | Iq Wˆ Jˆ Jd  S(   Ni   i    s   %15s(   Rª   (   R­   RG   (   t   h_blankRK   RÆ   (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   show_labelsr  s    
s   Column data:RB   iO   i   i   s   %15.6gs   %15sR1   s              None(   R1   Rµ   R¶   RÕ   t   sizeRU   t   intR   R³   t   abst   as_vec3_doublet	   as_doubleR~   Rª   (   RW   RÆ   RÓ   RÔ   t   h_widtht   h_formatR×   t   n_data_linest   ireft   ht   h_strR­   t   datat	   selection(    (   RÖ   RK   RÆ   s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   show_column_data_human_readableh  sB     	#	
	



 c         C   s5  | d  k r t j } n  |  j ƒ  \ } } } | d IJ| d It | ƒ IJ| d IJx | D] } | | IJq^ W| d I| j ƒ  IJ| d IJx’ t | ƒ D]„ \ } } | d j g  | D] } t | ƒ ^ q¼ ƒ IJxI t | ƒ D]; \ } \ }	 }
 |
 | r| d |	 | IJqä | d IJqä WqŸ W| d	 IJ|  S(
   Ns   Machine readable colum data:s   Number of columns:s   Column labels (one per line):s   Number of Miller indices:s#   Column data (HKL followed by data):R±   s   %.7gR1   s   End of column data.(	   R1   Rµ   R¶   RÕ   RU   RØ   Rª   R~   t   str(   RW   RÆ   RÓ   RK   RÔ   RG   Rà   Rá   R­   Rã   Rä   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt!   show_column_data_machine_readable’  s$     


,
 
c         C   s  | d  k r t j } n  |  j ƒ  \ } } } | d j g  d d d g | D] } | j d d ƒ ^ qK ƒ IJxž t | ƒ D]� \ } } g  | D] } t | ƒ ^ qŒ }	 xO t | ƒ D]A \ } \ }
 } | | rå |	 j d |
 | ƒ q± |	 j d ƒ q± W| d j |	 ƒ IJqy W|  S(   Nt   ,R   R   R   R‚   s   %.7gRP   (	   R1   Rµ   R¶   RÕ   R~   t   replaceRª   Ræ   RÄ   (   RW   RÆ   RÓ   RK   RÔ   RG   Rà   Rá   R­   t   rowRã   Rä   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   show_column_data_spreadsheet¤  s     2
 Rx   c         C   s,   | t  k s t ‚ t |  d | ƒ d | ƒ S(   Nt   show_column_data_RÆ   (   R{   R5   t   getattr(   RW   RÆ   RÏ   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   show_column_data±  s    c         C   s  t  t ƒ d k s t ‚ xJ |  j ƒ  D]< } | d k rF t d ƒ ‚ n  | d k r% t d ƒ ‚ q% q% W| d  k r‰ |  j ƒ  j | ƒ } n  d |  j ƒ  k rÛ |  j	 ƒ  } | j
 | ƒ } t j t  | ƒ ƒ } |  j | ƒ n |  j | j
 |  j ƒ  ƒ ƒ |  j d | ƒ xf |  j ƒ  D]X } t j j d | j ƒ  j d	 | ƒ d | d
 | d t ƒ }	 | j |	 j ƒ  j ƒ  ƒ qWx” |  j ƒ  D]† }
 t j t |
 j ƒ  ƒ ƒ } t j j d | j d	 | ƒ d | d
 | ƒ } |
 j t j | j ƒ  j ƒ  ƒ ƒ |
 j t j d ƒ ƒ q}Wd  S(   Ni   R   s8   In-place transformation of phase angles not implemented.R   sL   In-place transformation of Hendrickson-Lattman coefficients not implemented.t   M_ISYMR„   R™   t   cb_opt   assert_is_compatible_unit_cellt%   raise_sorry_if_incompatible_unit_celli    (	   i    i    i    i    i    i    i    i    i    (    RU   t   column_type_legendR5   R©   t   RuntimeErrorR1   R„   t   change_basisR¨   t%   extract_original_index_miller_indicest   applyR   RÙ   t%   replace_original_index_miller_indicest   replace_miller_indicesRÐ   R–   R¡   t   cctbxR¤   t   symmetryR™   RJ   t   set_unit_cell_parameterst
   parameterst   batchesR   t   listt   cellt   set_cellt   floatt   set_umat(   RW   Rð   t   new_space_group_infoRñ   t   column_typet   original_miller_indicest   indicest   isymR¤   t   crystal_symmetryt   batcht   batch_uct   batch_crystal_symmetry(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   change_basis_in_placeµ  sF    		c         C   sú  | } | d  k r' t j d d ƒ } n  g  } xÆ|  j ƒ  D]¸} y | j ƒ  } Wn% t k
 rw }	 t t |	 ƒ ƒ ‚ n Xt j	 j
 d | d |  j ƒ  d t ƒ }
 |
 j d | d | ƒ } x8| j ƒ  D]*} | j d | j ƒ  ƒ } |  j d	 |
 d
 | d | d | ƒ } xå | D]Ý } | rÝt | j ƒ  t j ƒ rÝt | j ƒ  t j ƒ rÝ| j ƒ  j ƒ  d k rÝt j | j ƒ  ƒ d k rÝ| j ƒ  j ƒ  } | j ƒ  j ƒ  | j ƒ  j ƒ  k rÝ| j | j ƒ  j d t ƒ ƒ | } qÝn  | j | ƒ qWqÄ Wq: W| S(   Nt   source_typet   ccp4_mtzR™   R„   Rò   t   other_symmetryt   forceR›   t   crystal_symmetry_from_fileR	  t   base_array_infoR¥   i    t   merged(   R1   R   t
   array_infoR¡   R™   t
   ValueErrorR   Ræ   Rú   R¤   Rû   R„   RJ   t   join_symmetryR¢   t   customized_copyR›   t   group_columnst
   isinstanceRã   R   t   doubleR3   RØ   R²   t   merge_equivalentst   arrayR  t   set_infot   infoRÄ   (   RW   R	  t   force_symmetryR  R  R  R>   R¤   R™   t   eR  R¥   t   base_dataset_infot   column_groupst   column_groupt   merged_column_group(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   as_miller_arraysâ  sL    						c         C   sõ   |  j  | | | | ƒ } g  } xd |  j ƒ  D]V } xM | j ƒ  D]? } x6 | j ƒ  D]( }	 | j | j ƒ  | j ƒ  |	 f ƒ qQ Wq> Wq+ Wi  }
 t | ƒ } xW | D]O } xF | j ƒ  j D]5 }	 x, | D]$ } |	 | d k rÁ | |
 | <PqÁ qÁ Wq´ Wqž W|
 S(   s  
    Returns a python dictionary with keys of tuples containing
    (crystal name, dataset name, column label) and values of
    the Miller arrays from :func:`as_miller_arrays`.

    The arguments to :func:`as_miller_arrays_dict` are the same
    as :func:`as_miller_arrays`.

    >>> miller_dict = mtz_file.as_miller_arrays_dict()
    >>> miller_dict[('NATIVE', 'NATIVE', 'FTOXD3')]
    <cctbx.miller.array at 0x108a87b90>
    >>> miller_dict[('NATIVE', 'NATIVE', 'SIGFTOXD3')]
    <cctbx.miller.array at 0x108a87b90>
    i   (	   R&  R¡   R¢   R¨   RÄ   R‡   t   iterR  RK   (   RW   R	  R   R  R  t   miller_arrayst   keysR¤   R¥   RG   t   miller_dictt   ikeysR=   t   key(    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   as_miller_arrays_dict  s$    		.
c            sÃ  d j  t j ƒ  ƒ } t | ƒ d k s- t ‚ | j ƒ  ‰ | j ƒ  ‰  t | j ƒ  ˆ  ƒ ‰ t	 g t ˆ ƒ ‰ g  } d ‰ xCˆ d 7‰ ˆ t ˆ ƒ k rœ Pn  ˆ ˆ r¬ q| n  ˆ ˆ }	 | ró |	 j
 ƒ  | k ró t d |	 j
 ƒ  |	 j ƒ  f ƒ ‚ n  ˆ ˆ }
 |
 d k rq| n  ˆ  ˆ } ˆ ˆ } d  } d  } d  } |
 d k rÔt | ƒ d k r¶| d |
 k r¶t d | ƒ r¶t d	 ˆ  ˆ d ƒ r¶ˆ  ˆ ˆ d
 !} ˆ d 7‰ |  j | Œ  } q‚| g } |  j d | ƒ } n®|
 d k rþ| g } |  j d | ƒ } n„|
 d k rÛˆ ˆ ˆ d !d k r"t | ƒ d k r«| d d !d k r«t d ˆ  ˆ ˆ d !ƒ r«t d	 ˆ  ˆ d ˆ d !ƒ r«ˆ  ˆ ˆ d !} ˆ d 7‰ |  j | Œ  } qØˆ  ˆ ˆ d !} t d ˆ  ˆ ˆ d
 !ƒ rt d	 ˆ  ˆ d
 ˆ d !ƒ r|  j | Œ  } n |  j | Œ  } ˆ d 7‰ q‚ˆ ˆ ˆ d
 !d k rfˆ  ˆ ˆ d
 !} ˆ d 7‰ |  j | Œ  } q‚t d d d j  g  ˆ  ˆ ˆ d !D] } d | ^ qˆƒ d d j  g  ˆ ˆ ˆ d !D] } d | ^ q»ƒ ƒ ‚ n§| d  d k r‚ˆ  ˆ ˆ d !} ‡  ‡ ‡ ‡ ‡ f d †  } | j | ƒ  ƒ ˆ d 7‰ t | ƒ | g } |  j | Œ  } | d d  k rp| j ƒ  n  t j j ƒ  } n |
 d k rN| g } ˆ d t ˆ ƒ k  r9ˆ ˆ d d k r9ˆ  ˆ ˆ d
 !} ˆ d 7‰ ˆ ˆ d k rþ|  j | Œ  } qK|
 d k r't d d  t | ƒ ƒ ‚ n  |  j  | Œ  } q‚|  j d | ƒ } n4|
 d! k rjd  } | d  d5 k r…d% d d
 d g } nX | d  d6 k rªd% d
 d d g } n3 | d
  d7 k rÉd% d g } n t d+ d, | ƒ ‚ g  | D] } ˆ  ˆ | ^ qä} ˆ t | ƒ d 7‰ t | ƒ d
 k r6|  j! | Œ  } q‚d- | d  k rX|  j" | Œ  } q‚|  j# | Œ  } n | g } |  j | ƒ } | j t$ d. | d/ | d0 | d1 |
 d2 | d3 | d4 | ƒ ƒ q| | S(8   NRP   i   iÿÿÿÿi   s2   Unknown MTZ column type: "%s" (column label: "%s")R   t   BYIR@   RB   i   t   column_labelR#   R   i   R0   i   i   i   t   AAsF   Invalid MTZ column combination (incomplete Hendrickson-Lattman array),s    column labels: s   , s   "%s"s    column types: t   FQDQc             sŽ   x‡ t  ˆ d t ˆ ƒ ƒ D]l }  ˆ |  d k r ˆ |  j ƒ  } | j ƒ  d k r‚ | j d ƒ r‚ | j d ƒ r‚ t ˆ |  <ˆ  |  SPq q Wd  S(   Ni   R   i    i   (   t   xrangeRU   t   extract_valid_valuesRØ   t   all_get   all_leRJ   R1   (   t   jt   vv(   t   all_column_labelst   all_column_prev_use_flagst   all_column_typest   all_columnsR«   (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   next_isym_column_label†  s     0
t   JFEDt   QPR   R   s9   Invalid MTZ column combination (intensity + phase angle),s    column labels: "%s" + "%s"t   GKt   GLGLt   GPGPt   KMKMi    t   GGLLt   GGPPt   KKMMt   GGt   KKs   Invalid MTZ column combination:s1    incomplete anomalous data for column label: "%s"R   R  R	  R  t   primary_column_typeRK   Rƒ   t   observation_type(   R@  RA  RB  (   RC  RD  RE  (   RF  RG  (%   R~   Ró   R)  RU   R5   R¦   R¨   t*   mend_non_conforming_anomalous_column_typesR©   RI   R�   Rô   RG   R1   RH   t   extract_integers_anomaloust   extract_integerst   extract_realsRL   t%   extract_hendrickson_lattman_anomaloust-   extract_hendrickson_lattman_anomalous_ab_onlyt   extract_hendrickson_lattmant#   extract_hendrickson_lattman_ab_onlyRÄ   Rÿ   t   extract_delta_anomaloust   popR   t   observation_typest   reconstructed_amplitudet   extract_observationsRÅ   t   extract_complext   extract_reals_anomaloust   extract_complex_anomaloust   extract_observations_anomalousR$  (   RW   R  R	  R  R¥   t   strictt   skip_incompatible_valuest   known_mtz_column_typest   groupsR§   t   t0t   l0t   remaining_typesRK   Rƒ   RI  t   lt   tR<  t   cpp_argst   permR­   (    (   R8  R9  R:  R;  R«   s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR  4  sð    
 
 

 


		

C/	
 	
!	N(   Rl   Rm   R„   R1   R–   R    R£   R¦   R¨   R©   RI   R®   Rº   RÕ   Rå   Rç   Rë   Rî   R  RJ   R&  R-  R  (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR‚   ò   s4   								0	
*+)'c   
   	   C   s–  | j  j ƒ  | j j ƒ  k s$ t ‚ t | d d  ƒ } | d  k	 rf | j ƒ  | j j ƒ  k sf t ‚ n  | j rÉ t j d | d | j d t	 ƒ } | j
 ƒ  d k rð t j d | d | j d t ƒ } qð n' t j d | d | j ƒ j d d ƒ } | j d	 | j  d | ƒ j | j d
 | d |  d t j | ƒ ƒ ƒ }	 | d  k	 rQ|	 j | ƒ nA |	 j ƒ  s’| d k rv|	 j ƒ  q’| d k r’|	 j ƒ  q’n  |	 S(   NR3   R	  R  R6   i    t   min_fraction_bijvoet_pairsi   g      @Rã   RK   R  t   type_hints_from_filet   FGt   JKgUUUUUUå?(   Rã   RØ   R  R5   Rí   R1   R6   R   t   setRJ   t   n_bijvoet_pairsRI   t   auto_anomalousR  R  R  t&   column_type_as_miller_array_type_hintst   gett   set_observation_typeR2   t#   set_observation_type_xray_amplitudet#   set_observation_type_xray_intensity(
   R  R	  R  RH  RK   Rƒ   RI  R3   t
   miller_setR>   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR$  Ð  sB    $ $											c            sÕ   i d d 6d d 6d d 6d d 6d	 d
 6d d 6‰ ‡  ‡ ‡ f d †  } ‡ ‡ f d †  } d j  |  ƒ }  |  ‰ xb | ƒ  \ ‰ ‰ ˆ d  k rŽ Pn  | ƒ  r¶ ˆ ˆ } t |  ˆ | ƒ }  n d } t ˆ ˆ | ƒ ‰ qo |  S(   NRB  t   JQJQR@  t   FQFQRE  t   JJQQRC  t   FFQQRA  t   FPFPRD  t   FFPPc             s{   ˆ d d k r d d	 f }  n d
 d f }  xI t  |  d ƒ D]8 \ } } x) | D]! } t | ˆ  ˆ | ƒ sN t SqN Wq; Wt S(   Ni   R   i    i   i   R@   RB   (   i    i   (   i   i   (   i    i   (   i   i   (   R@   RB   (   t   zipRH   RI   RJ   (   t   permutationt   offsetsRF   t   offs(   t
   all_labelst   group_typest   i_group_start(    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRL     s    c             s@   x9 ˆ j  ƒ  D]+ }  ˆ  j |  ƒ } | d k r |  | f Sq Wd S(   Ni    (   NN(   R)  t   findR1   (   R~  R  (   t   all_types_xt   replacements(    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt
   find_group  s
    RP   t   X(   R~   R1   R
   (   t	   all_typesR}  RL   Rƒ  t   replacement(    (   R}  R�  R~  R  R‚  s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRJ  ü  s*    
	
c           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s]   y |  j  ƒ  } Wn% t k
 r7 } t t | ƒ ƒ ‚ n Xt j j d | d |  j ƒ  j ƒ  ƒ S(   NR™   R„   (	   R™   R  R   Ræ   Rú   R¤   Rû   t
   mtz_objectR„   (   RW   R™   R!  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR	  ,  s    c         C   s.   t  j d |  j ƒ  d |  j ƒ  j ƒ  d | ƒ S(   NR	  R  R6   (   R   Rj  R	  R‡  RÐ   (   RW   R6   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRr  5  s    	N(   Rl   Rm   R	  R1   Rr  (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR‚   *  s   		c           B   sD   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d d d „ Z RS(   c         C   s#   g  |  j  ƒ  D] } | j ƒ  ^ q S(   N(   R¦   RG   (   RW   R§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR¨   =  s    c         C   s#   g  |  j  ƒ  D] } | j ƒ  ^ q S(   N(   R¦   R�   (   RW   R§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR©   @  s    c         C   sF   |  j  ƒ  j ƒ  d k rB x' d D] } |  j d | d d ƒ q Wn  d  S(   Ni    t   HKLRG   R�   R   (   R‡  R£   t
   add_column(   RW   RG   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   initialize_hkl_columnsC  s    c         C   sm   |  j  d | d | d ƒ j d | d | ƒ } | d  k	 ri |  j  d | d | d ƒ j d | d | ƒ n  d  S(   NRG   R�   i    RÓ   Rã   i   t   mtz_reflection_indices(   R‰  t	   set_realsR1   (   RW   t
   data_labelt   sigmas_labelR©   R  Rã   R3   R‹  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   _add_observationsH  s    			c         C   ss   |  j  d | d | d ƒ j d | d t j | ƒ ƒ } |  j  d | d | d ƒ j d | d t j | t ƒ ƒ d  S(   NRG   R�   i    RÓ   Rã   i   R‹  (   R‰  RŒ  R   RÚ   t   argRJ   (   RW   t   amplitudes_labelt   phases_labelR©   R  Rã   R‹  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   _add_complexV  s    		c   "      C   s	  | d  k s! t | t ƒ s! t ‚ | d  k r@ t ƒ  d ƒ  } n  t d | ƒ } | d  k rj t d ƒ ‚ n  | d  k r | } n' t | ƒ t | ƒ k r¦ t d ƒ ‚ n  |  j ƒ  | j	 ƒ  sº| d& k r|  j
 d | d | j | ƒ d	 | d
 | j ƒ  d | j ƒ  d | j ƒ  ƒ q| d k r`|  j d | d | j | ƒ d	 | d
 | j ƒ  d | j ƒ  ƒ q| d' k r£|  j d | d | ƒ j d | j ƒ  d | j ƒ  ƒ q| d k rì|  j d | d | ƒ j d | j ƒ  d | j ƒ  j ƒ  ƒ q| d k r«|  j d | j | d ƒ d | d ƒ j d | j ƒ  d | j ƒ  j d ƒ ƒ } xm t d d ƒ D]M } |  j d | j | | ƒ d | | ƒ j d | d | j ƒ  j | ƒ ƒ qWWqt d ƒ ‚ nK| j ƒ  \ } }	 | d k r‚|	 j }
 |
 d ƒ } |
 d ƒ } |	 j }
 |
 d ƒ } |
 d ƒ } | j ƒ  }
 |
 j | ƒ } |
 j | ƒ } |
 j | ƒ } | j |
 j | ƒ ƒ d | | } | | } | j ƒ  }
 |
 j | ƒ } |
 j | ƒ } |
 j | ƒ } | j |
 j | ƒ ƒ t j | d  | d  ƒ } d | } | j | ƒ | j | ƒ | j ƒ  }
 |
 j | ƒ } | j |
 j | ƒ ƒ } | j |
 j | ƒ ƒ t j | j ƒ  d ƒ } | j  | j ƒ  | j ƒ  d ƒ | j  | j ƒ  d  ƒ | j! | j" ƒ  j# | ƒ d ƒ | | j | ƒ | j$ | ƒ | j% | ƒ | j& | ƒ g } xt' | | f | | f | | f | | f | | f g ƒ D]B \ } \ } } |  j d | | d | | ƒ j d | d | ƒ q9Wnƒx€d( D]x} |	 j | ƒ }  |  j |	 j | ƒ ƒ | d k rØ| j ƒ  j |  ƒ }! n | j ƒ  j |  ƒ }! | j ƒ  j |  ƒ } | d) k rg|  j
 d | j( | | ƒ d | j | | ƒ d	 | d
 |! d | d | j ƒ  j |  ƒ ƒ q‰| d# k r¶|  j d | j( | | ƒ d | j | | ƒ d	 | d
 |! d | ƒ q‰| d* k rù|  j d | j( | | ƒ d | ƒ j d |! d | ƒ q‰| d k rB|  j d | j( | | ƒ d | ƒ j d |! d | j ƒ  ƒ q‰| d k rõ|  j d | j | d | ƒ d | d ƒ j d |! d | j d ƒ ƒ } xj t d d ƒ D]J } |  j d | j | | | ƒ d | | ƒ j d | d | j | ƒ ƒ q¤Wq‰t d ƒ ‚ q‰W|  S(+   NRM   R=   sH   Conversion of given type of miller_array to MTZ format is not supported.s4   Invalid MTZ column_types for the given miller_array.t   FQt   JQR�  RŽ  R©   R  Rã   R3   R.   R‘  R’  R   R   RG   R�   RÓ   R!   R0   i    i   i   R‹  s   Fatal programming error.R/   R@   RB   g      à?i   t   GLt   KMR-   R   R   (   R”  R•  (   R   R   (   R@   RB   (   R–  R—  (   R   R   ()   R1   R  Ræ   R5   t   globalsR?   Rô   RU   RŠ  R6   R�  R3   R  Rã   R“  Rj   R‰  RŒ  RÜ   R*   t   sliceR2  t   match_bijvoet_matest   pairs_hemisphere_selectiont   singles_hemisphere_selectiont   selectt   extendR   t   sqrtt   concatenateR  RØ   t   resizet   set_selectedR…   t
   is_centricRg   Rh   Ri   Rª   Re   ("   RW   R=   t   column_root_labelR©   RM   t   default_col_typesR‹  R­   t   asut   matchesR‚   t   selppt   selpmt   selspt   selsmt   fpt   fmt   fsR¯   t   dt   spt   smt   sst   sdt   sft   hdt   hfR  t   label_groupt   miRã   Rf   t   selR  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   add_miller_arrayc  s.   !	
								

 L	
$		
	
			N(	   Rl   Rm   R¨   R©   RŠ  R�  R“  R1   Rº  (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR‚   ;  s   					t!   column_values_and_selection_validc           B   s&   e  Z d  d g Z d „  Z d „  Z RS(   Ru   RÒ   c         C   s   | |  _  | |  _ d  S(   N(   Ru   RÒ   (   t   ORu   RÒ   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRc     s    	c         C   s   |  j  |  j f S(   N(   Ru   RÒ   (   R¼  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   as_tuple  s    (   Rl   Rm   t	   __slots__Rc   R½  (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR»    s   	c           B   s   e  Z d  d „ Z d „  Z RS(   i    c         C   s%   t  d |  j d | ƒ d |  j ƒ  ƒ S(   NRu   t   not_a_number_substituteRÒ   (   R»  RÑ   RÒ   (   RW   R¿  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt"   extract_values_and_selection_valid  s    		c      	   C   sŠ   |  j  ƒ  } |  j ƒ  d | j ƒ  d d | j ƒ  t d | ƒ t t j | ƒ t t j | ƒ |  j ƒ  d t j	 |  j ƒ  d ƒ g } | S(   Ns   %ds   %.2f%%g      Y@i   t   :s   *** UNDEFINED column type ***(
   R3  RG   RØ   R³   Rw   R   R²   R�   Ró   Rn  (   RW   R´   t   valid_valuesRÎ   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyRÃ     s    	(   Rl   Rm   RÀ  RÃ   (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR‚     s   R¤   t   projectR¥   g        c	      	   C   s
  | d  k r! t |  j ƒ  ƒ } n  | d  k r6 d } n  |  j ƒ  }	 |	 d  k r` t j d ƒ }	 n  |  j ƒ  }
 |
 d  k r� t j d d ƒ }
 n  t ƒ  j d | ƒ j	 d |
 ƒ } | j
 d |	 ƒ | j d	 | d
 | d |	 ƒ j d	 | d | ƒ j d |  d | d | d | ƒ S(   Ns   cctbx.miller.arrayi   iZ   R‰   s   P 1R·   R„   R™   R‡   R˜   R›   R=   R¤  R©   RM   (   i   i   i   iZ   iZ   iZ   (   R1   Ræ   R  R™   R   R„   R   RN   t	   set_titleR–   R    R�   RŸ   Rº  (   RW   R¤  R©   RM   R·   t   crystal_nameR˜   t   dataset_nameR›   R™   R„   R‡  (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   miller_array_as_mtz_dataset(  s0    				c           B   s   e  Z d d  „ Z RS(   c         C   sh  | d  k r t j } n  | d I|  j ƒ  IJ| d I|  j ƒ  j ƒ  IJ| d It |  j ƒ  ƒ IJ| d I|  j ƒ  IJ| d It |  j	 ƒ  ƒ IJ| d I|  j
 ƒ  IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d	 I|  j ƒ  IJ| d
 I|  j ƒ  IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d It |  j ƒ  ƒ IJ| d It |  j ƒ  ƒ IJ| d IJ| d It |  j ƒ  ƒ IJ| d It |  j ƒ  ƒ IJ| d It |  j ƒ  ƒ IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d It |  j ƒ  ƒ IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d I|  j ƒ  IJ| d I|  j  ƒ  IJ| d I|  j! ƒ  IJ| d  I|  j" ƒ  IJ| d! I|  j# ƒ  IJ| d" IJ| d# It |  j$ ƒ  ƒ IJ| d$ It |  j% ƒ  ƒ IJ| d% It |  j& ƒ  ƒ IJ| d& It |  j' ƒ  ƒ IJ| d' It |  j( ƒ  ƒ IJ| d( I|  j) ƒ  IJ| d) I|  j* ƒ  IJ| d* I|  j+ ƒ  IJ| d+ I|  j, ƒ  IJ| d, I|  j- ƒ  IJ| d- It |  j. ƒ  ƒ IJ| d. It |  j/ ƒ  ƒ IJ| d/ It |  j0 ƒ  ƒ IJd  S(0   Ns   batch number:s   batch title:s   names of the three axes:s   type of orientation block:s   refinement flags for cell:s#   number of phixyz used (0, 1, or 2):s)   reciprocal axis closest to rotation axis:s   crystal number:s0   mosaicity model: 0 = isotropic, 1 = anisotropic:s*   type of data: 2D (1), 3D (2), or Laue (3):s   goniostat scan axis number:s/   number of batch scales & Bfactors (0 if unset):s   number of goniostat axes:s   flag for type of beam info:s5     0: for alambd, delamb; 1: also delcor, divhd, divvds(   number of detectors (current maximum 2):s   dataset id:s   cell dimensions:s   orientation matrix U:s-     in Fortranic order, i.e. U(1,1), U(2,1) ...s6   missetting angles at beginning and end of oscillation:s
   mosaicity:s   datum values of goniostat axes:s   start of phi relative to datum:s   end of phi relative to datum:s   rotation axis in lab frame:s   start time:s
   stop time:s   batch scale:s   batch temperature factor:s
   sd bscale:s	   sd bbfac:s
   phi range:sE   vectors ("Cambridge" laboratory axes) defining ngonax goniostat axes:s     vector 1:s     vector 2:s     vector 3:s   idealised source vector:s   source vector:s   wavelength (A):s"   dispersion (deltalambda / lambda):s   correlated component:s   horizontal beam divergence:s   vertical beam divergence:s   xtal to detector distance:s   detector tilt angle:s-   min & max values of detector coords (pixels):(1   R1   Rµ   R¶   t   numR·   RÀ   Rÿ   t   gonlabt   iortypt   lbcellt   misflgt   jumpaxt   ncrystt   lcrflgt   ldtypet   jsaxst   nbscalt   ngonaxt   lbmflgt   ndett   nbsetidR   t   umatt   phixyzt   crydatt   datumt   phisttt   phiendt   scanaxt   time1t   time2t   bscalet   bbfact   sdbscalet   sdbfact   phiranget   e1t   e2t   e3t   sourcet   sot   alambdt   delambt   delcort   divhdt   divvdt   dxt   thetat   detlm(   RW   RÆ   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   showL  sj     






N(   Rl   Rm   R1   Rò  (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyR‚   J  s   c         C   s<  t  d |  ƒ } g  } d d d g } xC | j ƒ  D]5 } | j | j d | ƒ ƒ | j | j ƒ  j ƒ q1 W| d j d d ƒ } x> t | d	 d
 d	 ƒD]& \ } } | j	 | d t
 j | ƒq— W| j ƒ  }	 t t |	 j ƒ  ƒ ƒ t | ƒ k s÷ t ‚ x1 t |	 j ƒ  ƒ D] \ } }
 |
 j | | ƒ q
W|	 j |  ƒ d S(   sÔ   
  Utility function for applying a global resolution cutoff to an MTZ file
  without reference to the contents.  This is only used internally in cases
  where the input MTZ has already been processed by CCTBX.
  t	   file_nameR   R   R   t   d_mini    R¤  R   i   t   startN(   RN   R&  RÄ   t   resolution_filterRž  R  RK   t   as_mtz_datasetRª   Rº  t   stringt	   uppercaseR‡  RU   Rÿ   R¦   R5   t	   set_labelt   write(   Ró  t	   d_min_cutt   mtz_int
   cut_arraysRK   R=   t   mtz_datasetR€   t   other_arrayt   mtz_objR§   (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   cutoff_dataƒ  s    #*(G   t
   __future__R    t   cctbx.array_family.flexRú   t   boost.pythont   boostt   pythont
   import_extt   extR   t	   iotbx.mtzR   R   t   cctbx.xray.observation_typesR   t   cctbx.crystalR   R   t   cctbx.array_familyR   t   libtbx.str_utilsR	   R
   R   t   libtbx.utilsR   t   libtbxR   R   t   warningsRø  Rr   Rµ   t   ost   expected_cmtz_struct_sizesRÅ   t   cmtz_struct_sizest   warnRæ   R‡   t   platformt   platform_infot   column_type_legend_sourceRó   Rm  t   sortedR)  R5   R?   RE   RH   RL   t   __builtins__RM   Rn   Rw   R{   R�   t   injectorRN   R‚   R$  RJ  R¤   R¥   R»  R§   R1   RÇ  R
  R  (    (    (    s@   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/mtz/__init__.pyt   <module>   sÌ   


	-		4				"ÿ ß	,	.""Í""9