ó
ª™xTc           @   sk   d  d l  m Z d  d l Z d  d l Z d e f d „  ƒ  YZ d „  Z e d k rg e e j	 d ƒ n  d S(   iÿÿÿÿ(   t   divisionNt	   phil_legoc           B   sV   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   sf   
This class facilitates the construction of phil parameter files
for the FA estimation program FATSO.
c         C   sg   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d	 |  _ d
 |  _	 d |  _
 d  S(   Nt   1sW    scaling.input{
__REPLACE__

expert_level=0
.type=int
.expert_level=__EXPERT_LEVEL__
}
sl   basic{
  n_residues=None
  .type=float
  n_bases=None
  .type=float
  n_copies_per_asu=None
  .type=float
}
sg   xray_data{
  unit_cell=None
  .type=unit_cell

  space_group=None
  .type=space_group

  __REPLACE__
}
sK   __REPLACE__{
  file_name=None
  .type=path
  labels=None
  .type=strings
}
sB   scaling_strategy
.expert_level=__EXPERT_LEVEL__
{
  __REPLACE__
}
s  pre_scaler_protocol
.expert_level=__EXPERT_LEVEL__
{
high_resolution=None
.type=float
low_resolution=None
.type=float
aniso_correction=True
.type=bool
b_add = None
.type = float
outlier_level_wilson=1e-6
.type=float
 outlier_level_extreme=1e-2
.type=float
}s›  __REPLACE__
.expert_level=__EXPERT_LEVEL__
{
           target = ls loc *ls_and_loc None
         .type=choice
         iterations = *auto specified_by_max_iterations
         .type=choice
         max_iterations = 2
         .type=int

         least_squares_options{
           use_experimental_sigmas=True
           .type=bool
           scale_data=*intensities amplitudes
           .type=choice
           scale_target=basic *fancy
           .type=choice
         }

         local_scaling_options{
           use_experimental_sigmas=True
           .type=bool
           scale_data=intensities *amplitudes
           .type=choice
           scale_target=local_moment local_lsq *local_nikonov
           .type=choice
           max_depth=10
           .type=int
           target_neighbours=150
           .type=int
           neighbourhood_sphere=1
           .type=int
         }

         outlier_rejection_options{
           cut_level_sigma=3
           .type=float
           cut_level_rms_primary=4
           .type=float
           cut_level_rms_secondary=4
           .type=float
           protocol=solve rms *rms_and_sigma
           .type=choice
         }


}s¦   fa_estimation
.expert_level=__EXPERT_LEVEL__
{
   protocol = *algebraic cns combine_ano
   .type = choice
   number_of_terms_in_normalisation_curve=23
   .type=int
}
sŠ   output
{
     log = 'fatso.log'
     .type = path
     hklout = 'fatso.mtz'
     .type = path
     outlabel = '_ATSO'
     .type = str

}
sÏ   omit
.expert_level=__EXPERT_LEVEL__
{
   perform_omit=False
   .type=bool
   fraction=0.15
   .type=float
   max_number=1e5
   .type=int
   number_of_sets=10
   .type=int
   root_name='omit_'
   .type=str
}
(   tD   default_expert_level_for_parameters_that_should_be_sensible_defaultst   scaling_inputt
   basic_infot   xray_data_basict	   data_typet   scaling_strategyt   pre_scaler_protocolt   scale_protocolt   fa_estimationt   outputt   omit(   t   self(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   __init__
   s    					
				0	
		c         C   s"   d } |  j  j d | ƒ |  _  d  S(   Ns-  
    use_anomalous=True
    .type=bool
    .expert_level=5
    use_in_dispersive=True
    .type=bool
    .expert_level=5
    wavelength=None
    .type=float
    .expert_level=15
    f_prime=None
    .type=float
    .expert_level=0
    f_double_prime=None
    .type=float
    .expert_level=0
    }
    t   }(   R   t   replace(   R   t   tmp(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   add_wavelength_info¡   s    c         C   s  |  j  } | j d |  j ƒ } |  j } |  j j d d ƒ } |  j j d | ƒ } |  j |  j j d d ƒ } | j d d ƒ } |  j j d | ƒ } | j d d ƒ } | j d d ƒ } |  j	 } |  j
 } | j d d ƒ } | j d | | | | | ƒ } | S(   Nt   __EXPERT_LEVEL__t   __REPLACE__t	   referencet   ano_protocolR   s   ls loc *ls_and_loc Nones	   *loc None(   R   R   R   R   R   R   R	   R
   R   R   R   (   R   t   outer_levelt   basict   datat   scalerR   R   t   result(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   default_sad·   s4    					
												c         C   sê   |  j  } | j d |  j ƒ } |  j } |  j j d d ƒ |  j j d d ƒ } |  j j d | ƒ } |  j j d d ƒ } |  j | } | j d d ƒ } |  j j d | ƒ } | j d d ƒ } |  j	 } | j d | | | | ƒ } | S(   NR   R   t   nativet
   derivativet   iso_protocolR   (
   R   R   R   R   R   R   R
   R	   R   R   (   R   R   R   R   R   R   R   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   default_sirÖ   s,    			
								c         C   sF   |  j  ƒ  } | j d d ƒ } | j d d ƒ } | j d d ƒ } | S(   NR   t
   after_burnR   t   before_burns   least_squares_options{s@   nsr_bias=1.0
.type=float
.expert_level=0

least_squares_options{(   R!   R   (   R   R   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   default_ripö   s    		c         C   s(  |  j  } | j d |  j ƒ } |  j } |  j j d d ƒ |  j j d d ƒ } |  j j d | ƒ } |  j j d d ƒ } | j d d ƒ } |  j | |  j j d d ƒ } | j d d	 ƒ } |  j j d | ƒ } | j d d	 ƒ } |  j	 j d d
 ƒ } |  j
 } | j d | | | | | ƒ } | S(   NR   R   R   R   R   s   ls loc *ls_and_loc Nones	   *loc NoneR    R   t   10(   R   R   R   R   R   R   R
   R	   R   R   R   (   R   R   R   R   R   t   faR   R   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   default_siras  s8    			
				
								c         C   s2  |  j  ƒ  |  j } | j d |  j ƒ } |  j } |  j j d d ƒ |  j j d d ƒ } |  j j d | ƒ } |  j j d d ƒ } | j d d ƒ } |  j | |  j j d d ƒ } | j d d	 ƒ } |  j	 j d | ƒ } | j d d	 ƒ } |  j
 j d d
 ƒ } |  j } | j d | | | | | ƒ } | S(   NR   R   t   wavelength1t   wavelength2R   s   ls loc *ls_and_loc Nones	   *loc NoneR    R   R%   (   R   R   R   R   R   R   R   R
   R	   R   R   R   (   R   R   R   R   R   R&   R   R   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   default_2wmad)  s:    
			
				
								c         C   sE  |  j  ƒ  |  j } | j d |  j ƒ } |  j } |  j j d d ƒ |  j j d d ƒ |  j j d d ƒ } |  j j d | ƒ } |  j j d d ƒ } | j d d ƒ } |  j | |  j j d d	 ƒ } | j d d
 ƒ } |  j	 j d | ƒ } | j d d
 ƒ } |  j
 j d d ƒ } |  j } | j d | | | | | ƒ } | S(   NR   R   R(   R)   t   wavelength3R   s   ls loc *ls_and_loc Nones	   *loc NoneR    R   R%   (   R   R   R   R   R   R   R   R
   R	   R   R   R   (   R   R   R   R   R   R&   R   R   (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   default_3wmadQ  s8    
			%
				
								(   t   __name__t
   __module__t   __doc__R   R   R   R!   R$   R'   R*   R,   (    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyR      s   	—			 		&	(c         C   s"  t  } t |  ƒ d k r1 d GHHd GHd GHt } n  | rt ƒ  } d GHt j j | j ƒ  ƒ } | j d t	 |  d ƒ ƒ d GH~ ~ t ƒ  } t j j | j
 ƒ  ƒ } | j d t	 |  d ƒ ƒ d GH~ ~ t ƒ  } t j j | j ƒ  ƒ } | j d t	 |  d ƒ ƒ d	 GH~ ~ t ƒ  } t j j | j ƒ  ƒ } | j d t	 |  d ƒ ƒ d
 GH~ ~ t ƒ  } t j j | j ƒ  ƒ } | j d t	 |  d ƒ ƒ d
 GH~ ~ t ƒ  } t j j | j ƒ  ƒ } | j d t	 |  d ƒ ƒ d GH~ ~ t ƒ  } t j j | j ƒ  ƒ } | j d t	 |  d ƒ ƒ n  d  S(   Ni    sA   Example parameter files lego-ed together from several phil blockss,   specifiy 'expert level' on command line via s-       python make_param.py <expert_level>      s    ---------- SAD ----------t   expert_levels    ---------- SIR ----------s    ---------- SIRAS ----------s    ---------- 2WMAD ----------s    ---------- 3WMAD ----------s    ---------- RIP ----------(   t   Truet   lent   FalseR   t   iotbxt   philt   parseR   t   showt   intR!   R'   R*   R,   R$   (   t   argst   okait   testert   master_params(    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   run  s`    								t   __main__i   (
   t
   __future__R    t
   iotbx.philR4   t   syst   objectR   R=   R-   t   argv(    (    (    sF   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/mmtbx/scaling/make_param.pyt   <module>   s   ÿ {	7