ó
Ü™xTc           @   s_   d  d l  m Z d  d l m Z d  d l Z d „  Z d „  Z e d k r[ e ƒ  e ƒ  n  d S(   iÿÿÿÿ(   t   division(   t   null_outNc          C   sú  d d l  m }  d d  l } d d  l } d d l m } |  j d ƒ \ } } d } | j j j	 d | d | d | d	 t
 d
 t ƒ  ƒ t j j | ƒ sœ t ‚ | | ƒ } t | j j ƒ d k sÆ t ‚ | | ƒ } | j j } | j j ƒ  }	 | | ƒ }
 |
 j j d } |
 j j d } | j d | j ƒ  d k ƒ } | j j d | d | d d d |	 g d t
 d t ƒ } | j j j d | d | d t ƒ  ƒ } | j d k s©t ‚ d } d } | j | ƒ | j | ƒ x$ | | | g D] } t j | ƒ qßWd  S(   Niÿÿÿÿ(   t   make_fake_anomalous_data(   t   any_filet   tst_map_utilss   tst_map_utils_1.mtzt   pdb_filet   mtz_filet   output_filet   fillt   outi   i    i   t   datat   f_obst   r_free_flagst   scattering_tablet
   n_gaussiant   xray_structurest   bulk_solvent_correctiont   skip_twin_detectiont   fmodelt   pdb_hierarchyt   logs   tst_map_utils_2.mtzs   tst_map_utils_2.pdb(   t   mmtbx.regressionR   t   mmtbx.maps.utilst   mmtbx.utilst   iotbx.file_readerR   t   generate_calcium_inputst   mapst   utilst   create_map_from_pdb_and_mtzt   FalseR   t   ost   patht   isfilet   AssertionErrort   lent   file_servert   miller_arrayst   file_objectt	   hierarchyt   xray_structure_simplet   customized_copyR
   t   fmodel_simplet   Truet   generate_water_omit_mapt   n_waterst   write_map_coeffst   write_pdb_filet   remove(   R   t   mmtbxR   R   R   t   mfn1t   maps_int   pdb_inR&   t   xrst   mtz_inR   t   flagsR   t   omitt   mfn2t   pdbfn2t   fn(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/maps/tst_utils.pyt
   exercise_1   sR    
		c    
   	   C   s&  d d  l  }  d d  l } d } d } |  j j d d  d | ƒ } | j d d ƒ |  j j d d  d | ƒ j ƒ  j d d	 ƒ j ƒ  } d
 d d „  ƒ  Y} | j	 d | ƒ  j
 ƒ  d | ƒ  ƒ } | j d t | ƒ d d ƒ | j ƒ  } | j d d ƒ d }	 | j j j d d d d d |	 d t ƒ  ƒ d  S(   Niÿÿÿÿs|  
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1       4.271   0.000   0.000  1.00  5.00           C
HETATM    2  ?    ?      2       5.729   0.000   0.000  1.00  5.00           ?
HETATM    1  X    D      1       4.271   0.000   0.000  1.00  5.00           X
HETATM    1  Z    E      1       4.271   0.000   0.000  1.00  5.00           Z
END
s�   
CRYST1   10.000   10.000   10.000  90.00  90.00  90.00 P 1
HETATM    1  C    C      1       4.271   0.000   0.000  1.00  5.00           C
END
t   source_infot   linest	   file_names   tst_exercise_2_map_utils.pdbt   d_mini   t   dummyc           B   s   e  Z d  „  Z d d „ Z RS(   c         S   s   d S(   Nt   2FOFCWT(    (   t   self(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/maps/tst_utils.pyt
   amplitudesH   s    c         S   s   d S(   Nt	   PH2FOFCWT(    (   RB   t
   root_label(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/maps/tst_utils.pyt   phasesI   s    N(   t   __name__t
   __module__RC   t   NoneRF   (    (    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/maps/tst_utils.pyR@   G   s   	t   column_root_labelt   label_decoratort   miller_arrayt   FOBS_Xs   tst_exercise_2_map_utils.mtzs#   tst_exercise_2_map_utils_output.mtzR   R   R   R	   (    (   t	   iotbx.pdbR   t   pdbt   inputRI   R.   R'   t   structure_factorst   f_calct   as_mtz_datasetRC   t   add_miller_arrayt   abst
   mtz_objectt   writeR   R   R   R   (
   t   iotbxR0   t   pdb_str1t   pdb_str2t   pdb_inpt   fcR@   t   mtz_datasetRV   R1   (    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/maps/tst_utils.pyt
   exercise_23   s(    !t   __main__(   t
   __future__R    t   libtbx.utilsR   R   R;   R^   RG   (    (    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/maps/tst_utils.pyt   <module>   s   	-	#