ó
¼™xTc           @   su   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 „  Z e d k rq e ƒ  n  d S(   iÿÿÿÿ(   t   division(   t   Exception_expected(   t   null_outt   Sorry(   t   StringIONc          C   sÄ  d d l  m }  d d l m } d d  l } d d l m } d d l m } |  d d ƒ \ } } | j	 | ƒ } | j
 j } | j
 j ƒ  }	 | j	 | ƒ }
 |
 j j d } | j ƒ  } |
 j j d	 } | j d
 | j ƒ  d	 k ƒ } | j j d | d | d |	 g d d d t ƒ } | j ƒ  s&t ‚ | j d d ƒ } | j d | j ƒ  d d ƒ | j d | j ƒ  j ƒ  j d t ƒ d d d d ƒ | j d | j d
 | j | j ƒ  j ƒ  d ƒ d d  ƒ j d  ƒ d d d d ƒ | j d d ƒ } | j d d ƒ } | j d d  ƒ } | j d | j ƒ  d d! ƒ | j d | j d d" ƒ d d# ƒ | j d | j d d  ƒ d d$ ƒ | j | d d% ƒd& } | j  ƒ  j! | ƒ | j" | | g d' t# ƒ  ƒ} g  | D]$ \ } } t$ j% j& | ƒ | f ^ q¾} | d8 d9 d: d; g k st ‚ | j" | g d' t# ƒ  ƒ} g  | D]$ \ } } t$ j% j& | ƒ | f ^ q(} | | k sjt | ƒ ‚ | j" | | d- g d' t# ƒ  ƒ} g  | D]$ \ } } t$ j% j& | ƒ | f ^ q’} | d< d= d> d? d@ g k sÝt ‚ y% | j" | d0 d1 g d' t# ƒ  ƒ} Wn t' k
 rn Xt( ‚ y% | j" | | d2 g d' t# ƒ  ƒ} Wn+ t' k
 rn} t) | ƒ d3 k sut ‚ n Xt( ‚ t* ƒ  } | j" | d& d4 g d' | ƒ| j+ ƒ  j, d5 ƒ d6 k s»t ‚ d7 GHd  S(A   Niÿÿÿÿ(   t   generate_cd_cl_inputs(   t   mtz2map(   t   file_reader(   t   flext	   file_baset   tst_mmtbx_mtz2mapi    i   t   datat   f_obst   r_free_flagst   xray_structurest   scattering_tablet
   n_gaussiant   skip_twin_detectiont   column_root_labelt   Ft   miller_arrayt   FMODELt   degt   PHIt   column_typest   Pgffffffî?t   sigmast   FOMt   Wt   map_types   2mFo-DFcs   mFo-Dfct   anomt   2FOFCWTs   mFo-DFct   FOFCWTt   ANOMt
   FreeR_flags    tst_mmtbx_mtz2map_map_coeffs.mtzt   logs*   tst_mmtbx_mtz2map_map_coeffs_2mFo-DFc.ccp4s   CCP4 maps)   tst_mmtbx_mtz2map_map_coeffs_mFo-DFc.ccp4s&   tst_mmtbx_mtz2map_map_coeffs_anom.ccp4s#   tst_mmtbx_mtz2map_map_coeffs_4.ccp4s   include_fmodel=Trues(   tst_mmtbx_mtz2map_map_coeffs_fmodel.ccp4s#   tst_mmtbx_mtz2map_map_coeffs_5.ccp4s   1yjp_mtz2map_map_coeffs.mtzs,   output.directory=1yjp_mtz2map_map_coeffs.mtzs   selection="resname ZN"s0   No atoms found matching the specified selection.s   r_free_flags.remove=Trues   R-free flagged reflectionsi   t   OK(   s*   tst_mmtbx_mtz2map_map_coeffs_2mFo-DFc.ccp4s   CCP4 map(   s)   tst_mmtbx_mtz2map_map_coeffs_mFo-DFc.ccp4s   CCP4 map(   s&   tst_mmtbx_mtz2map_map_coeffs_anom.ccp4s   CCP4 map(   s#   tst_mmtbx_mtz2map_map_coeffs_4.ccp4s   CCP4 map(   s(   tst_mmtbx_mtz2map_map_coeffs_fmodel.ccp4s   CCP4 map(   s*   tst_mmtbx_mtz2map_map_coeffs_2mFo-DFc.ccp4s   CCP4 map(   s)   tst_mmtbx_mtz2map_map_coeffs_mFo-DFc.ccp4s   CCP4 map(   s&   tst_mmtbx_mtz2map_map_coeffs_anom.ccp4s   CCP4 map(   s#   tst_mmtbx_mtz2map_map_coeffs_5.ccp4s   CCP4 map(-   t)   mmtbx.regression.make_fake_anomalous_dataR   t   mmtbx.command_lineR   t   mmtbx.utilst   iotbxR   t   scitbx.array_familyR   t   any_filet   file_objectt	   hierarchyt   xray_structure_simplet   file_servert   miller_arrayst   average_bijvoet_matest   customized_copyR   t   utilst   fmodel_simplet   Truet   anomalous_flagt   AssertionErrort   as_mtz_datasett   add_miller_arrayt   f_modelt   phasest   doublet   sizet   Nonet   set_observation_typet   map_coefficientst
   mtz_objectt   writet   runR   t   ost   patht   basenameR   R   t   strR   t   getvaluet   count(   R   R   t   mmtbxR   R   t   mtz_filet   pdb_filet   pdb_inR,   t   xrst   mtz_inR   t
   f_obs_meant   flagst   fmodelt   mtz_datat   two_fofc_mapt   fofc_mapt   anom_mapt   map_filet	   file_infot   fnt   desct   file_info_2t   file_info_3t   st   out(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/regression/tst_mtz2map.pyt   exercise   s°    									111		!t   __main__(   t
   __future__R    t   libtbx.test_utilsR   t   libtbx.utilsR   R   t	   cStringIOR   t   os.pathRC   R^   t   __name__(    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/regression/tst_mtz2map.pyt   <module>   s   	g