
&]\c           @` s5  d  d l  m Z m Z m Z d  d l Z d  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 m Z d d	 g Z d
 Z d Z d d d d d d d d d d d d d d d d d d g Z d g Z d   Z e j j e j j d  e    d!     Z d d"  Z d#   Z d$   Z d S(%   i    (   t   divisiont   print_functiont   absolute_importN(   t   assert_allclose(   t   suppress_warnings(   t   statsi   (   t   distconti  i  g      ?g      ?t   burrt   chi2t
   gausshypert   genexpont   gengammat   kappa4t   ksonet   mielket   ncft   ncx2t   pearson3t   powerlognormt
   truncexpont   tukeylambdat   vonmisest
   wrapcauchyt   levy_stablet   trapzt   erlangc          c` s5   x. t  D]& \ }  } |  t k r |  | f Vq q Wd  S(   N(   R   t   skip_fit(   t   distnamet   arg(    (    s9   lib/python2.7/site-packages/scipy/stats/tests/test_fit.pyt   cases_test_cont_fit0   s    s   distname,argc         C` s&  |  t  k rk y t t j d  } Wn t k
 r= t } n X| rk d |  } | d 7} t j |  qk n  t t	 |   } t
 j | d d g g  } t
 j t
 j | t t
 j | j d  t g  d  } xQt D] } t
 j j d  t
 j d	 d
  Q t   A } | j d t d d  | j d | |  }	 | j |	  }
 Wd  QXWd  QX|
 | } t
 j t
 j |	 j    t t g  | d <t
 j t
 j |
   rt d   q t
 j  t
 j |  | k  r Pq q Wd t! |  } | d t! |
  7} | d t! |  7} t d | j" |   d  S(   Nt   SCIPY_XFAILs$   Fitting %s doesn't work reliably yetsH    [Set environment variable SCIPY_XFAIL=1 to run this test nevertheless.]g        g      ?i   i    i  t   allt   ignoret   categoryt   messages
   .*frechet_t   sizeis   nan returned in fits   parameter: %s
s   estimated: %s
s   diff     : %s
s   fit not very good in %s
(#   t   failing_fitst   intt   ost   environt	   Exceptiont   Truet   pytestt   xfailt   getattrR   t   npt   hstackt   maxt   vstackt   thresh_percentt   onest   numargst
   thresh_mint	   fit_sizest   randomt   seedt   errstateR   t   filtert   DeprecationWarningt   rvst   fitt   abst   meant   anyt   isnant   AssertionErrorR   t   strt   name(   R   R   R+   t   msgt   distfnt   trueargt   diffthresholdt   fit_sizet   supR;   t   estt   difft   txt(    (    s9   lib/python2.7/site-packages/scipy/stats/tests/test_fit.pyt   test_cont_fit9   s>    


	 
,c         C` sC   t  t |   } | j |  d } t | | d | d d |  d  S(   Nit   atolt   err_msgs"   poor mle fit of (loc, scale) in %s(   R,   R   R<   R   (   RC   t   datat   desiredRN   t   dt   actual(    (    s9   lib/python2.7/site-packages/scipy/stats/tests/test_fit.pyt   _check_loc_scale_mle_fith   s    c       	   C` s]   t  j d d d d d d d d g  }  t d |  d d g d  t d |  d d	 g d  d  S(
   Ng)\(?g{Gz?gGz?g       @t   uniformgGz?gMbP?t   expongp=
ף?(   R-   t   arrayRT   (   RP   (    (    s9   lib/python2.7/site-packages/scipy/stats/tests/test_fit.pyt"   test_non_default_loc_scale_mle_fito   s    'c          C` sS   d d d d d d d d g }  t  j j |  d d } t | d d g d d d S(   s   gh-6167i    i   t   flocg      ?RN   gMbP?N(   R   RV   R<   R   (   RP   t   phat(    (    s9   lib/python2.7/site-packages/scipy/stats/tests/test_fit.pyt   test_expon_fitu   s    (   t
   __future__R    R   R   R&   t   numpyR-   t   numpy.testingR   t   scipy._lib._numpy_compatR   R*   t   scipyR   t   test_continuous_basicR   R5   R1   R4   R$   R   R   t   markt   slowt   parametrizeRM   t   NoneRT   RX   R[   (    (    (    s9   lib/python2.7/site-packages/scipy/stats/tests/test_fit.pyt   <module>   sF   					$.	